vendor: update github.com/dropbox/dropbox-sdk-go-unofficial to fix #1804

This commit is contained in:
Nick Craig-Wood 2017-11-15 15:55:01 +00:00
parent e491093cd1
commit fc352c1ff6
25 changed files with 1859 additions and 902 deletions

2
Gopkg.lock generated
View File

@ -83,7 +83,7 @@
branch = "master"
name = "github.com/dropbox/dropbox-sdk-go-unofficial"
packages = ["dropbox","dropbox/async","dropbox/file_properties","dropbox/files"]
revision = "98997935f6b3ff4f4fa46275abaa23b02537178d"
revision = "9a536e3b58ed271dc9d1f21681db990ca601a551"
[[projects]]
name = "github.com/go-ini/ini"

View File

@ -43,7 +43,10 @@ import "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox"
import "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users"
func main() {
config := dropbox.Config{Token: token, Verbose: true} // second arg enables verbose logging in the SDK
config := dropbox.Config{
Token: token,
LogLevel: dropbox.LogInfo, // if needed, set the desired logging level. Default is off
}
dbx := users.New(config)
// start making API calls
}

View File

@ -72,13 +72,40 @@ func (u *LaunchResultBase) UnmarshalJSON(body []byte) error {
// the job, no additional information is returned.
type LaunchEmptyResult 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"`
}
// Valid tag values for LaunchEmptyResult
const (
LaunchEmptyResultAsyncJobId = "async_job_id"
LaunchEmptyResultComplete = "complete"
)
// UnmarshalJSON deserializes into a LaunchEmptyResult instance
func (u *LaunchEmptyResult) 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 "async_job_id":
err = json.Unmarshal(body, &u.AsyncJobId)
if err != nil {
return err
}
}
return nil
}
// PollArg : Arguments for methods that poll the status of an asynchronous job.
type PollArg struct {
// AsyncJobId : Id of the asynchronous job. This is the value of a response
@ -115,6 +142,7 @@ type PollEmptyResult struct {
// Valid tag values for PollEmptyResult
const (
PollEmptyResultInProgress = "in_progress"
PollEmptyResultComplete = "complete"
)

View File

@ -49,7 +49,7 @@ type TokenFromOauth1APIError struct {
func (dbx *apiImpl) TokenFromOauth1(arg *TokenFromOAuth1Arg) (res *TokenFromOAuth1Result, err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -66,21 +66,21 @@ func (dbx *apiImpl) TokenFromOauth1(arg *TokenFromOAuth1Arg) (res *TokenFromOAut
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -130,21 +130,21 @@ func (dbx *apiImpl) TokenRevoke() (err error) {
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
return
}

View File

@ -42,8 +42,8 @@ type Client interface {
// explicitly marked for deletion.
PropertiesOverwrite(arg *OverwritePropertyGroupArg) (err error)
// PropertiesRemove : Remove the specified property group from the file. To
// remove specific property field key value pairs, see route
// `propertiesUpdate`. To update a template, see `templatesUpdateForUser` or
// remove specific property field key value pairs, see `propertiesUpdate`.
// To update a template, see `templatesUpdateForUser` or
// `templatesUpdateForTeam`. Templates can't be removed once created.
PropertiesRemove(arg *RemovePropertiesArg) (err error)
// PropertiesSearch : Search across property templates for particular
@ -57,21 +57,24 @@ type Client interface {
// `propertiesOverwrite` will delete any fields that are omitted from a
// property group.
PropertiesUpdate(arg *UpdatePropertiesArg) (err error)
// TemplatesAddForTeam : Add a template associated with a team. See route
// TemplatesAddForTeam : Add a template associated with a team. See
// `propertiesAdd` to add properties to a file or folder.
TemplatesAddForTeam(arg *AddTemplateArg) (res *AddTemplateResult, err error)
// TemplatesAddForUser : Add a template associated with a user. See route
// `propertiesAdd` to add properties to a file.
// TemplatesAddForUser : Add a template associated with a user. See
// `propertiesAdd` to add properties to a file. This endpoint can't be
// called on a team member or admin's behalf.
TemplatesAddForUser(arg *AddTemplateArg) (res *AddTemplateResult, err error)
// TemplatesGetForTeam : Get the schema for a specified template.
TemplatesGetForTeam(arg *GetTemplateArg) (res *GetTemplateResult, err error)
// TemplatesGetForUser : Get the schema for a specified template.
// TemplatesGetForUser : Get the schema for a specified template. This
// endpoint can't be called on a team member or admin's behalf.
TemplatesGetForUser(arg *GetTemplateArg) (res *GetTemplateResult, err error)
// TemplatesListForTeam : Get the template identifiers for a team. To get
// the schema of each template use `templatesGetForTeam`.
TemplatesListForTeam() (res *ListTemplateResult, err error)
// TemplatesListForUser : Get the template identifiers for a team. To get
// the schema of each template use `templatesGetForUser`.
// the schema of each template use `templatesGetForUser`. This endpoint
// can't be called on a team member or admin's behalf.
TemplatesListForUser() (res *ListTemplateResult, err error)
// TemplatesUpdateForTeam : Update a template associated with a team. This
// route can update the template name, the template description and add
@ -79,7 +82,8 @@ type Client interface {
TemplatesUpdateForTeam(arg *UpdateTemplateArg) (res *UpdateTemplateResult, err error)
// TemplatesUpdateForUser : Update a template associated with a user. This
// route can update the template name, the template description and add
// optional properties to templates.
// optional properties to templates. This endpoint can't be called on a team
// member or admin's behalf.
TemplatesUpdateForUser(arg *UpdateTemplateArg) (res *UpdateTemplateResult, err error)
}
@ -94,7 +98,7 @@ type PropertiesAddAPIError struct {
func (dbx *apiImpl) PropertiesAdd(arg *AddPropertiesArg) (err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -111,21 +115,21 @@ func (dbx *apiImpl) PropertiesAdd(arg *AddPropertiesArg) (err error) {
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
return
}
@ -161,7 +165,7 @@ type PropertiesOverwriteAPIError struct {
func (dbx *apiImpl) PropertiesOverwrite(arg *OverwritePropertyGroupArg) (err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -178,21 +182,21 @@ func (dbx *apiImpl) PropertiesOverwrite(arg *OverwritePropertyGroupArg) (err err
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
return
}
@ -228,7 +232,7 @@ type PropertiesRemoveAPIError struct {
func (dbx *apiImpl) PropertiesRemove(arg *RemovePropertiesArg) (err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -245,21 +249,21 @@ func (dbx *apiImpl) PropertiesRemove(arg *RemovePropertiesArg) (err error) {
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
return
}
@ -295,7 +299,7 @@ type PropertiesSearchAPIError struct {
func (dbx *apiImpl) PropertiesSearch(arg *PropertiesSearchArg) (res *PropertiesSearchResult, err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -312,21 +316,21 @@ func (dbx *apiImpl) PropertiesSearch(arg *PropertiesSearchArg) (res *PropertiesS
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -367,7 +371,7 @@ type PropertiesUpdateAPIError struct {
func (dbx *apiImpl) PropertiesUpdate(arg *UpdatePropertiesArg) (err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -384,21 +388,21 @@ func (dbx *apiImpl) PropertiesUpdate(arg *UpdatePropertiesArg) (err error) {
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
return
}
@ -434,7 +438,7 @@ type TemplatesAddForTeamAPIError struct {
func (dbx *apiImpl) TemplatesAddForTeam(arg *AddTemplateArg) (res *AddTemplateResult, err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -448,21 +452,21 @@ func (dbx *apiImpl) TemplatesAddForTeam(arg *AddTemplateArg) (res *AddTemplateRe
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -503,7 +507,7 @@ type TemplatesAddForUserAPIError struct {
func (dbx *apiImpl) TemplatesAddForUser(arg *AddTemplateArg) (res *AddTemplateResult, err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -520,21 +524,21 @@ func (dbx *apiImpl) TemplatesAddForUser(arg *AddTemplateArg) (res *AddTemplateRe
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -575,7 +579,7 @@ type TemplatesGetForTeamAPIError struct {
func (dbx *apiImpl) TemplatesGetForTeam(arg *GetTemplateArg) (res *GetTemplateResult, err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -589,21 +593,21 @@ func (dbx *apiImpl) TemplatesGetForTeam(arg *GetTemplateArg) (res *GetTemplateRe
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -644,7 +648,7 @@ type TemplatesGetForUserAPIError struct {
func (dbx *apiImpl) TemplatesGetForUser(arg *GetTemplateArg) (res *GetTemplateResult, err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -661,21 +665,21 @@ func (dbx *apiImpl) TemplatesGetForUser(arg *GetTemplateArg) (res *GetTemplateRe
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -722,21 +726,21 @@ func (dbx *apiImpl) TemplatesListForTeam() (res *ListTemplateResult, err error)
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -786,21 +790,21 @@ func (dbx *apiImpl) TemplatesListForUser() (res *ListTemplateResult, err error)
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -841,7 +845,7 @@ type TemplatesUpdateForTeamAPIError struct {
func (dbx *apiImpl) TemplatesUpdateForTeam(arg *UpdateTemplateArg) (res *UpdateTemplateResult, err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -855,21 +859,21 @@ func (dbx *apiImpl) TemplatesUpdateForTeam(arg *UpdateTemplateArg) (res *UpdateT
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -910,7 +914,7 @@ type TemplatesUpdateForUserAPIError struct {
func (dbx *apiImpl) TemplatesUpdateForUser(arg *UpdateTemplateArg) (res *UpdateTemplateResult, err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -927,21 +931,21 @@ func (dbx *apiImpl) TemplatesUpdateForUser(arg *UpdateTemplateArg) (res *UpdateT
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {

View File

@ -95,12 +95,17 @@ func (u *TemplateError) UnmarshalJSON(body []byte) error {
// PropertiesError : has no documentation (yet)
type PropertiesError 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 *LookupError `json:"path,omitempty"`
}
// Valid tag values for PropertiesError
const (
PropertiesErrorTemplateNotFound = "template_not_found"
PropertiesErrorRestrictedContent = "restricted_content"
PropertiesErrorOther = "other"
PropertiesErrorPath = "path"
PropertiesErrorUnsupportedFolder = "unsupported_folder"
)
@ -119,6 +124,12 @@ func (u *PropertiesError) UnmarshalJSON(body []byte) error {
}
u.Tag = w.Tag
switch u.Tag {
case "template_not_found":
err = json.Unmarshal(body, &u.TemplateNotFound)
if err != nil {
return err
}
case "path":
err = json.Unmarshal(w.Path, &u.Path)
@ -132,24 +143,104 @@ func (u *PropertiesError) UnmarshalJSON(body []byte) error {
// InvalidPropertyGroupError : has no documentation (yet)
type InvalidPropertyGroupError 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 *LookupError `json:"path,omitempty"`
}
// Valid tag values for InvalidPropertyGroupError
const (
InvalidPropertyGroupErrorTemplateNotFound = "template_not_found"
InvalidPropertyGroupErrorRestrictedContent = "restricted_content"
InvalidPropertyGroupErrorOther = "other"
InvalidPropertyGroupErrorPath = "path"
InvalidPropertyGroupErrorUnsupportedFolder = "unsupported_folder"
InvalidPropertyGroupErrorPropertyFieldTooLarge = "property_field_too_large"
InvalidPropertyGroupErrorDoesNotFitTemplate = "does_not_fit_template"
)
// UnmarshalJSON deserializes into a InvalidPropertyGroupError instance
func (u *InvalidPropertyGroupError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// Path : has no documentation (yet)
Path json.RawMessage `json:"path,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 "template_not_found":
err = json.Unmarshal(body, &u.TemplateNotFound)
if err != nil {
return err
}
case "path":
err = json.Unmarshal(w.Path, &u.Path)
if err != nil {
return err
}
}
return nil
}
// AddPropertiesError : has no documentation (yet)
type AddPropertiesError 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 *LookupError `json:"path,omitempty"`
}
// Valid tag values for AddPropertiesError
const (
AddPropertiesErrorTemplateNotFound = "template_not_found"
AddPropertiesErrorRestrictedContent = "restricted_content"
AddPropertiesErrorOther = "other"
AddPropertiesErrorPath = "path"
AddPropertiesErrorUnsupportedFolder = "unsupported_folder"
AddPropertiesErrorPropertyFieldTooLarge = "property_field_too_large"
AddPropertiesErrorDoesNotFitTemplate = "does_not_fit_template"
AddPropertiesErrorPropertyGroupAlreadyExists = "property_group_already_exists"
)
// UnmarshalJSON deserializes into a AddPropertiesError instance
func (u *AddPropertiesError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// Path : has no documentation (yet)
Path json.RawMessage `json:"path,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 "template_not_found":
err = json.Unmarshal(body, &u.TemplateNotFound)
if err != nil {
return err
}
case "path":
err = json.Unmarshal(w.Path, &u.Path)
if err != nil {
return err
}
}
return nil
}
// PropertyGroupTemplate : Defines how a property group may be structured.
type PropertyGroupTemplate struct {
// Name : Display name for the template. Template names can be up to 256
@ -306,16 +397,43 @@ func (u *LookupError) UnmarshalJSON(body []byte) error {
// ModifyTemplateError : has no documentation (yet)
type ModifyTemplateError struct {
dropbox.Tagged
// TemplateNotFound : Template does not exist for the given identifier.
TemplateNotFound string `json:"template_not_found,omitempty"`
}
// Valid tag values for ModifyTemplateError
const (
ModifyTemplateErrorTemplateNotFound = "template_not_found"
ModifyTemplateErrorRestrictedContent = "restricted_content"
ModifyTemplateErrorOther = "other"
ModifyTemplateErrorConflictingPropertyNames = "conflicting_property_names"
ModifyTemplateErrorTooManyProperties = "too_many_properties"
ModifyTemplateErrorTooManyTemplates = "too_many_templates"
ModifyTemplateErrorTemplateAttributeTooLarge = "template_attribute_too_large"
)
// UnmarshalJSON deserializes into a ModifyTemplateError instance
func (u *ModifyTemplateError) 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 "template_not_found":
err = json.Unmarshal(body, &u.TemplateNotFound)
if err != nil {
return err
}
}
return nil
}
// OverwritePropertyGroupArg : has no documentation (yet)
type OverwritePropertyGroupArg struct {
// Path : A unique identifier for the file or folder.
@ -584,12 +702,21 @@ func NewRemovePropertiesArg(Path string, PropertyTemplateIds []string) *RemovePr
// RemovePropertiesError : has no documentation (yet)
type RemovePropertiesError 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 *LookupError `json:"path,omitempty"`
// PropertyGroupLookup : has no documentation (yet)
PropertyGroupLookup *LookUpPropertiesError `json:"property_group_lookup,omitempty"`
}
// Valid tag values for RemovePropertiesError
const (
RemovePropertiesErrorTemplateNotFound = "template_not_found"
RemovePropertiesErrorRestrictedContent = "restricted_content"
RemovePropertiesErrorOther = "other"
RemovePropertiesErrorPath = "path"
RemovePropertiesErrorUnsupportedFolder = "unsupported_folder"
RemovePropertiesErrorPropertyGroupLookup = "property_group_lookup"
)
@ -597,6 +724,8 @@ const (
func (u *RemovePropertiesError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// Path : has no documentation (yet)
Path json.RawMessage `json:"path,omitempty"`
// PropertyGroupLookup : has no documentation (yet)
PropertyGroupLookup json.RawMessage `json:"property_group_lookup,omitempty"`
}
@ -607,6 +736,18 @@ func (u *RemovePropertiesError) UnmarshalJSON(body []byte) error {
}
u.Tag = w.Tag
switch u.Tag {
case "template_not_found":
err = json.Unmarshal(body, &u.TemplateNotFound)
if err != nil {
return err
}
case "path":
err = json.Unmarshal(w.Path, &u.Path)
if err != nil {
return err
}
case "property_group_lookup":
err = json.Unmarshal(w.PropertyGroupLookup, &u.PropertyGroupLookup)
@ -688,12 +829,23 @@ func NewUpdatePropertiesArg(Path string, UpdatePropertyGroups []*PropertyGroupUp
// UpdatePropertiesError : has no documentation (yet)
type UpdatePropertiesError 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 *LookupError `json:"path,omitempty"`
// PropertyGroupLookup : has no documentation (yet)
PropertyGroupLookup *LookUpPropertiesError `json:"property_group_lookup,omitempty"`
}
// Valid tag values for UpdatePropertiesError
const (
UpdatePropertiesErrorTemplateNotFound = "template_not_found"
UpdatePropertiesErrorRestrictedContent = "restricted_content"
UpdatePropertiesErrorOther = "other"
UpdatePropertiesErrorPath = "path"
UpdatePropertiesErrorUnsupportedFolder = "unsupported_folder"
UpdatePropertiesErrorPropertyFieldTooLarge = "property_field_too_large"
UpdatePropertiesErrorDoesNotFitTemplate = "does_not_fit_template"
UpdatePropertiesErrorPropertyGroupLookup = "property_group_lookup"
)
@ -701,6 +853,8 @@ const (
func (u *UpdatePropertiesError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// Path : has no documentation (yet)
Path json.RawMessage `json:"path,omitempty"`
// PropertyGroupLookup : has no documentation (yet)
PropertyGroupLookup json.RawMessage `json:"property_group_lookup,omitempty"`
}
@ -711,6 +865,18 @@ func (u *UpdatePropertiesError) UnmarshalJSON(body []byte) error {
}
u.Tag = w.Tag
switch u.Tag {
case "template_not_found":
err = json.Unmarshal(body, &u.TemplateNotFound)
if err != nil {
return err
}
case "path":
err = json.Unmarshal(w.Path, &u.Path)
if err != nil {
return err
}
case "property_group_lookup":
err = json.Unmarshal(w.PropertyGroupLookup, &u.PropertyGroupLookup)

View File

@ -54,7 +54,7 @@ type CreateAPIError struct {
func (dbx *apiImpl) Create(arg *CreateFileRequestArgs) (res *FileRequest, err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -71,21 +71,21 @@ func (dbx *apiImpl) Create(arg *CreateFileRequestArgs) (res *FileRequest, err er
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -126,7 +126,7 @@ type GetAPIError struct {
func (dbx *apiImpl) Get(arg *GetFileRequestArgs) (res *FileRequest, err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -143,21 +143,21 @@ func (dbx *apiImpl) Get(arg *GetFileRequestArgs) (res *FileRequest, err error) {
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -207,21 +207,21 @@ func (dbx *apiImpl) List() (res *ListFileRequestsResult, err error) {
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -262,7 +262,7 @@ type UpdateAPIError struct {
func (dbx *apiImpl) Update(arg *UpdateFileRequestArgs) (res *FileRequest, err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -279,21 +279,21 @@ func (dbx *apiImpl) Update(arg *UpdateFileRequestArgs) (res *FileRequest, err er
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {

View File

@ -19,8 +19,7 @@
// THE SOFTWARE.
// Package file_requests : This namespace contains endpoints and data types for
// file request operations. Warning: This namespace is in beta and is subject to
// backwards-incompatible changes.
// file request operations.
package file_requests
import (
@ -75,6 +74,8 @@ type FileRequestError struct {
// Valid tag values for FileRequestError
const (
FileRequestErrorDisabledForTeam = "disabled_for_team"
FileRequestErrorOther = "other"
FileRequestErrorNotFound = "not_found"
FileRequestErrorNotAFolder = "not_a_folder"
FileRequestErrorAppLacksAccess = "app_lacks_access"
@ -90,6 +91,14 @@ type CreateFileRequestError struct {
// Valid tag values for CreateFileRequestError
const (
CreateFileRequestErrorDisabledForTeam = "disabled_for_team"
CreateFileRequestErrorOther = "other"
CreateFileRequestErrorNotFound = "not_found"
CreateFileRequestErrorNotAFolder = "not_a_folder"
CreateFileRequestErrorAppLacksAccess = "app_lacks_access"
CreateFileRequestErrorNoPermission = "no_permission"
CreateFileRequestErrorEmailUnverified = "email_unverified"
CreateFileRequestErrorValidationError = "validation_error"
CreateFileRequestErrorInvalidLocation = "invalid_location"
CreateFileRequestErrorRateLimit = "rate_limit"
)
@ -167,7 +176,16 @@ type GetFileRequestError struct {
}
// Valid tag values for GetFileRequestError
const ()
const (
GetFileRequestErrorDisabledForTeam = "disabled_for_team"
GetFileRequestErrorOther = "other"
GetFileRequestErrorNotFound = "not_found"
GetFileRequestErrorNotAFolder = "not_a_folder"
GetFileRequestErrorAppLacksAccess = "app_lacks_access"
GetFileRequestErrorNoPermission = "no_permission"
GetFileRequestErrorEmailUnverified = "email_unverified"
GetFileRequestErrorValidationError = "validation_error"
)
// GracePeriod : has no documentation (yet)
type GracePeriod struct {
@ -190,7 +208,10 @@ type ListFileRequestsError struct {
}
// Valid tag values for ListFileRequestsError
const ()
const (
ListFileRequestsErrorDisabledForTeam = "disabled_for_team"
ListFileRequestsErrorOther = "other"
)
// ListFileRequestsResult : Result for `list`.
type ListFileRequestsResult struct {
@ -274,4 +295,13 @@ type UpdateFileRequestError struct {
}
// Valid tag values for UpdateFileRequestError
const ()
const (
UpdateFileRequestErrorDisabledForTeam = "disabled_for_team"
UpdateFileRequestErrorOther = "other"
UpdateFileRequestErrorNotFound = "not_found"
UpdateFileRequestErrorNotAFolder = "not_a_folder"
UpdateFileRequestErrorAppLacksAccess = "app_lacks_access"
UpdateFileRequestErrorNoPermission = "no_permission"
UpdateFileRequestErrorEmailUnverified = "email_unverified"
UpdateFileRequestErrorValidationError = "validation_error"
)

File diff suppressed because it is too large Load Diff

View File

@ -113,12 +113,15 @@ func (u *GetMetadataError) UnmarshalJSON(body []byte) error {
// AlphaGetMetadataError : has no documentation (yet)
type AlphaGetMetadataError struct {
dropbox.Tagged
// Path : has no documentation (yet)
Path *LookupError `json:"path,omitempty"`
// PropertiesError : has no documentation (yet)
PropertiesError *file_properties.LookUpPropertiesError `json:"properties_error,omitempty"`
}
// Valid tag values for AlphaGetMetadataError
const (
AlphaGetMetadataErrorPath = "path"
AlphaGetMetadataErrorPropertiesError = "properties_error"
)
@ -126,6 +129,8 @@ const (
func (u *AlphaGetMetadataError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// Path : has no documentation (yet)
Path json.RawMessage `json:"path,omitempty"`
// PropertiesError : has no documentation (yet)
PropertiesError json.RawMessage `json:"properties_error,omitempty"`
}
@ -136,6 +141,12 @@ func (u *AlphaGetMetadataError) UnmarshalJSON(body []byte) error {
}
u.Tag = w.Tag
switch u.Tag {
case "path":
err = json.Unmarshal(w.Path, &u.Path)
if err != nil {
return err
}
case "properties_error":
err = json.Unmarshal(w.PropertiesError, &u.PropertiesError)
@ -320,6 +331,7 @@ type DeleteBatchJobStatus struct {
// Valid tag values for DeleteBatchJobStatus
const (
DeleteBatchJobStatusInProgress = "in_progress"
DeleteBatchJobStatusComplete = "complete"
DeleteBatchJobStatusFailed = "failed"
DeleteBatchJobStatusOther = "other"
@ -361,12 +373,17 @@ func (u *DeleteBatchJobStatus) UnmarshalJSON(body []byte) error {
// an asynchronous job or complete synchronously.
type DeleteBatchLaunch 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 *DeleteBatchResult `json:"complete,omitempty"`
}
// Valid tag values for DeleteBatchLaunch
const (
DeleteBatchLaunchAsyncJobId = "async_job_id"
DeleteBatchLaunchComplete = "complete"
DeleteBatchLaunchOther = "other"
)
@ -385,6 +402,12 @@ func (u *DeleteBatchLaunch) UnmarshalJSON(body []byte) error {
}
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)
@ -1144,6 +1167,11 @@ type ListFolderArg struct {
// is an approximate number and there can be slightly more entries returned
// in some cases.
Limit uint32 `json:"limit,omitempty"`
// SharedLink : A shared link to list the contents of. If the link is
// password-protected, the password must be provided. If this field is
// present, `ListFolderArg.path` will be relative to root of the shared
// link. Only non-recursive mode is supported for shared link.
SharedLink *SharedLink `json:"shared_link,omitempty"`
}
// NewListFolderArg returns a new ListFolderArg instance
@ -1335,6 +1363,9 @@ func NewListFolderResult(Entries []IsMetadata, Cursor string, HasMore bool) *Lis
type ListRevisionsArg struct {
// Path : The path to the file you want to see the revisions of.
Path string `json:"path"`
// Mode : Determines the behavior of the API in listing the revisions for a
// given file path or id.
Mode *ListRevisionsMode `json:"mode"`
// Limit : The maximum number of revision entries returned.
Limit uint64 `json:"limit"`
}
@ -1343,6 +1374,7 @@ type ListRevisionsArg struct {
func NewListRevisionsArg(Path string) *ListRevisionsArg {
s := new(ListRevisionsArg)
s.Path = Path
s.Mode = &ListRevisionsMode{Tagged: dropbox.Tagged{"path"}}
s.Limit = 10
return s
}
@ -1384,9 +1416,22 @@ func (u *ListRevisionsError) UnmarshalJSON(body []byte) error {
return nil
}
// ListRevisionsMode : has no documentation (yet)
type ListRevisionsMode struct {
dropbox.Tagged
}
// Valid tag values for ListRevisionsMode
const (
ListRevisionsModePath = "path"
ListRevisionsModeId = "id"
ListRevisionsModeOther = "other"
)
// ListRevisionsResult : has no documentation (yet)
type ListRevisionsResult struct {
// IsDeleted : If the file is deleted.
// IsDeleted : If the file identified by the latest revision in the response
// is either deleted or moved.
IsDeleted bool `json:"is_deleted"`
// ServerDeleted : The time of deletion if the file was deleted.
ServerDeleted time.Time `json:"server_deleted,omitempty"`
@ -1773,13 +1818,69 @@ func (u *RelocationError) UnmarshalJSON(body []byte) error {
// RelocationBatchError : has no documentation (yet)
type RelocationBatchError struct {
dropbox.Tagged
// FromLookup : has no documentation (yet)
FromLookup *LookupError `json:"from_lookup,omitempty"`
// FromWrite : has no documentation (yet)
FromWrite *WriteError `json:"from_write,omitempty"`
// To : has no documentation (yet)
To *WriteError `json:"to,omitempty"`
}
// Valid tag values for RelocationBatchError
const (
RelocationBatchErrorFromLookup = "from_lookup"
RelocationBatchErrorFromWrite = "from_write"
RelocationBatchErrorTo = "to"
RelocationBatchErrorCantCopySharedFolder = "cant_copy_shared_folder"
RelocationBatchErrorCantNestSharedFolder = "cant_nest_shared_folder"
RelocationBatchErrorCantMoveFolderIntoItself = "cant_move_folder_into_itself"
RelocationBatchErrorTooManyFiles = "too_many_files"
RelocationBatchErrorDuplicatedOrNestedPaths = "duplicated_or_nested_paths"
RelocationBatchErrorCantTransferOwnership = "cant_transfer_ownership"
RelocationBatchErrorOther = "other"
RelocationBatchErrorTooManyWriteOperations = "too_many_write_operations"
)
// UnmarshalJSON deserializes into a RelocationBatchError instance
func (u *RelocationBatchError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// FromLookup : has no documentation (yet)
FromLookup json.RawMessage `json:"from_lookup,omitempty"`
// FromWrite : has no documentation (yet)
FromWrite json.RawMessage `json:"from_write,omitempty"`
// To : has no documentation (yet)
To json.RawMessage `json:"to,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 "from_lookup":
err = json.Unmarshal(w.FromLookup, &u.FromLookup)
if err != nil {
return err
}
case "from_write":
err = json.Unmarshal(w.FromWrite, &u.FromWrite)
if err != nil {
return err
}
case "to":
err = json.Unmarshal(w.To, &u.To)
if err != nil {
return err
}
}
return nil
}
// RelocationBatchJobStatus : has no documentation (yet)
type RelocationBatchJobStatus struct {
dropbox.Tagged
@ -1791,6 +1892,7 @@ type RelocationBatchJobStatus struct {
// Valid tag values for RelocationBatchJobStatus
const (
RelocationBatchJobStatusInProgress = "in_progress"
RelocationBatchJobStatusComplete = "complete"
RelocationBatchJobStatusFailed = "failed"
)
@ -1831,12 +1933,17 @@ func (u *RelocationBatchJobStatus) UnmarshalJSON(body []byte) error {
// may either launch an asynchronous job or complete synchronously.
type RelocationBatchLaunch 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 *RelocationBatchResult `json:"complete,omitempty"`
}
// Valid tag values for RelocationBatchLaunch
const (
RelocationBatchLaunchAsyncJobId = "async_job_id"
RelocationBatchLaunchComplete = "complete"
RelocationBatchLaunchOther = "other"
)
@ -1855,6 +1962,12 @@ func (u *RelocationBatchLaunch) UnmarshalJSON(body []byte) error {
}
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)
@ -2110,6 +2223,7 @@ type SaveUrlJobStatus struct {
// Valid tag values for SaveUrlJobStatus
const (
SaveUrlJobStatusInProgress = "in_progress"
SaveUrlJobStatusComplete = "complete"
SaveUrlJobStatusFailed = "failed"
)
@ -2149,12 +2263,17 @@ func (u *SaveUrlJobStatus) UnmarshalJSON(body []byte) error {
// SaveUrlResult : has no documentation (yet)
type SaveUrlResult 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 : Metadata of the file where the URL is saved to.
Complete *FileMetadata `json:"complete,omitempty"`
}
// Valid tag values for SaveUrlResult
const (
SaveUrlResultAsyncJobId = "async_job_id"
SaveUrlResultComplete = "complete"
)
@ -2172,6 +2291,12 @@ func (u *SaveUrlResult) UnmarshalJSON(body []byte) error {
}
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)
@ -2310,6 +2435,21 @@ func NewSearchResult(Matches []*SearchMatch, More bool, Start uint64) *SearchRes
return s
}
// SharedLink : has no documentation (yet)
type SharedLink struct {
// Url : Shared link url.
Url string `json:"url"`
// Password : Password for the shared link.
Password string `json:"password,omitempty"`
}
// NewSharedLink returns a new SharedLink instance
func NewSharedLink(Url string) *SharedLink {
s := new(SharedLink)
s.Url = Url
return s
}
// ThumbnailArg : has no documentation (yet)
type ThumbnailArg struct {
// Path : The path to the image file you want to thumbnail.
@ -2435,12 +2575,16 @@ func (u *UploadError) UnmarshalJSON(body []byte) error {
// UploadErrorWithProperties : has no documentation (yet)
type UploadErrorWithProperties struct {
dropbox.Tagged
// Path : Unable to save the uploaded contents to a file.
Path *UploadWriteFailed `json:"path,omitempty"`
// PropertiesError : has no documentation (yet)
PropertiesError *file_properties.InvalidPropertyGroupError `json:"properties_error,omitempty"`
}
// Valid tag values for UploadErrorWithProperties
const (
UploadErrorWithPropertiesPath = "path"
UploadErrorWithPropertiesOther = "other"
UploadErrorWithPropertiesPropertiesError = "properties_error"
)
@ -2448,6 +2592,8 @@ const (
func (u *UploadErrorWithProperties) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// Path : Unable to save the uploaded contents to a file.
Path json.RawMessage `json:"path,omitempty"`
// PropertiesError : has no documentation (yet)
PropertiesError json.RawMessage `json:"properties_error,omitempty"`
}
@ -2458,6 +2604,12 @@ func (u *UploadErrorWithProperties) UnmarshalJSON(body []byte) error {
}
u.Tag = w.Tag
switch u.Tag {
case "path":
err = json.Unmarshal(body, &u.Path)
if err != nil {
return err
}
case "properties_error":
err = json.Unmarshal(w.PropertiesError, &u.PropertiesError)
@ -2542,6 +2694,7 @@ type UploadSessionFinishBatchJobStatus struct {
// Valid tag values for UploadSessionFinishBatchJobStatus
const (
UploadSessionFinishBatchJobStatusInProgress = "in_progress"
UploadSessionFinishBatchJobStatusComplete = "complete"
)
@ -2574,12 +2727,17 @@ func (u *UploadSessionFinishBatchJobStatus) UnmarshalJSON(body []byte) error {
// complete synchronously.
type UploadSessionFinishBatchLaunch 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 *UploadSessionFinishBatchResult `json:"complete,omitempty"`
}
// Valid tag values for UploadSessionFinishBatchLaunch
const (
UploadSessionFinishBatchLaunchAsyncJobId = "async_job_id"
UploadSessionFinishBatchLaunchComplete = "complete"
UploadSessionFinishBatchLaunchOther = "other"
)
@ -2598,6 +2756,12 @@ func (u *UploadSessionFinishBatchLaunch) UnmarshalJSON(body []byte) error {
}
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)

View File

@ -108,7 +108,7 @@ type DocsArchiveAPIError struct {
func (dbx *apiImpl) DocsArchive(arg *RefPaperDoc) (err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -125,21 +125,21 @@ func (dbx *apiImpl) DocsArchive(arg *RefPaperDoc) (err error) {
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
return
}
@ -175,7 +175,7 @@ type DocsCreateAPIError struct {
func (dbx *apiImpl) DocsCreate(arg *PaperDocCreateArgs, content io.Reader) (res *PaperDocCreateUpdateResult, err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -193,21 +193,21 @@ func (dbx *apiImpl) DocsCreate(arg *PaperDocCreateArgs, content io.Reader) (res
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -248,7 +248,7 @@ type DocsDownloadAPIError struct {
func (dbx *apiImpl) DocsDownload(arg *PaperDocExport) (res *PaperDocExportResult, content io.ReadCloser, err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -265,17 +265,17 @@ func (dbx *apiImpl) DocsDownload(arg *PaperDocExport) (res *PaperDocExportResult
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
body := []byte(resp.Header.Get("Dropbox-API-Result"))
content = resp.Body
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -285,6 +285,11 @@ func (dbx *apiImpl) DocsDownload(arg *PaperDocExport) (res *PaperDocExportResult
return
}
if resp.StatusCode == http.StatusConflict {
defer resp.Body.Close()
body, err = ioutil.ReadAll(resp.Body)
if err != nil {
return
}
var apiError DocsDownloadAPIError
err = json.Unmarshal(body, &apiError)
if err != nil {
@ -316,7 +321,7 @@ type DocsFolderUsersListAPIError struct {
func (dbx *apiImpl) DocsFolderUsersList(arg *ListUsersOnFolderArgs) (res *ListUsersOnFolderResponse, err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -333,21 +338,21 @@ func (dbx *apiImpl) DocsFolderUsersList(arg *ListUsersOnFolderArgs) (res *ListUs
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -388,7 +393,7 @@ type DocsFolderUsersListContinueAPIError struct {
func (dbx *apiImpl) DocsFolderUsersListContinue(arg *ListUsersOnFolderContinueArgs) (res *ListUsersOnFolderResponse, err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -405,21 +410,21 @@ func (dbx *apiImpl) DocsFolderUsersListContinue(arg *ListUsersOnFolderContinueAr
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -460,7 +465,7 @@ type DocsGetFolderInfoAPIError struct {
func (dbx *apiImpl) DocsGetFolderInfo(arg *RefPaperDoc) (res *FoldersContainingPaperDoc, err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -477,21 +482,21 @@ func (dbx *apiImpl) DocsGetFolderInfo(arg *RefPaperDoc) (res *FoldersContainingP
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -532,7 +537,7 @@ type DocsListAPIError struct {
func (dbx *apiImpl) DocsList(arg *ListPaperDocsArgs) (res *ListPaperDocsResponse, err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -549,21 +554,21 @@ func (dbx *apiImpl) DocsList(arg *ListPaperDocsArgs) (res *ListPaperDocsResponse
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -604,7 +609,7 @@ type DocsListContinueAPIError struct {
func (dbx *apiImpl) DocsListContinue(arg *ListPaperDocsContinueArgs) (res *ListPaperDocsResponse, err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -621,21 +626,21 @@ func (dbx *apiImpl) DocsListContinue(arg *ListPaperDocsContinueArgs) (res *ListP
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -676,7 +681,7 @@ type DocsPermanentlyDeleteAPIError struct {
func (dbx *apiImpl) DocsPermanentlyDelete(arg *RefPaperDoc) (err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -693,21 +698,21 @@ func (dbx *apiImpl) DocsPermanentlyDelete(arg *RefPaperDoc) (err error) {
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
return
}
@ -743,7 +748,7 @@ type DocsSharingPolicyGetAPIError struct {
func (dbx *apiImpl) DocsSharingPolicyGet(arg *RefPaperDoc) (res *SharingPolicy, err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -760,21 +765,21 @@ func (dbx *apiImpl) DocsSharingPolicyGet(arg *RefPaperDoc) (res *SharingPolicy,
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -815,7 +820,7 @@ type DocsSharingPolicySetAPIError struct {
func (dbx *apiImpl) DocsSharingPolicySet(arg *PaperDocSharingPolicy) (err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -832,21 +837,21 @@ func (dbx *apiImpl) DocsSharingPolicySet(arg *PaperDocSharingPolicy) (err error)
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
return
}
@ -882,7 +887,7 @@ type DocsUpdateAPIError struct {
func (dbx *apiImpl) DocsUpdate(arg *PaperDocUpdateArgs, content io.Reader) (res *PaperDocCreateUpdateResult, err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -900,21 +905,21 @@ func (dbx *apiImpl) DocsUpdate(arg *PaperDocUpdateArgs, content io.Reader) (res
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -955,7 +960,7 @@ type DocsUsersAddAPIError struct {
func (dbx *apiImpl) DocsUsersAdd(arg *AddPaperDocUser) (res []*AddPaperDocUserMemberResult, err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -972,21 +977,21 @@ func (dbx *apiImpl) DocsUsersAdd(arg *AddPaperDocUser) (res []*AddPaperDocUserMe
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -1027,7 +1032,7 @@ type DocsUsersListAPIError struct {
func (dbx *apiImpl) DocsUsersList(arg *ListUsersOnPaperDocArgs) (res *ListUsersOnPaperDocResponse, err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -1044,21 +1049,21 @@ func (dbx *apiImpl) DocsUsersList(arg *ListUsersOnPaperDocArgs) (res *ListUsersO
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -1099,7 +1104,7 @@ type DocsUsersListContinueAPIError struct {
func (dbx *apiImpl) DocsUsersListContinue(arg *ListUsersOnPaperDocContinueArgs) (res *ListUsersOnPaperDocResponse, err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -1116,21 +1121,21 @@ func (dbx *apiImpl) DocsUsersListContinue(arg *ListUsersOnPaperDocContinueArgs)
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -1171,7 +1176,7 @@ type DocsUsersRemoveAPIError struct {
func (dbx *apiImpl) DocsUsersRemove(arg *RemovePaperDocUser) (err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -1188,21 +1193,21 @@ func (dbx *apiImpl) DocsUsersRemove(arg *RemovePaperDocUser) (err error) {
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
return
}

View File

@ -161,6 +161,8 @@ type DocLookupError struct {
// Valid tag values for DocLookupError
const (
DocLookupErrorInsufficientPermissions = "insufficient_permissions"
DocLookupErrorOther = "other"
DocLookupErrorDocNotFound = "doc_not_found"
)
@ -423,6 +425,8 @@ type ListUsersCursorError struct {
// Valid tag values for ListUsersCursorError
const (
ListUsersCursorErrorInsufficientPermissions = "insufficient_permissions"
ListUsersCursorErrorOther = "other"
ListUsersCursorErrorDocNotFound = "doc_not_found"
ListUsersCursorErrorCursorError = "cursor_error"
)
@ -619,6 +623,8 @@ type PaperDocCreateError struct {
// Valid tag values for PaperDocCreateError
const (
PaperDocCreateErrorInsufficientPermissions = "insufficient_permissions"
PaperDocCreateErrorOther = "other"
PaperDocCreateErrorContentMalformed = "content_malformed"
PaperDocCreateErrorFolderNotFound = "folder_not_found"
PaperDocCreateErrorDocLengthExceeded = "doc_length_exceeded"
@ -739,6 +745,9 @@ type PaperDocUpdateError struct {
// Valid tag values for PaperDocUpdateError
const (
PaperDocUpdateErrorInsufficientPermissions = "insufficient_permissions"
PaperDocUpdateErrorOther = "other"
PaperDocUpdateErrorDocNotFound = "doc_not_found"
PaperDocUpdateErrorContentMalformed = "content_malformed"
PaperDocUpdateErrorRevisionMismatch = "revision_mismatch"
PaperDocUpdateErrorDocLengthExceeded = "doc_length_exceeded"
@ -810,6 +819,9 @@ type SharingPublicPolicyType struct {
// Valid tag values for SharingPublicPolicyType
const (
SharingPublicPolicyTypePeopleWithLinkCanEdit = "people_with_link_can_edit"
SharingPublicPolicyTypePeopleWithLinkCanViewAndComment = "people_with_link_can_view_and_comment"
SharingPublicPolicyTypeInviteOnly = "invite_only"
SharingPublicPolicyTypeDisabled = "disabled"
)

View File

@ -35,8 +35,8 @@ const (
hostAPI = "api"
hostContent = "content"
hostNotify = "notify"
sdkVersion = "1.0.0-beta"
specVersion = "52ee619"
sdkVersion = "3.3.0"
specVersion = "318810d"
)
// Version returns the current SDK version and API Spec version
@ -48,8 +48,8 @@ func Version() (string, string) {
type Config struct {
// OAuth2 access token
Token string
// Enable verbose logging in SDK
Verbose bool
// Logging level for SDK generated logs
LogLevel LogLevel
// Logging target for verbose SDK logging
Logger *log.Logger
// Used with APIs that support operations as another user
@ -64,12 +64,28 @@ type Config struct {
URLGenerator func(hostType string, style string, namespace string, route string) string
}
// TryLog will, if Verbose is set, log to the config's logger
// or the default log (stderr) if Config.Logger is nil.
func (c *Config) TryLog(format string, v ...interface{}) {
if !c.Verbose {
// LogLevel defines a type that can set the desired level of logging the SDK will generate.
type LogLevel uint
const (
// LogOff will disable all SDK logging. This is the default log level
LogOff LogLevel = iota * (1 << 8)
// LogDebug will enable detailed SDK debug logs. It will log requests (including arguments),
// response and body contents.
LogDebug
// LogInfo will log SDK request (not including arguments) and responses.
LogInfo
)
func (l LogLevel) ShouldLog(v LogLevel) bool {
return l > v || l&v == v
}
func (c *Config) doLog(l LogLevel, format string, v ...interface{}) {
if !c.LogLevel.ShouldLog(l) {
return
}
if c.Logger != nil {
c.Logger.Printf(format, v...)
} else {
@ -77,6 +93,16 @@ func (c *Config) TryLog(format string, v ...interface{}) {
}
}
// LogDebug emits a debug level SDK log if config's log level is at least LogDebug
func (c *Config) LogDebug(format string, v ...interface{}) {
c.doLog(LogDebug, format, v...)
}
// LogInfo emits an info level SDK log if config's log level is at least LogInfo
func (c *Config) LogInfo(format string, v ...interface{}) {
c.doLog(LogInfo, format, v...)
}
// Context is the base client context used to implement per-namespace clients.
type Context struct {
Config Config

File diff suppressed because it is too large Load Diff

View File

@ -1342,6 +1342,10 @@ type GetSharedLinkFileError struct {
// Valid tag values for GetSharedLinkFileError
const (
GetSharedLinkFileErrorSharedLinkNotFound = "shared_link_not_found"
GetSharedLinkFileErrorSharedLinkAccessDenied = "shared_link_access_denied"
GetSharedLinkFileErrorUnsupportedLinkType = "unsupported_link_type"
GetSharedLinkFileErrorOther = "other"
GetSharedLinkFileErrorSharedLinkIsDirectory = "shared_link_is_directory"
)
@ -1660,6 +1664,7 @@ type JobStatus struct {
// Valid tag values for JobStatus
const (
JobStatusInProgress = "in_progress"
JobStatusComplete = "complete"
JobStatusFailed = "failed"
)
@ -2537,6 +2542,10 @@ type ModifySharedLinkSettingsError struct {
// Valid tag values for ModifySharedLinkSettingsError
const (
ModifySharedLinkSettingsErrorSharedLinkNotFound = "shared_link_not_found"
ModifySharedLinkSettingsErrorSharedLinkAccessDenied = "shared_link_access_denied"
ModifySharedLinkSettingsErrorUnsupportedLinkType = "unsupported_link_type"
ModifySharedLinkSettingsErrorOther = "other"
ModifySharedLinkSettingsErrorSettingsError = "settings_error"
ModifySharedLinkSettingsErrorEmailNotVerified = "email_not_verified"
)
@ -3014,6 +3023,7 @@ type RemoveMemberJobStatus struct {
// Valid tag values for RemoveMemberJobStatus
const (
RemoveMemberJobStatusInProgress = "in_progress"
RemoveMemberJobStatusComplete = "complete"
RemoveMemberJobStatusFailed = "failed"
)
@ -3077,6 +3087,9 @@ type ResolvedVisibility struct {
// Valid tag values for ResolvedVisibility
const (
ResolvedVisibilityPublic = "public"
ResolvedVisibilityTeamOnly = "team_only"
ResolvedVisibilityPassword = "password"
ResolvedVisibilityTeamAndPassword = "team_and_password"
ResolvedVisibilitySharedFolderOnly = "shared_folder_only"
ResolvedVisibilityOther = "other"
@ -3102,6 +3115,10 @@ type RevokeSharedLinkError struct {
// Valid tag values for RevokeSharedLinkError
const (
RevokeSharedLinkErrorSharedLinkNotFound = "shared_link_not_found"
RevokeSharedLinkErrorSharedLinkAccessDenied = "shared_link_access_denied"
RevokeSharedLinkErrorUnsupportedLinkType = "unsupported_link_type"
RevokeSharedLinkErrorOther = "other"
RevokeSharedLinkErrorSharedLinkMalformed = "shared_link_malformed"
)
@ -3197,13 +3214,44 @@ func (u *ShareFolderErrorBase) UnmarshalJSON(body []byte) error {
// ShareFolderError : has no documentation (yet)
type ShareFolderError struct {
dropbox.Tagged
// BadPath : `ShareFolderArg.path` is invalid.
BadPath *SharePathError `json:"bad_path,omitempty"`
}
// Valid tag values for ShareFolderError
const (
ShareFolderErrorEmailUnverified = "email_unverified"
ShareFolderErrorBadPath = "bad_path"
ShareFolderErrorTeamPolicyDisallowsMemberPolicy = "team_policy_disallows_member_policy"
ShareFolderErrorDisallowedSharedLinkPolicy = "disallowed_shared_link_policy"
ShareFolderErrorOther = "other"
ShareFolderErrorNoPermission = "no_permission"
)
// UnmarshalJSON deserializes into a ShareFolderError instance
func (u *ShareFolderError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// BadPath : `ShareFolderArg.path` is invalid.
BadPath json.RawMessage `json:"bad_path,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 "bad_path":
err = json.Unmarshal(w.BadPath, &u.BadPath)
if err != nil {
return err
}
}
return nil
}
// ShareFolderJobStatus : has no documentation (yet)
type ShareFolderJobStatus struct {
dropbox.Tagged
@ -3216,6 +3264,7 @@ type ShareFolderJobStatus struct {
// Valid tag values for ShareFolderJobStatus
const (
ShareFolderJobStatusInProgress = "in_progress"
ShareFolderJobStatusComplete = "complete"
ShareFolderJobStatusFailed = "failed"
)
@ -3256,12 +3305,17 @@ func (u *ShareFolderJobStatus) UnmarshalJSON(body []byte) error {
// ShareFolderLaunch : has no documentation (yet)
type ShareFolderLaunch 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 *SharedFolderMetadata `json:"complete,omitempty"`
}
// Valid tag values for ShareFolderLaunch
const (
ShareFolderLaunchAsyncJobId = "async_job_id"
ShareFolderLaunchComplete = "complete"
)
@ -3279,6 +3333,12 @@ func (u *ShareFolderLaunch) UnmarshalJSON(body []byte) error {
}
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)
@ -3368,7 +3428,7 @@ func NewSharedContentLinkMetadata(AudienceOptions []*LinkAudience, CurrentAudien
// part of the results for `listFileMembersBatch`.
type SharedFileMembers struct {
// Users : The list of user members of the shared file.
Users []*UserMembershipInfo `json:"users"`
Users []*UserFileMembershipInfo `json:"users"`
// Groups : The list of group members of the shared file.
Groups []*GroupMembershipInfo `json:"groups"`
// Invitees : The list of invited members of a file, but have not logged in
@ -3381,7 +3441,7 @@ type SharedFileMembers struct {
}
// NewSharedFileMembers returns a new SharedFileMembers instance
func NewSharedFileMembers(Users []*UserMembershipInfo, Groups []*GroupMembershipInfo, Invitees []*InviteeMembershipInfo) *SharedFileMembers {
func NewSharedFileMembers(Users []*UserFileMembershipInfo, Groups []*GroupMembershipInfo, Invitees []*InviteeMembershipInfo) *SharedFileMembers {
s := new(SharedFileMembers)
s.Users = Users
s.Groups = Groups
@ -4106,6 +4166,41 @@ func (u *UpdateFolderPolicyError) UnmarshalJSON(body []byte) error {
return nil
}
// UserMembershipInfo : The information about a user member of the shared
// content.
type UserMembershipInfo struct {
MembershipInfo
// User : The account information for the membership user.
User *UserInfo `json:"user"`
}
// NewUserMembershipInfo returns a new UserMembershipInfo instance
func NewUserMembershipInfo(AccessType *AccessLevel, User *UserInfo) *UserMembershipInfo {
s := new(UserMembershipInfo)
s.AccessType = AccessType
s.User = User
s.IsInherited = false
return s
}
// UserFileMembershipInfo : The information about a user member of the shared
// content with an appended last seen timestamp.
type UserFileMembershipInfo struct {
UserMembershipInfo
// TimeLastSeen : The UTC timestamp of when the user has last seen the
// content, if they have.
TimeLastSeen time.Time `json:"time_last_seen,omitempty"`
}
// NewUserFileMembershipInfo returns a new UserFileMembershipInfo instance
func NewUserFileMembershipInfo(AccessType *AccessLevel, User *UserInfo) *UserFileMembershipInfo {
s := new(UserFileMembershipInfo)
s.AccessType = AccessType
s.User = User
s.IsInherited = false
return s
}
// UserInfo : Basic information about a user. Use `usersAccount` and
// `usersAccountBatch` to obtain more detailed information.
type UserInfo struct {
@ -4126,23 +4221,6 @@ func NewUserInfo(AccountId string, SameTeam bool) *UserInfo {
return s
}
// UserMembershipInfo : The information about a user member of the shared
// content.
type UserMembershipInfo struct {
MembershipInfo
// User : The account information for the membership user.
User *UserInfo `json:"user"`
}
// NewUserMembershipInfo returns a new UserMembershipInfo instance
func NewUserMembershipInfo(AccessType *AccessLevel, User *UserInfo) *UserMembershipInfo {
s := new(UserMembershipInfo)
s.AccessType = AccessType
s.User = User
s.IsInherited = false
return s
}
// ViewerInfoPolicy : has no documentation (yet)
type ViewerInfoPolicy struct {
dropbox.Tagged

File diff suppressed because it is too large Load Diff

View File

@ -697,6 +697,8 @@ type GroupSelectorWithTeamGroupError struct {
// Valid tag values for GroupSelectorWithTeamGroupError
const (
GroupSelectorWithTeamGroupErrorGroupNotFound = "group_not_found"
GroupSelectorWithTeamGroupErrorOther = "other"
GroupSelectorWithTeamGroupErrorSystemManagedGroupDisallowed = "system_managed_group_disallowed"
)
@ -707,6 +709,9 @@ type GroupDeleteError struct {
// Valid tag values for GroupDeleteError
const (
GroupDeleteErrorGroupNotFound = "group_not_found"
GroupDeleteErrorOther = "other"
GroupDeleteErrorSystemManagedGroupDisallowed = "system_managed_group_disallowed"
GroupDeleteErrorGroupAlreadyDeleted = "group_already_deleted"
)
@ -771,6 +776,9 @@ type GroupMemberSelectorError struct {
// Valid tag values for GroupMemberSelectorError
const (
GroupMemberSelectorErrorGroupNotFound = "group_not_found"
GroupMemberSelectorErrorOther = "other"
GroupMemberSelectorErrorSystemManagedGroupDisallowed = "system_managed_group_disallowed"
GroupMemberSelectorErrorMemberNotInGroup = "member_not_in_group"
)
@ -781,6 +789,10 @@ type GroupMemberSetAccessTypeError struct {
// Valid tag values for GroupMemberSetAccessTypeError
const (
GroupMemberSetAccessTypeErrorGroupNotFound = "group_not_found"
GroupMemberSetAccessTypeErrorOther = "other"
GroupMemberSetAccessTypeErrorSystemManagedGroupDisallowed = "system_managed_group_disallowed"
GroupMemberSetAccessTypeErrorMemberNotInGroup = "member_not_in_group"
GroupMemberSetAccessTypeErrorUserCannotBeManagerOfCompanyManagedGroup = "user_cannot_be_manager_of_company_managed_group"
)
@ -834,6 +846,9 @@ type GroupMembersAddError struct {
// Valid tag values for GroupMembersAddError
const (
GroupMembersAddErrorGroupNotFound = "group_not_found"
GroupMembersAddErrorOther = "other"
GroupMembersAddErrorSystemManagedGroupDisallowed = "system_managed_group_disallowed"
GroupMembersAddErrorDuplicateUser = "duplicate_user"
GroupMembersAddErrorGroupNotInTeam = "group_not_in_team"
GroupMembersAddErrorMembersNotInTeam = "members_not_in_team"
@ -932,6 +947,9 @@ type GroupMembersSelectorError struct {
// Valid tag values for GroupMembersSelectorError
const (
GroupMembersSelectorErrorGroupNotFound = "group_not_found"
GroupMembersSelectorErrorOther = "other"
GroupMembersSelectorErrorSystemManagedGroupDisallowed = "system_managed_group_disallowed"
GroupMembersSelectorErrorMemberNotInGroup = "member_not_in_group"
)
@ -946,6 +964,10 @@ type GroupMembersRemoveError struct {
// Valid tag values for GroupMembersRemoveError
const (
GroupMembersRemoveErrorGroupNotFound = "group_not_found"
GroupMembersRemoveErrorOther = "other"
GroupMembersRemoveErrorSystemManagedGroupDisallowed = "system_managed_group_disallowed"
GroupMembersRemoveErrorMemberNotInGroup = "member_not_in_group"
GroupMembersRemoveErrorGroupNotInTeam = "group_not_in_team"
GroupMembersRemoveErrorMembersNotInTeam = "members_not_in_team"
GroupMembersRemoveErrorUsersNotFound = "users_not_found"
@ -1094,6 +1116,9 @@ type GroupUpdateError struct {
// Valid tag values for GroupUpdateError
const (
GroupUpdateErrorGroupNotFound = "group_not_found"
GroupUpdateErrorOther = "other"
GroupUpdateErrorSystemManagedGroupDisallowed = "system_managed_group_disallowed"
GroupUpdateErrorGroupNameAlreadyUsed = "group_name_already_used"
GroupUpdateErrorGroupNameInvalid = "group_name_invalid"
GroupUpdateErrorExternalIdAlreadyInUse = "external_id_already_in_use"
@ -1285,6 +1310,9 @@ type GroupsPollError struct {
// Valid tag values for GroupsPollError
const (
GroupsPollErrorInvalidAsyncJobId = "invalid_async_job_id"
GroupsPollErrorInternalError = "internal_error"
GroupsPollErrorOther = "other"
GroupsPollErrorAccessDenied = "access_denied"
)
@ -1950,6 +1978,7 @@ type MemberSelectorError struct {
// Valid tag values for MemberSelectorError
const (
MemberSelectorErrorUserNotFound = "user_not_found"
MemberSelectorErrorUserNotInTeam = "user_not_in_team"
)
@ -1983,6 +2012,7 @@ type MembersAddJobStatus struct {
// Valid tag values for MembersAddJobStatus
const (
MembersAddJobStatusInProgress = "in_progress"
MembersAddJobStatusComplete = "complete"
MembersAddJobStatusFailed = "failed"
)
@ -2022,12 +2052,17 @@ func (u *MembersAddJobStatus) UnmarshalJSON(body []byte) error {
// MembersAddLaunch : has no documentation (yet)
type MembersAddLaunch 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 []*MemberAddResult `json:"complete,omitempty"`
}
// Valid tag values for MembersAddLaunch
const (
MembersAddLaunchAsyncJobId = "async_job_id"
MembersAddLaunchComplete = "complete"
)
@ -2045,6 +2080,12 @@ func (u *MembersAddLaunch) UnmarshalJSON(body []byte) error {
}
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)
@ -2080,6 +2121,7 @@ type MembersDeactivateError struct {
// Valid tag values for MembersDeactivateError
const (
MembersDeactivateErrorUserNotFound = "user_not_found"
MembersDeactivateErrorUserNotInTeam = "user_not_in_team"
MembersDeactivateErrorOther = "other"
)
@ -2248,6 +2290,7 @@ type MembersRecoverError struct {
// Valid tag values for MembersRecoverError
const (
MembersRecoverErrorUserNotFound = "user_not_found"
MembersRecoverErrorUserUnrecoverable = "user_unrecoverable"
MembersRecoverErrorUserNotInTeam = "user_not_in_team"
MembersRecoverErrorTeamLicenseLimit = "team_license_limit"
@ -2287,6 +2330,9 @@ type MembersRemoveError struct {
// Valid tag values for MembersRemoveError
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"
@ -2308,6 +2354,8 @@ type MembersSendWelcomeError struct {
// Valid tag values for MembersSendWelcomeError
const (
MembersSendWelcomeErrorUserNotFound = "user_not_found"
MembersSendWelcomeErrorUserNotInTeam = "user_not_in_team"
MembersSendWelcomeErrorOther = "other"
)
@ -2335,6 +2383,7 @@ type MembersSetPermissionsError struct {
// Valid tag values for MembersSetPermissionsError
const (
MembersSetPermissionsErrorUserNotFound = "user_not_found"
MembersSetPermissionsErrorLastAdmin = "last_admin"
MembersSetPermissionsErrorUserNotInTeam = "user_not_in_team"
MembersSetPermissionsErrorCannotSetPermissions = "cannot_set_permissions"
@ -2391,6 +2440,8 @@ type MembersSetProfileError struct {
// Valid tag values for MembersSetProfileError
const (
MembersSetProfileErrorUserNotFound = "user_not_found"
MembersSetProfileErrorUserNotInTeam = "user_not_in_team"
MembersSetProfileErrorExternalIdAndNewExternalIdUnsafe = "external_id_and_new_external_id_unsafe"
MembersSetProfileErrorNoNewDataSpecified = "no_new_data_specified"
MembersSetProfileErrorEmailReservedForOtherUser = "email_reserved_for_other_user"
@ -2409,6 +2460,9 @@ type MembersSuspendError struct {
// Valid tag values for MembersSuspendError
const (
MembersSuspendErrorUserNotFound = "user_not_found"
MembersSuspendErrorUserNotInTeam = "user_not_in_team"
MembersSuspendErrorOther = "other"
MembersSuspendErrorSuspendInactiveUser = "suspend_inactive_user"
MembersSuspendErrorSuspendLastAdmin = "suspend_last_admin"
MembersSuspendErrorTeamLicenseLimit = "team_license_limit"
@ -2435,6 +2489,9 @@ type MembersUnsuspendError struct {
// Valid tag values for MembersUnsuspendError
const (
MembersUnsuspendErrorUserNotFound = "user_not_found"
MembersUnsuspendErrorUserNotInTeam = "user_not_in_team"
MembersUnsuspendErrorOther = "other"
MembersUnsuspendErrorUnsuspendNonSuspendedMember = "unsuspend_non_suspended_member"
MembersUnsuspendErrorTeamLicenseLimit = "team_license_limit"
)
@ -2845,10 +2902,61 @@ const (
// TeamFolderActivateError :
type TeamFolderActivateError struct {
dropbox.Tagged
// AccessError : has no documentation (yet)
AccessError *TeamFolderAccessError `json:"access_error,omitempty"`
// StatusError : has no documentation (yet)
StatusError *TeamFolderInvalidStatusError `json:"status_error,omitempty"`
// TeamSharedDropboxError : has no documentation (yet)
TeamSharedDropboxError *TeamFolderTeamSharedDropboxError `json:"team_shared_dropbox_error,omitempty"`
}
// Valid tag values for TeamFolderActivateError
const ()
const (
TeamFolderActivateErrorAccessError = "access_error"
TeamFolderActivateErrorStatusError = "status_error"
TeamFolderActivateErrorTeamSharedDropboxError = "team_shared_dropbox_error"
TeamFolderActivateErrorOther = "other"
)
// UnmarshalJSON deserializes into a TeamFolderActivateError instance
func (u *TeamFolderActivateError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// AccessError : has no documentation (yet)
AccessError json.RawMessage `json:"access_error,omitempty"`
// StatusError : has no documentation (yet)
StatusError json.RawMessage `json:"status_error,omitempty"`
// TeamSharedDropboxError : has no documentation (yet)
TeamSharedDropboxError json.RawMessage `json:"team_shared_dropbox_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 "access_error":
err = json.Unmarshal(w.AccessError, &u.AccessError)
if err != nil {
return err
}
case "status_error":
err = json.Unmarshal(w.StatusError, &u.StatusError)
if err != nil {
return err
}
case "team_shared_dropbox_error":
err = json.Unmarshal(w.TeamSharedDropboxError, &u.TeamSharedDropboxError)
if err != nil {
return err
}
}
return nil
}
// TeamFolderIdArg : has no documentation (yet)
type TeamFolderIdArg struct {
@ -2881,10 +2989,61 @@ func NewTeamFolderArchiveArg(TeamFolderId string) *TeamFolderArchiveArg {
// TeamFolderArchiveError :
type TeamFolderArchiveError struct {
dropbox.Tagged
// AccessError : has no documentation (yet)
AccessError *TeamFolderAccessError `json:"access_error,omitempty"`
// StatusError : has no documentation (yet)
StatusError *TeamFolderInvalidStatusError `json:"status_error,omitempty"`
// TeamSharedDropboxError : has no documentation (yet)
TeamSharedDropboxError *TeamFolderTeamSharedDropboxError `json:"team_shared_dropbox_error,omitempty"`
}
// Valid tag values for TeamFolderArchiveError
const ()
const (
TeamFolderArchiveErrorAccessError = "access_error"
TeamFolderArchiveErrorStatusError = "status_error"
TeamFolderArchiveErrorTeamSharedDropboxError = "team_shared_dropbox_error"
TeamFolderArchiveErrorOther = "other"
)
// UnmarshalJSON deserializes into a TeamFolderArchiveError instance
func (u *TeamFolderArchiveError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// AccessError : has no documentation (yet)
AccessError json.RawMessage `json:"access_error,omitempty"`
// StatusError : has no documentation (yet)
StatusError json.RawMessage `json:"status_error,omitempty"`
// TeamSharedDropboxError : has no documentation (yet)
TeamSharedDropboxError json.RawMessage `json:"team_shared_dropbox_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 "access_error":
err = json.Unmarshal(w.AccessError, &u.AccessError)
if err != nil {
return err
}
case "status_error":
err = json.Unmarshal(w.StatusError, &u.StatusError)
if err != nil {
return err
}
case "team_shared_dropbox_error":
err = json.Unmarshal(w.TeamSharedDropboxError, &u.TeamSharedDropboxError)
if err != nil {
return err
}
}
return nil
}
// TeamFolderArchiveJobStatus : has no documentation (yet)
type TeamFolderArchiveJobStatus struct {
@ -2899,6 +3058,7 @@ type TeamFolderArchiveJobStatus struct {
// Valid tag values for TeamFolderArchiveJobStatus
const (
TeamFolderArchiveJobStatusInProgress = "in_progress"
TeamFolderArchiveJobStatusComplete = "complete"
TeamFolderArchiveJobStatusFailed = "failed"
)
@ -2940,12 +3100,17 @@ func (u *TeamFolderArchiveJobStatus) UnmarshalJSON(body []byte) error {
// TeamFolderArchiveLaunch : has no documentation (yet)
type TeamFolderArchiveLaunch 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 *TeamFolderMetadata `json:"complete,omitempty"`
}
// Valid tag values for TeamFolderArchiveLaunch
const (
TeamFolderArchiveLaunchAsyncJobId = "async_job_id"
TeamFolderArchiveLaunchComplete = "complete"
)
@ -2963,6 +3128,12 @@ func (u *TeamFolderArchiveLaunch) UnmarshalJSON(body []byte) error {
}
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)
@ -3170,10 +3341,61 @@ func NewTeamFolderMetadata(TeamFolderId string, Name string, Status *TeamFolderS
// TeamFolderPermanentlyDeleteError :
type TeamFolderPermanentlyDeleteError struct {
dropbox.Tagged
// AccessError : has no documentation (yet)
AccessError *TeamFolderAccessError `json:"access_error,omitempty"`
// StatusError : has no documentation (yet)
StatusError *TeamFolderInvalidStatusError `json:"status_error,omitempty"`
// TeamSharedDropboxError : has no documentation (yet)
TeamSharedDropboxError *TeamFolderTeamSharedDropboxError `json:"team_shared_dropbox_error,omitempty"`
}
// Valid tag values for TeamFolderPermanentlyDeleteError
const ()
const (
TeamFolderPermanentlyDeleteErrorAccessError = "access_error"
TeamFolderPermanentlyDeleteErrorStatusError = "status_error"
TeamFolderPermanentlyDeleteErrorTeamSharedDropboxError = "team_shared_dropbox_error"
TeamFolderPermanentlyDeleteErrorOther = "other"
)
// UnmarshalJSON deserializes into a TeamFolderPermanentlyDeleteError instance
func (u *TeamFolderPermanentlyDeleteError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// AccessError : has no documentation (yet)
AccessError json.RawMessage `json:"access_error,omitempty"`
// StatusError : has no documentation (yet)
StatusError json.RawMessage `json:"status_error,omitempty"`
// TeamSharedDropboxError : has no documentation (yet)
TeamSharedDropboxError json.RawMessage `json:"team_shared_dropbox_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 "access_error":
err = json.Unmarshal(w.AccessError, &u.AccessError)
if err != nil {
return err
}
case "status_error":
err = json.Unmarshal(w.StatusError, &u.StatusError)
if err != nil {
return err
}
case "team_shared_dropbox_error":
err = json.Unmarshal(w.TeamSharedDropboxError, &u.TeamSharedDropboxError)
if err != nil {
return err
}
}
return nil
}
// TeamFolderRenameArg : has no documentation (yet)
type TeamFolderRenameArg struct {
@ -3193,15 +3415,65 @@ func NewTeamFolderRenameArg(TeamFolderId string, Name string) *TeamFolderRenameA
// TeamFolderRenameError : has no documentation (yet)
type TeamFolderRenameError struct {
dropbox.Tagged
// AccessError : has no documentation (yet)
AccessError *TeamFolderAccessError `json:"access_error,omitempty"`
// StatusError : has no documentation (yet)
StatusError *TeamFolderInvalidStatusError `json:"status_error,omitempty"`
// TeamSharedDropboxError : has no documentation (yet)
TeamSharedDropboxError *TeamFolderTeamSharedDropboxError `json:"team_shared_dropbox_error,omitempty"`
}
// Valid tag values for TeamFolderRenameError
const (
TeamFolderRenameErrorAccessError = "access_error"
TeamFolderRenameErrorStatusError = "status_error"
TeamFolderRenameErrorTeamSharedDropboxError = "team_shared_dropbox_error"
TeamFolderRenameErrorOther = "other"
TeamFolderRenameErrorInvalidFolderName = "invalid_folder_name"
TeamFolderRenameErrorFolderNameAlreadyUsed = "folder_name_already_used"
TeamFolderRenameErrorFolderNameReserved = "folder_name_reserved"
)
// UnmarshalJSON deserializes into a TeamFolderRenameError instance
func (u *TeamFolderRenameError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// AccessError : has no documentation (yet)
AccessError json.RawMessage `json:"access_error,omitempty"`
// StatusError : has no documentation (yet)
StatusError json.RawMessage `json:"status_error,omitempty"`
// TeamSharedDropboxError : has no documentation (yet)
TeamSharedDropboxError json.RawMessage `json:"team_shared_dropbox_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 "access_error":
err = json.Unmarshal(w.AccessError, &u.AccessError)
if err != nil {
return err
}
case "status_error":
err = json.Unmarshal(w.StatusError, &u.StatusError)
if err != nil {
return err
}
case "team_shared_dropbox_error":
err = json.Unmarshal(w.TeamSharedDropboxError, &u.TeamSharedDropboxError)
if err != nil {
return err
}
}
return nil
}
// TeamFolderStatus : has no documentation (yet)
type TeamFolderStatus struct {
dropbox.Tagged

View File

@ -49,7 +49,7 @@ type GetEventsAPIError struct {
func (dbx *apiImpl) GetEvents(arg *GetTeamEventsArg) (res *GetTeamEventsResult, err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -63,21 +63,21 @@ func (dbx *apiImpl) GetEvents(arg *GetTeamEventsArg) (res *GetTeamEventsResult,
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -118,7 +118,7 @@ type GetEventsContinueAPIError struct {
func (dbx *apiImpl) GetEventsContinue(arg *GetTeamEventsContinueArg) (res *GetTeamEventsResult, err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -132,21 +132,21 @@ func (dbx *apiImpl) GetEventsContinue(arg *GetTeamEventsContinueArg) (res *GetTe
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {

View File

@ -1213,9 +1213,6 @@ func NewDomainVerificationAddDomainSuccessDetails(DomainNames []string) *DomainV
type DomainVerificationRemoveDomainDetails struct {
// DomainNames : Domain names.
DomainNames []string `json:"domain_names"`
// VerificationMethod : Domain name verification method. Might be missing
// due to historical data gap.
VerificationMethod string `json:"verification_method,omitempty"`
}
// NewDomainVerificationRemoveDomainDetails returns a new DomainVerificationRemoveDomainDetails instance
@ -1856,6 +1853,8 @@ type EventDetails struct {
// ShmodelVisibilityTeamOnlyDetails : Made a file/folder visible only to
// team members with the link.
ShmodelVisibilityTeamOnlyDetails *ShmodelVisibilityTeamOnlyDetails `json:"shmodel_visibility_team_only_details,omitempty"`
// SsoAddCertDetails : Added the X.509 certificate for SSO.
SsoAddCertDetails *SsoAddCertDetails `json:"sso_add_cert_details,omitempty"`
// SsoAddLoginUrlDetails : Added sign-in URL for SSO.
SsoAddLoginUrlDetails *SsoAddLoginUrlDetails `json:"sso_add_login_url_details,omitempty"`
// SsoAddLogoutUrlDetails : Added sign-out URL for SSO.
@ -1869,6 +1868,8 @@ type EventDetails struct {
// SsoChangeSamlIdentityModeDetails : Changed the SAML identity mode for
// SSO.
SsoChangeSamlIdentityModeDetails *SsoChangeSamlIdentityModeDetails `json:"sso_change_saml_identity_mode_details,omitempty"`
// SsoRemoveCertDetails : Removed the X.509 certificate for SSO.
SsoRemoveCertDetails *SsoRemoveCertDetails `json:"sso_remove_cert_details,omitempty"`
// SsoRemoveLoginUrlDetails : Removed the sign-in URL for SSO.
SsoRemoveLoginUrlDetails *SsoRemoveLoginUrlDetails `json:"sso_remove_login_url_details,omitempty"`
// SsoRemoveLogoutUrlDetails : Removed single sign-on logout URL.
@ -1968,6 +1969,9 @@ type EventDetails struct {
// PaperChangeDeploymentPolicyDetails : Changed whether Dropbox Paper, when
// enabled, is deployed to all teams or to specific members of the team.
PaperChangeDeploymentPolicyDetails *PaperChangeDeploymentPolicyDetails `json:"paper_change_deployment_policy_details,omitempty"`
// PaperChangeMemberLinkPolicyDetails : Changed whether non team members can
// view Paper documents using a link.
PaperChangeMemberLinkPolicyDetails *PaperChangeMemberLinkPolicyDetails `json:"paper_change_member_link_policy_details,omitempty"`
// PaperChangeMemberPolicyDetails : Changed whether team members can share
// Paper documents externally (i.e. outside the team), and if so, whether
// they should be accessible only by team members or anyone by default.
@ -2013,6 +2017,9 @@ type EventDetails struct {
// TeamProfileAddLogoDetails : Added a team logo to be displayed on shared
// link headers.
TeamProfileAddLogoDetails *TeamProfileAddLogoDetails `json:"team_profile_add_logo_details,omitempty"`
// TeamProfileChangeDefaultLanguageDetails : Changed the default language
// for the team.
TeamProfileChangeDefaultLanguageDetails *TeamProfileChangeDefaultLanguageDetails `json:"team_profile_change_default_language_details,omitempty"`
// TeamProfileChangeLogoDetails : Changed the team logo to be displayed on
// shared link headers.
TeamProfileChangeLogoDetails *TeamProfileChangeLogoDetails `json:"team_profile_change_logo_details,omitempty"`
@ -2249,12 +2256,14 @@ const (
EventDetailsShmodelVisibilityPasswordDetails = "shmodel_visibility_password_details"
EventDetailsShmodelVisibilityPublicDetails = "shmodel_visibility_public_details"
EventDetailsShmodelVisibilityTeamOnlyDetails = "shmodel_visibility_team_only_details"
EventDetailsSsoAddCertDetails = "sso_add_cert_details"
EventDetailsSsoAddLoginUrlDetails = "sso_add_login_url_details"
EventDetailsSsoAddLogoutUrlDetails = "sso_add_logout_url_details"
EventDetailsSsoChangeCertDetails = "sso_change_cert_details"
EventDetailsSsoChangeLoginUrlDetails = "sso_change_login_url_details"
EventDetailsSsoChangeLogoutUrlDetails = "sso_change_logout_url_details"
EventDetailsSsoChangeSamlIdentityModeDetails = "sso_change_saml_identity_mode_details"
EventDetailsSsoRemoveCertDetails = "sso_remove_cert_details"
EventDetailsSsoRemoveLoginUrlDetails = "sso_remove_login_url_details"
EventDetailsSsoRemoveLogoutUrlDetails = "sso_remove_logout_url_details"
EventDetailsTeamFolderChangeStatusDetails = "team_folder_change_status_details"
@ -2289,6 +2298,7 @@ const (
EventDetailsMicrosoftOfficeAddinChangePolicyDetails = "microsoft_office_addin_change_policy_details"
EventDetailsNetworkControlChangePolicyDetails = "network_control_change_policy_details"
EventDetailsPaperChangeDeploymentPolicyDetails = "paper_change_deployment_policy_details"
EventDetailsPaperChangeMemberLinkPolicyDetails = "paper_change_member_link_policy_details"
EventDetailsPaperChangeMemberPolicyDetails = "paper_change_member_policy_details"
EventDetailsPaperChangePolicyDetails = "paper_change_policy_details"
EventDetailsPermanentDeleteChangePolicyDetails = "permanent_delete_change_policy_details"
@ -2304,6 +2314,7 @@ const (
EventDetailsWebSessionsChangeFixedLengthPolicyDetails = "web_sessions_change_fixed_length_policy_details"
EventDetailsWebSessionsChangeIdleLengthPolicyDetails = "web_sessions_change_idle_length_policy_details"
EventDetailsTeamProfileAddLogoDetails = "team_profile_add_logo_details"
EventDetailsTeamProfileChangeDefaultLanguageDetails = "team_profile_change_default_language_details"
EventDetailsTeamProfileChangeLogoDetails = "team_profile_change_logo_details"
EventDetailsTeamProfileChangeNameDetails = "team_profile_change_name_details"
EventDetailsTeamProfileRemoveLogoDetails = "team_profile_remove_logo_details"
@ -2813,6 +2824,8 @@ func (u *EventDetails) UnmarshalJSON(body []byte) error {
// ShmodelVisibilityTeamOnlyDetails : Made a file/folder visible only to
// team members with the link.
ShmodelVisibilityTeamOnlyDetails json.RawMessage `json:"shmodel_visibility_team_only_details,omitempty"`
// SsoAddCertDetails : Added the X.509 certificate for SSO.
SsoAddCertDetails json.RawMessage `json:"sso_add_cert_details,omitempty"`
// SsoAddLoginUrlDetails : Added sign-in URL for SSO.
SsoAddLoginUrlDetails json.RawMessage `json:"sso_add_login_url_details,omitempty"`
// SsoAddLogoutUrlDetails : Added sign-out URL for SSO.
@ -2826,6 +2839,8 @@ func (u *EventDetails) UnmarshalJSON(body []byte) error {
// SsoChangeSamlIdentityModeDetails : Changed the SAML identity mode for
// SSO.
SsoChangeSamlIdentityModeDetails json.RawMessage `json:"sso_change_saml_identity_mode_details,omitempty"`
// SsoRemoveCertDetails : Removed the X.509 certificate for SSO.
SsoRemoveCertDetails json.RawMessage `json:"sso_remove_cert_details,omitempty"`
// SsoRemoveLoginUrlDetails : Removed the sign-in URL for SSO.
SsoRemoveLoginUrlDetails json.RawMessage `json:"sso_remove_login_url_details,omitempty"`
// SsoRemoveLogoutUrlDetails : Removed single sign-on logout URL.
@ -2932,6 +2947,9 @@ func (u *EventDetails) UnmarshalJSON(body []byte) error {
// when enabled, is deployed to all teams or to specific members of the
// team.
PaperChangeDeploymentPolicyDetails json.RawMessage `json:"paper_change_deployment_policy_details,omitempty"`
// PaperChangeMemberLinkPolicyDetails : Changed whether non team members
// can view Paper documents using a link.
PaperChangeMemberLinkPolicyDetails json.RawMessage `json:"paper_change_member_link_policy_details,omitempty"`
// PaperChangeMemberPolicyDetails : Changed whether team members can
// share Paper documents externally (i.e. outside the team), and if so,
// whether they should be accessible only by team members or anyone by
@ -2979,6 +2997,9 @@ func (u *EventDetails) UnmarshalJSON(body []byte) error {
// TeamProfileAddLogoDetails : Added a team logo to be displayed on
// shared link headers.
TeamProfileAddLogoDetails json.RawMessage `json:"team_profile_add_logo_details,omitempty"`
// TeamProfileChangeDefaultLanguageDetails : Changed the default
// language for the team.
TeamProfileChangeDefaultLanguageDetails json.RawMessage `json:"team_profile_change_default_language_details,omitempty"`
// TeamProfileChangeLogoDetails : Changed the team logo to be displayed
// on shared link headers.
TeamProfileChangeLogoDetails json.RawMessage `json:"team_profile_change_logo_details,omitempty"`
@ -4221,6 +4242,12 @@ func (u *EventDetails) UnmarshalJSON(body []byte) error {
case "shmodel_visibility_team_only_details":
err = json.Unmarshal(body, &u.ShmodelVisibilityTeamOnlyDetails)
if err != nil {
return err
}
case "sso_add_cert_details":
err = json.Unmarshal(body, &u.SsoAddCertDetails)
if err != nil {
return err
}
@ -4257,6 +4284,12 @@ func (u *EventDetails) UnmarshalJSON(body []byte) error {
case "sso_change_saml_identity_mode_details":
err = json.Unmarshal(body, &u.SsoChangeSamlIdentityModeDetails)
if err != nil {
return err
}
case "sso_remove_cert_details":
err = json.Unmarshal(body, &u.SsoRemoveCertDetails)
if err != nil {
return err
}
@ -4461,6 +4494,12 @@ func (u *EventDetails) UnmarshalJSON(body []byte) error {
case "paper_change_deployment_policy_details":
err = json.Unmarshal(body, &u.PaperChangeDeploymentPolicyDetails)
if err != nil {
return err
}
case "paper_change_member_link_policy_details":
err = json.Unmarshal(body, &u.PaperChangeMemberLinkPolicyDetails)
if err != nil {
return err
}
@ -4551,6 +4590,12 @@ func (u *EventDetails) UnmarshalJSON(body []byte) error {
case "team_profile_add_logo_details":
err = json.Unmarshal(body, &u.TeamProfileAddLogoDetails)
if err != nil {
return err
}
case "team_profile_change_default_language_details":
err = json.Unmarshal(body, &u.TeamProfileChangeDefaultLanguageDetails)
if err != nil {
return err
}
@ -4832,12 +4877,14 @@ const (
EventTypeShmodelVisibilityPassword = "shmodel_visibility_password"
EventTypeShmodelVisibilityPublic = "shmodel_visibility_public"
EventTypeShmodelVisibilityTeamOnly = "shmodel_visibility_team_only"
EventTypeSsoAddCert = "sso_add_cert"
EventTypeSsoAddLoginUrl = "sso_add_login_url"
EventTypeSsoAddLogoutUrl = "sso_add_logout_url"
EventTypeSsoChangeCert = "sso_change_cert"
EventTypeSsoChangeLoginUrl = "sso_change_login_url"
EventTypeSsoChangeLogoutUrl = "sso_change_logout_url"
EventTypeSsoChangeSamlIdentityMode = "sso_change_saml_identity_mode"
EventTypeSsoRemoveCert = "sso_remove_cert"
EventTypeSsoRemoveLoginUrl = "sso_remove_login_url"
EventTypeSsoRemoveLogoutUrl = "sso_remove_logout_url"
EventTypeTeamFolderChangeStatus = "team_folder_change_status"
@ -4872,6 +4919,7 @@ const (
EventTypeMicrosoftOfficeAddinChangePolicy = "microsoft_office_addin_change_policy"
EventTypeNetworkControlChangePolicy = "network_control_change_policy"
EventTypePaperChangeDeploymentPolicy = "paper_change_deployment_policy"
EventTypePaperChangeMemberLinkPolicy = "paper_change_member_link_policy"
EventTypePaperChangeMemberPolicy = "paper_change_member_policy"
EventTypePaperChangePolicy = "paper_change_policy"
EventTypePermanentDeleteChangePolicy = "permanent_delete_change_policy"
@ -4887,6 +4935,7 @@ const (
EventTypeWebSessionsChangeFixedLengthPolicy = "web_sessions_change_fixed_length_policy"
EventTypeWebSessionsChangeIdleLengthPolicy = "web_sessions_change_idle_length_policy"
EventTypeTeamProfileAddLogo = "team_profile_add_logo"
EventTypeTeamProfileChangeDefaultLanguage = "team_profile_change_default_language"
EventTypeTeamProfileChangeLogo = "team_profile_change_logo"
EventTypeTeamProfileChangeName = "team_profile_change_name"
EventTypeTeamProfileRemoveLogo = "team_profile_remove_logo"
@ -5639,9 +5688,9 @@ func NewGroupChangeMemberRoleDetails(IsGroupOwner bool) *GroupChangeMemberRoleDe
// GroupCreateDetails : Created a group.
type GroupCreateDetails struct {
// IsAdminManaged : Is admin managed group. Might be missing due to
// IsCompanyManaged : Is company managed group. Might be missing due to
// historical data gap.
IsAdminManaged bool `json:"is_admin_managed,omitempty"`
IsCompanyManaged bool `json:"is_company_managed,omitempty"`
// JoinPolicy : Group join policy.
JoinPolicy *GroupJoinPolicy `json:"join_policy"`
}
@ -5655,9 +5704,9 @@ func NewGroupCreateDetails(JoinPolicy *GroupJoinPolicy) *GroupCreateDetails {
// GroupDeleteDetails : Deleted a group.
type GroupDeleteDetails struct {
// IsAdminManaged : Is admin managed group. Might be missing due to
// IsCompanyManaged : Is company managed group. Might be missing due to
// historical data gap.
IsAdminManaged bool `json:"is_admin_managed,omitempty"`
IsCompanyManaged bool `json:"is_company_managed,omitempty"`
}
// NewGroupDeleteDetails returns a new GroupDeleteDetails instance
@ -6412,6 +6461,20 @@ func NewPaperChangeDeploymentPolicyDetails(NewValue *team_policies.PaperDeployme
return s
}
// PaperChangeMemberLinkPolicyDetails : Changed whether non team members can
// view Paper documents using a link.
type PaperChangeMemberLinkPolicyDetails struct {
// NewValue : New paper external link accessibility policy.
NewValue *PaperMemberPolicy `json:"new_value"`
}
// NewPaperChangeMemberLinkPolicyDetails returns a new PaperChangeMemberLinkPolicyDetails instance
func NewPaperChangeMemberLinkPolicyDetails(NewValue *PaperMemberPolicy) *PaperChangeMemberLinkPolicyDetails {
s := new(PaperChangeMemberLinkPolicyDetails)
s.NewValue = NewValue
return s
}
// PaperChangeMemberPolicyDetails : Changed whether team members can share Paper
// documents externally (i.e. outside the team), and if so, whether they should
// be accessible only by team members or anyone by default.
@ -8543,6 +8606,19 @@ const (
SpaceLimitsStatusOther = "other"
)
// SsoAddCertDetails : Added the X.509 certificate for SSO.
type SsoAddCertDetails struct {
// CertificateDetails : SSO certificate details.
CertificateDetails *Certificate `json:"certificate_details"`
}
// NewSsoAddCertDetails returns a new SsoAddCertDetails instance
func NewSsoAddCertDetails(CertificateDetails *Certificate) *SsoAddCertDetails {
s := new(SsoAddCertDetails)
s.CertificateDetails = CertificateDetails
return s
}
// SsoAddLoginUrlDetails : Added sign-in URL for SSO.
type SsoAddLoginUrlDetails struct {
// NewValue : New single sign-on login URL.
@ -8571,14 +8647,16 @@ func NewSsoAddLogoutUrlDetails() *SsoAddLogoutUrlDetails {
// SsoChangeCertDetails : Changed the X.509 certificate for SSO.
type SsoChangeCertDetails struct {
// CertificateDetails : SSO certificate details.
CertificateDetails *Certificate `json:"certificate_details"`
// PreviousCertificateDetails : Previous SSO certificate details.
PreviousCertificateDetails *Certificate `json:"previous_certificate_details,omitempty"`
// NewCertificateDetails : New SSO certificate details.
NewCertificateDetails *Certificate `json:"new_certificate_details"`
}
// NewSsoChangeCertDetails returns a new SsoChangeCertDetails instance
func NewSsoChangeCertDetails(CertificateDetails *Certificate) *SsoChangeCertDetails {
func NewSsoChangeCertDetails(NewCertificateDetails *Certificate) *SsoChangeCertDetails {
s := new(SsoChangeCertDetails)
s.CertificateDetails = CertificateDetails
s.NewCertificateDetails = NewCertificateDetails
return s
}
@ -8659,6 +8737,16 @@ func NewSsoLoginFailDetails(ErrorDetails *FailureDetailsLogInfo) *SsoLoginFailDe
return s
}
// SsoRemoveCertDetails : Removed the X.509 certificate for SSO.
type SsoRemoveCertDetails struct {
}
// NewSsoRemoveCertDetails returns a new SsoRemoveCertDetails instance
func NewSsoRemoveCertDetails() *SsoRemoveCertDetails {
s := new(SsoRemoveCertDetails)
return s
}
// SsoRemoveLoginUrlDetails : Removed the sign-in URL for SSO.
type SsoRemoveLoginUrlDetails struct {
// PreviousValue : Previous single sign-on login URL.
@ -8917,6 +9005,23 @@ func NewTeamProfileAddLogoDetails() *TeamProfileAddLogoDetails {
return s
}
// TeamProfileChangeDefaultLanguageDetails : Changed the default language for
// the team.
type TeamProfileChangeDefaultLanguageDetails struct {
// NewValue : New team's default language.
NewValue string `json:"new_value"`
// PreviousValue : Previous team's default language.
PreviousValue string `json:"previous_value"`
}
// NewTeamProfileChangeDefaultLanguageDetails returns a new TeamProfileChangeDefaultLanguageDetails instance
func NewTeamProfileChangeDefaultLanguageDetails(NewValue string, PreviousValue string) *TeamProfileChangeDefaultLanguageDetails {
s := new(TeamProfileChangeDefaultLanguageDetails)
s.NewValue = NewValue
s.PreviousValue = PreviousValue
return s
}
// TeamProfileChangeLogoDetails : Changed the team logo to be displayed on
// shared link headers.
type TeamProfileChangeLogoDetails struct {
@ -8989,14 +9094,14 @@ func NewTfaChangeBackupPhoneDetails() *TfaChangeBackupPhoneDetails {
// TfaChangePolicyDetails : Change two-step verification policy for the team.
type TfaChangePolicyDetails struct {
// NewValue : New change policy.
NewValue *TfaPolicy `json:"new_value"`
NewValue *team_policies.TwoStepVerificationPolicy `json:"new_value"`
// PreviousValue : Previous change policy. Might be missing due to
// historical data gap.
PreviousValue *TfaPolicy `json:"previous_value,omitempty"`
PreviousValue *team_policies.TwoStepVerificationPolicy `json:"previous_value,omitempty"`
}
// NewTfaChangePolicyDetails returns a new TfaChangePolicyDetails instance
func NewTfaChangePolicyDetails(NewValue *TfaPolicy) *TfaChangePolicyDetails {
func NewTfaChangePolicyDetails(NewValue *team_policies.TwoStepVerificationPolicy) *TfaChangePolicyDetails {
s := new(TfaChangePolicyDetails)
s.NewValue = NewValue
return s
@ -9037,18 +9142,6 @@ const (
TfaConfigurationOther = "other"
)
// TfaPolicy : Two factor authentication policy
type TfaPolicy struct {
dropbox.Tagged
}
// Valid tag values for TfaPolicy
const (
TfaPolicyAllowDisable = "allow_disable"
TfaPolicyStickyEnable = "sticky_enable"
TfaPolicyOther = "other"
)
// TfaRemoveBackupPhoneDetails : Removed the backup phone for two-step
// verification.
type TfaRemoveBackupPhoneDetails struct {

View File

@ -195,3 +195,15 @@ func NewTeamSharingPolicies(SharedFolderMemberPolicy *SharedFolderMemberPolicy,
s.SharedLinkCreatePolicy = SharedLinkCreatePolicy
return s
}
// TwoStepVerificationPolicy : has no documentation (yet)
type TwoStepVerificationPolicy struct {
dropbox.Tagged
}
// Valid tag values for TwoStepVerificationPolicy
const (
TwoStepVerificationPolicyRequireTfaEnable = "require_tfa_enable"
TwoStepVerificationPolicyRequireTfaDisable = "require_tfa_disable"
TwoStepVerificationPolicyOther = "other"
)

View File

@ -54,7 +54,7 @@ type GetAccountAPIError struct {
func (dbx *apiImpl) GetAccount(arg *GetAccountArg) (res *BasicAccount, err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -71,21 +71,21 @@ func (dbx *apiImpl) GetAccount(arg *GetAccountArg) (res *BasicAccount, err error
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -126,7 +126,7 @@ type GetAccountBatchAPIError struct {
func (dbx *apiImpl) GetAccountBatch(arg *GetAccountBatchArg) (res []*BasicAccount, err error) {
cli := dbx.Client
dbx.Config.TryLog("arg: %v", arg)
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
@ -143,21 +143,21 @@ func (dbx *apiImpl) GetAccountBatch(arg *GetAccountBatchArg) (res []*BasicAccoun
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -207,21 +207,21 @@ func (dbx *apiImpl) GetCurrentAccount() (res *FullAccount, err error) {
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@ -271,21 +271,21 @@ func (dbx *apiImpl) GetSpaceUsage() (res *SpaceUsage, err error) {
if err != nil {
return
}
dbx.Config.TryLog("req: %v", req)
dbx.Config.LogInfo("req: %v", req)
resp, err := cli.Do(req)
if err != nil {
return
}
dbx.Config.TryLog("resp: %v", resp)
dbx.Config.LogInfo("resp: %v", resp)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return
}
dbx.Config.TryLog("body: %v", body)
dbx.Config.LogDebug("body: %v", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {

View File

@ -15,7 +15,7 @@ stone -v -a :all go_types.stoneg.py "$gen_dir" "$spec_dir"/*.stone
stone -v -a :all go_client.stoneg.py "$gen_dir" "$spec_dir"/*.stone
# Update SDK and API spec versions
sdk_version=${1:-"1.0.0-beta"}
sdk_version=${1:-"3.0.0"}
pushd ${spec_dir}
spec_version=$(git rev-parse --short HEAD)
popd

View File

@ -107,7 +107,7 @@ class GoClientBackend(CodeBackend):
body = 'nil'
if not is_void_type(route.arg_data_type):
out('dbx.Config.TryLog("arg: %v", arg)')
out('dbx.Config.LogDebug("arg: %v", arg)')
out('b, err := json.Marshal(arg)')
with self.block('if err != nil'):
@ -144,7 +144,7 @@ class GoClientBackend(CodeBackend):
with self.block('if err != nil'):
out('return')
out('dbx.Config.TryLog("req: %v", req)')
out('dbx.Config.LogInfo("req: %v", req)')
out()
@ -157,7 +157,7 @@ class GoClientBackend(CodeBackend):
out('return')
out()
out('dbx.Config.TryLog("resp: %v", resp)')
out('dbx.Config.LogInfo("resp: %v", resp)')
def _generate_response(self, route):
out = self.emit
@ -172,11 +172,19 @@ class GoClientBackend(CodeBackend):
out('return')
out()
out('dbx.Config.TryLog("body: %v", body)')
out('dbx.Config.LogDebug("body: %v", body)')
def _generate_error_handling(self, route):
out = self.emit
style = route.attrs.get('style', 'rpc')
with self.block('if resp.StatusCode == http.StatusConflict'):
# If style was download, body was assigned to a header.
# Need to re-read the response body to parse the error
if style == 'download':
out('defer resp.Body.Close()')
with self.block('body, err = ioutil.ReadAll(resp.Body);'
'if err != nil'):
out('return')
out('var apiError %sAPIError' % fmt_var(route.name))
with self.block('err = json.Unmarshal(body, &apiError);'
'if err != nil'):

View File

@ -48,8 +48,8 @@ func Version() (string, string) {
type Config struct {
// OAuth2 access token
Token string
// Enable verbose logging in SDK
Verbose bool
// Logging level for SDK generated logs
LogLevel LogLevel
// Logging target for verbose SDK logging
Logger *log.Logger
// Used with APIs that support operations as another user
@ -64,12 +64,28 @@ type Config struct {
URLGenerator func(hostType string, style string, namespace string, route string) string
}
// TryLog will, if Verbose is set, log to the config's logger
// or the default log (stderr) if Config.Logger is nil.
func (c *Config) TryLog(format string, v ...interface{}) {
if !c.Verbose {
// LogLevel defines a type that can set the desired level of logging the SDK will generate.
type LogLevel uint
const (
// LogOff will disable all SDK logging. This is the default log level
LogOff LogLevel = iota * (1 << 8)
// LogDebug will enable detailed SDK debug logs. It will log requests (including arguments),
// response and body contents.
LogDebug
// LogInfo will log SDK request (not including arguments) and responses.
LogInfo
)
func (l LogLevel) ShouldLog(v LogLevel) bool {
return l > v || l & v == v
}
func (c *Config) doLog(l LogLevel, format string, v ...interface{}) {
if !c.LogLevel.ShouldLog(l) {
return
}
if c.Logger != nil {
c.Logger.Printf(format, v...)
} else {
@ -77,6 +93,16 @@ func (c *Config) TryLog(format string, v ...interface{}) {
}
}
// LogDebug emits a debug level SDK log if config's log level is at least LogDebug
func (c *Config) LogDebug(format string, v ...interface{}) {
c.doLog(LogDebug, format, v...)
}
// LogInfo emits an info level SDK log if config's log level is at least LogInfo
func (c *Config) LogInfo(format string, v ...interface{}) {
c.doLog(LogInfo, format, v...)
}
// Context is the base client context used to implement per-namespace clients.
type Context struct {
Config Config

View File

@ -137,7 +137,9 @@ class GoTypesBackend(CodeBackend):
def _generate_union_helper(self, u):
name = u.name
namespace = u.namespace
fields = u.fields
# Unions can be inherited, but don't need to be polymorphic.
# So let's flatten out all the inherited fields.
fields = u.all_fields
if is_struct_type(u) and u.has_enumerated_subtypes():
name = fmt_var(name, export=False) + 'Union'
fields = u.get_enumerated_subtypes()