From 5b79922b5e8c0a0174e23214d413ed22ed9cebdd Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 8 Aug 2017 10:26:01 +0100 Subject: [PATCH] vendor: add dropbox/dropbox-sdk-go-unofficial --- Gopkg.lock | 6 +- Gopkg.toml | 2 +- .../dropbox-sdk-go-unofficial/.gitignore | 9 + .../dropbox-sdk-go-unofficial/.gitmodules | 3 + .../dropbox-sdk-go-unofficial/.travis.yml | 15 + .../dropbox/dropbox-sdk-go-unofficial/LICENSE | 20 + .../dropbox-sdk-go-unofficial/README.md | 95 + .../dropbox/async/types.go | 132 + .../dropbox/auth/client.go | 178 + .../dropbox/auth/types.go | 187 + .../dropbox/common/types.go | 132 + .../dropbox/files/client.go | 3602 +++++++ .../dropbox/files/metadata.go | 99 + .../dropbox/files/types.go | 3053 ++++++ .../dropbox/paper/client.go | 1086 ++ .../dropbox/paper/types.go | 729 ++ .../dropbox/properties/types.go | 213 + .../dropbox-sdk-go-unofficial/dropbox/sdk.go | 186 + .../dropbox/sharing/client.go | 3267 ++++++ .../dropbox/sharing/metadata.go | 49 + .../dropbox/sharing/types.go | 4172 ++++++++ .../dropbox/team/client.go | 4140 ++++++++ .../dropbox/team/types.go | 3508 +++++++ .../dropbox/team_common/types.go | 91 + .../dropbox/team_log/client.go | 185 + .../dropbox/team_log/types.go | 9154 +++++++++++++++++ .../dropbox/team_policies/types.go | 134 + .../dropbox/users/client.go | 324 + .../dropbox/users/types.go | 360 + .../dropbox/users_common/types.go | 37 + .../generator/README.md | 237 + .../generator/generate-sdk.sh | 26 + .../generator/go_client.stoneg.py | 214 + .../generator/go_helpers.py | 142 + .../generator/go_rsrc/files/metadata.go | 99 + .../generator/go_rsrc/sdk.go | 186 + .../generator/go_rsrc/sharing/metadata.go | 49 + .../generator/go_types.stoneg.py | 198 + 38 files changed, 36315 insertions(+), 4 deletions(-) create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/.gitignore create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/.gitmodules create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/.travis.yml create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/LICENSE create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/README.md create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/async/types.go create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/client.go create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/types.go create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/common/types.go create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/client.go create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/metadata.go create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/types.go create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/paper/client.go create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/paper/types.go create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/properties/types.go create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sdk.go create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/client.go create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/metadata.go create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/types.go create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team/client.go create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team/types.go create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_common/types.go create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_log/client.go create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_log/types.go create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_policies/types.go create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users/client.go create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users/types.go create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users_common/types.go create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/README.md create mode 100755 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/generate-sdk.sh create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/go_client.stoneg.py create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/go_helpers.py create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/go_rsrc/files/metadata.go create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/go_rsrc/sdk.go create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/go_rsrc/sharing/metadata.go create mode 100644 vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/go_types.stoneg.py diff --git a/Gopkg.lock b/Gopkg.lock index b56198c65..841a0e1fc 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -74,10 +74,10 @@ version = "v3.0.0" [[projects]] + branch = "master" name = "github.com/dropbox/dropbox-sdk-go-unofficial" packages = ["dropbox","dropbox/async","dropbox/files","dropbox/properties"] - revision = "87c5a55c1cbe542a328e304b8717218b6a2ef21e" - version = "v2.0.0" + revision = "350942579f314463a49b660b7a35f01dbf392a7f" [[projects]] name = "github.com/go-ini/ini" @@ -292,6 +292,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "06ce607d1f66fd98f5b2375759b612bf1df211f9d431ddcc54724e4f97a4bd4e" + inputs-digest = "e660aa956f1e580bda1ce240cdb673bcbc00bb8f2ef2e77e85d3d941528836f1" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 60ba46208..8f5727ace 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -131,7 +131,7 @@ [[constraint]] branch = "master" - name = "github.com/ncw/dropbox-sdk-go-unofficial" + name = "github.com/dropbox/dropbox-sdk-go-unofficial" [[constraint]] branch = "master" diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/.gitignore b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/.gitignore new file mode 100644 index 000000000..f8d3abe4d --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/.gitignore @@ -0,0 +1,9 @@ +# swap +[._]*.s[a-w][a-z] +[._]s[a-w][a-z] + +# emacs backups +*~ + +.pyc +__pycache__ diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/.gitmodules b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/.gitmodules new file mode 100644 index 000000000..a2b56b981 --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/.gitmodules @@ -0,0 +1,3 @@ +[submodule "generator/dropbox-api-spec"] + path = generator/dropbox-api-spec + url = https://github.com/dropbox/dropbox-api-spec diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/.travis.yml b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/.travis.yml new file mode 100644 index 000000000..761f471d8 --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/.travis.yml @@ -0,0 +1,15 @@ +language: go + +go: + - 1.6.4 + - 1.7.6 + - 1.8.3 + +install: + - go get -u golang.org/x/oauth2 + +before_script: + - go get -u github.com/mitchellh/gox + +script: + - gox -osarch="darwin/amd64 linux/amd64 windows/amd64" ./dropbox/... diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/LICENSE b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/LICENSE new file mode 100644 index 000000000..93900695a --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2009-2016 Dropbox Inc., http://www.dropbox.com/ + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/README.md b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/README.md new file mode 100644 index 000000000..ee87fc119 --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/README.md @@ -0,0 +1,95 @@ +# Dropbox SDK for Go [UNOFFICIAL] [![GoDoc](https://godoc.org/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox?status.svg)](https://godoc.org/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox) [![Build Status](https://travis-ci.org/dropbox/dropbox-sdk-go-unofficial.svg?branch=master)](https://travis-ci.org/dropbox/dropbox-sdk-go-unofficial) + +An **UNOFFICIAL** Go SDK for integrating with the Dropbox API v2. Tested with Go 1.5+ + +:warning: WARNING: This SDK is **NOT yet official**. What does this mean? + + * There is no formal Dropbox [support](https://www.dropbox.com/developers/support) for this SDK at this point + * Bugs may or may not get fixed + * Not all SDK features may be implemented and implemented features may be buggy or incorrect + + +### Uh OK, so why are you releasing this? + + * the SDK, while unofficial, _is_ usable. See [dbxcli](https://github.com/dropbox/dbxcli) for an example application built using the SDK + * we would like to get feedback from the community and evaluate the level of interest/enthusiasm before investing into official supporting one more SDK + +## Installation + +```sh +$ go get github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/... +``` + +For most applications, you should just import the relevant namespace(s) only. The SDK exports the following sub-packages: + +* `github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth` +* `github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files` +* `github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing` +* `github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team` +* `github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users` + +Additionally, the base `github.com/dropbox/dropbox-sdk-go-unofficial/dropbox` package exports some configuration and helper methods. + +## Usage + +First, you need to [register a new "app"](https://dropbox.com/developers/apps) to start making API requests. Once you have created an app, you can either use the SDK via an access token (useful for testing) or via the regular OAuth2 flow (recommended for production). + +### Using OAuth token + +Once you've created an app, you can get an access token from the app's console. Note that this token will only work for the Dropbox account the token is associated with. + +```go +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 + dbx := users.New(config) + // start making API calls +} +``` + +### Using OAuth2 flow + +For this, you will need your `APP_KEY` and `APP_SECRET` from the developers console. Your app will then have to take users though the oauth flow, as part of which users will explicitly grant permissions to your app. At the end of this process, users will get a token that the app can then use for subsequent authentication. See [this](https://godoc.org/golang.org/x/oauth2#example-Config) for an example of oauth2 flow in Go. + +Once you have the token, usage is same as above. + +### Making API calls + +Each Dropbox API takes in a request type and returns a response type. For instance, [/users/get_account](https://www.dropbox.com/developers/documentation/http/documentation#users-get_account) takes as input a `GetAccountArg` and returns a `BasicAccount`. The typical pattern for making API calls is: + + * Instantiate the argument via the `New*` convenience functions in the SDK + * Invoke the API + * Process the response (or handle error, as below) + +Here's an example: + +```go + arg := users.NewGetAccountArg(accountId) + if resp, err := dbx.GetAccount(arg); err != nil { + return err + } + fmt.Printf("Name: %v", resp.Name) +``` + +### Error Handling + +As described in the [API docs](https://www.dropbox.com/developers/documentation/http/documentation#error-handling), all HTTP errors _except_ 409 are returned as-is to the client (with a helpful text message where possible). In case of a 409, the SDK will return an endpoint-specific error as described in the API. This will be made available as `EndpointError` member in the error. + +## Note on using the Teams API + +To use the Team API, you will need to create a Dropbox Business App. The OAuth token from this app will _only_ work for the Team API. + +Please read the [API docs](https://www.dropbox.com/developers/documentation/http/teams) carefully to appropriate secure your apps and tokens when using the Team API. + +## Code Generation + +This SDK is automatically generated using the public [Dropbox API spec](https://github.com/dropbox/dropbox-api-spec) and [Stone](https://github.com/dropbox/stone). See this [README](https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/master/generator/README.md) +for more details on how code is generated. + +## Caveats + + * To re-iterate, this is an **UNOFFICIAL** SDK and thus has no official support from Dropbox + * Only supports the v2 API. Parts of the v2 API are still in beta, and thus subject to change + * This SDK itself is in beta, and so interfaces may change at any point diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/async/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/async/types.go new file mode 100644 index 000000000..68f5260da --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/async/types.go @@ -0,0 +1,132 @@ +// Copyright (c) Dropbox, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package async : has no documentation (yet) +package async + +import ( + "encoding/json" + + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" +) + +// LaunchResultBase : Result returned by methods that launch an asynchronous +// job. A method who may either launch an asynchronous job, or complete the +// request synchronously, can use this union by extending it, and adding a +// 'complete' field with the type of the synchronous response. See +// `LaunchEmptyResult` for an example. +type LaunchResultBase 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 LaunchResultBase +const ( + LaunchResultBaseAsyncJobId = "async_job_id" +) + +// UnmarshalJSON deserializes into a LaunchResultBase instance +func (u *LaunchResultBase) 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 +} + +// LaunchEmptyResult : Result returned by methods that may either launch an +// asynchronous job or complete synchronously. Upon synchronous completion of +// the job, no additional information is returned. +type LaunchEmptyResult struct { + dropbox.Tagged +} + +// Valid tag values for LaunchEmptyResult +const ( + LaunchEmptyResultComplete = "complete" +) + +// 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 + // returned from the method that launched the job. + AsyncJobId string `json:"async_job_id"` +} + +// NewPollArg returns a new PollArg instance +func NewPollArg(AsyncJobId string) *PollArg { + s := new(PollArg) + s.AsyncJobId = AsyncJobId + return s +} + +// PollResultBase : Result returned by methods that poll for the status of an +// asynchronous job. Unions that extend this union should add a 'complete' field +// with a type of the information returned upon job completion. See +// `PollEmptyResult` for an example. +type PollResultBase struct { + dropbox.Tagged +} + +// Valid tag values for PollResultBase +const ( + PollResultBaseInProgress = "in_progress" +) + +// PollEmptyResult : Result returned by methods that poll for the status of an +// asynchronous job. Upon completion of the job, no additional information is +// returned. +type PollEmptyResult struct { + dropbox.Tagged +} + +// Valid tag values for PollEmptyResult +const ( + PollEmptyResultComplete = "complete" +) + +// PollError : Error returned by methods for polling the status of asynchronous +// job. +type PollError struct { + dropbox.Tagged +} + +// Valid tag values for PollError +const ( + PollErrorInvalidAsyncJobId = "invalid_async_job_id" + PollErrorInternalError = "internal_error" + PollErrorOther = "other" +) diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/client.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/client.go new file mode 100644 index 000000000..a42038ef3 --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/client.go @@ -0,0 +1,178 @@ +// Copyright (c) Dropbox, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package auth + +import ( + "bytes" + "encoding/json" + "io/ioutil" + "net/http" + + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" +) + +// Client interface describes all routes in this namespace +type Client interface { + // TokenFromOauth1 : Creates an OAuth 2.0 access token from the supplied + // OAuth 1.0 access token. + TokenFromOauth1(arg *TokenFromOAuth1Arg) (res *TokenFromOAuth1Result, err error) + // TokenRevoke : Disables the access token used to authenticate the call. + TokenRevoke() (err error) +} + +type apiImpl dropbox.Context + +//TokenFromOauth1APIError is an error-wrapper for the token/from_oauth1 route +type TokenFromOauth1APIError struct { + dropbox.APIError + EndpointError *TokenFromOAuth1Error `json:"error"` +} + +func (dbx *apiImpl) TokenFromOauth1(arg *TokenFromOAuth1Arg) (res *TokenFromOAuth1Result, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "auth", "token/from_oauth1", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError TokenFromOauth1APIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//TokenRevokeAPIError is an error-wrapper for the token/revoke route +type TokenRevokeAPIError struct { + dropbox.APIError + EndpointError struct{} `json:"error"` +} + +func (dbx *apiImpl) TokenRevoke() (err error) { + cli := dbx.Client + + headers := map[string]string{} + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "auth", "token/revoke", headers, nil) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + return + } + if resp.StatusCode == http.StatusConflict { + var apiError TokenRevokeAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +// New returns a Client implementation for this namespace +func New(c dropbox.Config) *apiImpl { + ctx := apiImpl(dropbox.NewContext(c)) + return &ctx +} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/types.go new file mode 100644 index 000000000..bf2bf32cf --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/types.go @@ -0,0 +1,187 @@ +// Copyright (c) Dropbox, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package auth : has no documentation (yet) +package auth + +import ( + "encoding/json" + + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" +) + +// AccessError : Error occurred because the account doesn't have permission to +// access the resource. +type AccessError struct { + dropbox.Tagged + // InvalidAccountType : Current account type cannot access the resource. + InvalidAccountType *InvalidAccountTypeError `json:"invalid_account_type,omitempty"` + // PaperAccessDenied : Current account cannot access Paper. + PaperAccessDenied *PaperAccessError `json:"paper_access_denied,omitempty"` +} + +// Valid tag values for AccessError +const ( + AccessErrorInvalidAccountType = "invalid_account_type" + AccessErrorPaperAccessDenied = "paper_access_denied" + AccessErrorOther = "other" +) + +// UnmarshalJSON deserializes into a AccessError instance +func (u *AccessError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // InvalidAccountType : Current account type cannot access the resource. + InvalidAccountType json.RawMessage `json:"invalid_account_type,omitempty"` + // PaperAccessDenied : Current account cannot access Paper. + PaperAccessDenied json.RawMessage `json:"paper_access_denied,omitempty"` + } + var w wrap + var err error + if err = json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "invalid_account_type": + err = json.Unmarshal(w.InvalidAccountType, &u.InvalidAccountType) + + if err != nil { + return err + } + case "paper_access_denied": + err = json.Unmarshal(w.PaperAccessDenied, &u.PaperAccessDenied) + + if err != nil { + return err + } + } + return nil +} + +// AuthError : Errors occurred during authentication. +type AuthError struct { + dropbox.Tagged +} + +// Valid tag values for AuthError +const ( + AuthErrorInvalidAccessToken = "invalid_access_token" + AuthErrorInvalidSelectUser = "invalid_select_user" + AuthErrorInvalidSelectAdmin = "invalid_select_admin" + AuthErrorUserSuspended = "user_suspended" + AuthErrorOther = "other" +) + +// InvalidAccountTypeError : has no documentation (yet) +type InvalidAccountTypeError struct { + dropbox.Tagged +} + +// Valid tag values for InvalidAccountTypeError +const ( + InvalidAccountTypeErrorEndpoint = "endpoint" + InvalidAccountTypeErrorFeature = "feature" + InvalidAccountTypeErrorOther = "other" +) + +// PaperAccessError : has no documentation (yet) +type PaperAccessError struct { + dropbox.Tagged +} + +// Valid tag values for PaperAccessError +const ( + PaperAccessErrorPaperDisabled = "paper_disabled" + PaperAccessErrorNotPaperUser = "not_paper_user" + PaperAccessErrorOther = "other" +) + +// RateLimitError : Error occurred because the app is being rate limited. +type RateLimitError struct { + // Reason : The reason why the app is being rate limited. + Reason *RateLimitReason `json:"reason"` + // RetryAfter : The number of seconds that the app should wait before making + // another request. + RetryAfter uint64 `json:"retry_after"` +} + +// NewRateLimitError returns a new RateLimitError instance +func NewRateLimitError(Reason *RateLimitReason) *RateLimitError { + s := new(RateLimitError) + s.Reason = Reason + s.RetryAfter = 1 + return s +} + +// RateLimitReason : has no documentation (yet) +type RateLimitReason struct { + dropbox.Tagged +} + +// Valid tag values for RateLimitReason +const ( + RateLimitReasonTooManyRequests = "too_many_requests" + RateLimitReasonTooManyWriteOperations = "too_many_write_operations" + RateLimitReasonOther = "other" +) + +// TokenFromOAuth1Arg : has no documentation (yet) +type TokenFromOAuth1Arg struct { + // Oauth1Token : The supplied OAuth 1.0 access token. + Oauth1Token string `json:"oauth1_token"` + // Oauth1TokenSecret : The token secret associated with the supplied access + // token. + Oauth1TokenSecret string `json:"oauth1_token_secret"` +} + +// NewTokenFromOAuth1Arg returns a new TokenFromOAuth1Arg instance +func NewTokenFromOAuth1Arg(Oauth1Token string, Oauth1TokenSecret string) *TokenFromOAuth1Arg { + s := new(TokenFromOAuth1Arg) + s.Oauth1Token = Oauth1Token + s.Oauth1TokenSecret = Oauth1TokenSecret + return s +} + +// TokenFromOAuth1Error : has no documentation (yet) +type TokenFromOAuth1Error struct { + dropbox.Tagged +} + +// Valid tag values for TokenFromOAuth1Error +const ( + TokenFromOAuth1ErrorInvalidOauth1TokenInfo = "invalid_oauth1_token_info" + TokenFromOAuth1ErrorAppIdMismatch = "app_id_mismatch" + TokenFromOAuth1ErrorOther = "other" +) + +// TokenFromOAuth1Result : has no documentation (yet) +type TokenFromOAuth1Result struct { + // Oauth2Token : The OAuth 2.0 token generated from the supplied OAuth 1.0 + // token. + Oauth2Token string `json:"oauth2_token"` +} + +// NewTokenFromOAuth1Result returns a new TokenFromOAuth1Result instance +func NewTokenFromOAuth1Result(Oauth2Token string) *TokenFromOAuth1Result { + s := new(TokenFromOAuth1Result) + s.Oauth2Token = Oauth2Token + return s +} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/common/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/common/types.go new file mode 100644 index 000000000..821765e62 --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/common/types.go @@ -0,0 +1,132 @@ +// Copyright (c) Dropbox, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package common : has no documentation (yet) +package common + +import ( + "encoding/json" + + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" +) + +// InvalidPathRootError : has no documentation (yet) +type InvalidPathRootError struct { + // PathRoot : The latest path root id for user's team if the user is still + // in a team. + PathRoot string `json:"path_root,omitempty"` +} + +// NewInvalidPathRootError returns a new InvalidPathRootError instance +func NewInvalidPathRootError() *InvalidPathRootError { + s := new(InvalidPathRootError) + return s +} + +// PathRoot : has no documentation (yet) +type PathRoot struct { + dropbox.Tagged + // Team : Paths are relative to the given team directory. (This results in + // `PathRootError.invalid` if the user is not a member of the team + // associated with that path root id.) + Team string `json:"team,omitempty"` + // NamespaceId : Paths are relative to given namespace id (This results in + // `PathRootError.no_permission` if you don't have access to this + // namespace.) + NamespaceId string `json:"namespace_id,omitempty"` +} + +// Valid tag values for PathRoot +const ( + PathRootHome = "home" + PathRootMemberHome = "member_home" + PathRootTeam = "team" + PathRootUserHome = "user_home" + PathRootNamespaceId = "namespace_id" + PathRootOther = "other" +) + +// UnmarshalJSON deserializes into a PathRoot instance +func (u *PathRoot) 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 "team": + err = json.Unmarshal(body, &u.Team) + + if err != nil { + return err + } + case "namespace_id": + err = json.Unmarshal(body, &u.NamespaceId) + + if err != nil { + return err + } + } + return nil +} + +// PathRootError : has no documentation (yet) +type PathRootError struct { + dropbox.Tagged + // Invalid : The path root id value in Dropbox-API-Path-Root header is no + // longer valid. + Invalid *InvalidPathRootError `json:"invalid,omitempty"` +} + +// Valid tag values for PathRootError +const ( + PathRootErrorInvalid = "invalid" + PathRootErrorNoPermission = "no_permission" + PathRootErrorOther = "other" +) + +// UnmarshalJSON deserializes into a PathRootError instance +func (u *PathRootError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Invalid : The path root id value in Dropbox-API-Path-Root header is + // no longer valid. + Invalid json.RawMessage `json:"invalid,omitempty"` + } + var w wrap + var err error + if err = json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "invalid": + err = json.Unmarshal(body, &u.Invalid) + + if err != nil { + return err + } + } + return nil +} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/client.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/client.go new file mode 100644 index 000000000..a084e8519 --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/client.go @@ -0,0 +1,3602 @@ +// Copyright (c) Dropbox, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package files + +import ( + "bytes" + "encoding/json" + "io" + "io/ioutil" + "log" + "net/http" + + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/async" + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/properties" +) + +// Client interface describes all routes in this namespace +type Client interface { + // AlphaGetMetadata : Returns the metadata for a file or folder. This is an + // alpha endpoint compatible with the properties API. Note: Metadata for the + // root folder is unsupported. + AlphaGetMetadata(arg *AlphaGetMetadataArg) (res IsMetadata, err error) + // AlphaUpload : Create a new file with the contents provided in the + // request. Note that this endpoint is part of the properties API alpha and + // is slightly different from `upload`. Do not use this to upload a file + // larger than 150 MB. Instead, create an upload session with + // `uploadSessionStart`. + AlphaUpload(arg *CommitInfoWithProperties, content io.Reader) (res *FileMetadata, err error) + // Copy : Copy a file or folder to a different location in the user's + // Dropbox. If the source path is a folder all its contents will be copied. + // Deprecated: Use `CopyV2` instead + Copy(arg *RelocationArg) (res IsMetadata, err error) + // CopyBatch : Copy multiple files or folders to different locations at once + // in the user's Dropbox. If `RelocationBatchArg.allow_shared_folder` is + // false, this route is atomic. If on entry failes, the whole transaction + // will abort. If `RelocationBatchArg.allow_shared_folder` is true, not + // atomicity is guaranteed, but you will be able to copy the contents of + // shared folders to new locations. This route will return job ID + // immediately and do the async copy job in background. Please use + // `copyBatchCheck` to check the job status. + CopyBatch(arg *RelocationBatchArg) (res *RelocationBatchLaunch, err error) + // CopyBatchCheck : Returns the status of an asynchronous job for + // `copyBatch`. If success, it returns list of results for each entry. + CopyBatchCheck(arg *async.PollArg) (res *RelocationBatchJobStatus, err error) + // CopyReferenceGet : Get a copy reference to a file or folder. This + // reference string can be used to save that file or folder to another + // user's Dropbox by passing it to `copyReferenceSave`. + CopyReferenceGet(arg *GetCopyReferenceArg) (res *GetCopyReferenceResult, err error) + // CopyReferenceSave : Save a copy reference returned by `copyReferenceGet` + // to the user's Dropbox. + CopyReferenceSave(arg *SaveCopyReferenceArg) (res *SaveCopyReferenceResult, err error) + // CopyV2 : Copy a file or folder to a different location in the user's + // Dropbox. If the source path is a folder all its contents will be copied. + CopyV2(arg *RelocationArg) (res *RelocationResult, err error) + // CreateFolder : Create a folder at a given path. + // Deprecated: Use `CreateFolderV2` instead + CreateFolder(arg *CreateFolderArg) (res *FolderMetadata, err error) + // CreateFolderV2 : Create a folder at a given path. + CreateFolderV2(arg *CreateFolderArg) (res *CreateFolderResult, err error) + // Delete : Delete the file or folder at a given path. If the path is a + // folder, all its contents will be deleted too. A successful response + // indicates that the file or folder was deleted. The returned metadata will + // be the corresponding `FileMetadata` or `FolderMetadata` for the item at + // time of deletion, and not a `DeletedMetadata` object. + // Deprecated: Use `DeleteV2` instead + Delete(arg *DeleteArg) (res IsMetadata, err error) + // DeleteBatch : Delete multiple files/folders at once. This route is + // asynchronous, which returns a job ID immediately and runs the delete + // batch asynchronously. Use `deleteBatchCheck` to check the job status. + DeleteBatch(arg *DeleteBatchArg) (res *DeleteBatchLaunch, err error) + // DeleteBatchCheck : Returns the status of an asynchronous job for + // `deleteBatch`. If success, it returns list of result for each entry. + DeleteBatchCheck(arg *async.PollArg) (res *DeleteBatchJobStatus, err error) + // DeleteV2 : Delete the file or folder at a given path. If the path is a + // folder, all its contents will be deleted too. A successful response + // indicates that the file or folder was deleted. The returned metadata will + // be the corresponding `FileMetadata` or `FolderMetadata` for the item at + // time of deletion, and not a `DeletedMetadata` object. + DeleteV2(arg *DeleteArg) (res *DeleteResult, err error) + // Download : Download a file from a user's Dropbox. + Download(arg *DownloadArg) (res *FileMetadata, content io.ReadCloser, err error) + // GetMetadata : Returns the metadata for a file or folder. Note: Metadata + // for the root folder is unsupported. + GetMetadata(arg *GetMetadataArg) (res IsMetadata, err error) + // GetPreview : Get a preview for a file. Currently, PDF previews are + // generated for files with the following extensions: .ai, .doc, .docm, + // .docx, .eps, .odp, .odt, .pps, .ppsm, .ppsx, .ppt, .pptm, .pptx, .rtf. + // HTML previews are generated for files with the following extensions: + // .csv, .ods, .xls, .xlsm, .xlsx. Other formats will return an unsupported + // extension error. + GetPreview(arg *PreviewArg) (res *FileMetadata, content io.ReadCloser, err error) + // GetTemporaryLink : Get a temporary link to stream content of a file. This + // link will expire in four hours and afterwards you will get 410 Gone. + // Content-Type of the link is determined automatically by the file's mime + // type. + GetTemporaryLink(arg *GetTemporaryLinkArg) (res *GetTemporaryLinkResult, err error) + // GetThumbnail : Get a thumbnail for an image. This method currently + // supports files with the following file extensions: jpg, jpeg, png, tiff, + // tif, gif and bmp. Photos that are larger than 20MB in size won't be + // converted to a thumbnail. + GetThumbnail(arg *ThumbnailArg) (res *FileMetadata, content io.ReadCloser, err error) + // ListFolder : Starts returning the contents of a folder. If the result's + // `ListFolderResult.has_more` field is true, call `listFolderContinue` with + // the returned `ListFolderResult.cursor` to retrieve more entries. If + // you're using `ListFolderArg.recursive` set to true to keep a local cache + // of the contents of a Dropbox account, iterate through each entry in order + // and process them as follows to keep your local state in sync: For each + // `FileMetadata`, store the new entry at the given path in your local + // state. If the required parent folders don't exist yet, create them. If + // there's already something else at the given path, replace it and remove + // all its children. For each `FolderMetadata`, store the new entry at the + // given path in your local state. If the required parent folders don't + // exist yet, create them. If there's already something else at the given + // path, replace it but leave the children as they are. Check the new + // entry's `FolderSharingInfo.read_only` and set all its children's + // read-only statuses to match. For each `DeletedMetadata`, if your local + // state has something at the given path, remove it and all its children. If + // there's nothing at the given path, ignore this entry. Note: + // `auth.RateLimitError` may be returned if multiple `listFolder` or + // `listFolderContinue` calls with same parameters are made simultaneously + // by same API app for same user. If your app implements retry logic, please + // hold off the retry until the previous request finishes. + ListFolder(arg *ListFolderArg) (res *ListFolderResult, err error) + // ListFolderContinue : Once a cursor has been retrieved from `listFolder`, + // use this to paginate through all files and retrieve updates to the + // folder, following the same rules as documented for `listFolder`. + ListFolderContinue(arg *ListFolderContinueArg) (res *ListFolderResult, err error) + // ListFolderGetLatestCursor : A way to quickly get a cursor for the + // folder's state. Unlike `listFolder`, `listFolderGetLatestCursor` doesn't + // return any entries. This endpoint is for app which only needs to know + // about new files and modifications and doesn't need to know about files + // that already exist in Dropbox. + ListFolderGetLatestCursor(arg *ListFolderArg) (res *ListFolderGetLatestCursorResult, err error) + // ListFolderLongpoll : A longpoll endpoint to wait for changes on an + // account. In conjunction with `listFolderContinue`, this call gives you a + // low-latency way to monitor an account for file changes. The connection + // will block until there are changes available or a timeout occurs. This + // endpoint is useful mostly for client-side apps. If you're looking for + // server-side notifications, check out our `webhooks documentation` + // . + ListFolderLongpoll(arg *ListFolderLongpollArg) (res *ListFolderLongpollResult, err error) + // ListRevisions : Return revisions of a file. + ListRevisions(arg *ListRevisionsArg) (res *ListRevisionsResult, err error) + // Move : Move a file or folder to a different location in the user's + // Dropbox. If the source path is a folder all its contents will be moved. + // Deprecated: Use `MoveV2` instead + Move(arg *RelocationArg) (res IsMetadata, err error) + // MoveBatch : Move multiple files or folders to different locations at once + // in the user's Dropbox. This route is 'all or nothing', which means if one + // entry fails, the whole transaction will abort. This route will return job + // ID immediately and do the async moving job in background. Please use + // `moveBatchCheck` to check the job status. + MoveBatch(arg *RelocationBatchArg) (res *RelocationBatchLaunch, err error) + // MoveBatchCheck : Returns the status of an asynchronous job for + // `moveBatch`. If success, it returns list of results for each entry. + MoveBatchCheck(arg *async.PollArg) (res *RelocationBatchJobStatus, err error) + // MoveV2 : Move a file or folder to a different location in the user's + // Dropbox. If the source path is a folder all its contents will be moved. + MoveV2(arg *RelocationArg) (res *RelocationResult, err error) + // PermanentlyDelete : Permanently delete the file or folder at a given path + // (see https://www.dropbox.com/en/help/40). Note: This endpoint is only + // available for Dropbox Business apps. + PermanentlyDelete(arg *DeleteArg) (err error) + // PropertiesAdd : Add custom properties to a file using a filled property + // template. See properties/template/add to create new property templates. + PropertiesAdd(arg *PropertyGroupWithPath) (err error) + // PropertiesOverwrite : Overwrite custom properties from a specified + // template associated with a file. + PropertiesOverwrite(arg *PropertyGroupWithPath) (err error) + // PropertiesRemove : Remove all custom properties from a specified template + // associated with a file. To remove specific property key value pairs, see + // `propertiesUpdate`. To update a property template, see + // properties/template/update. Property templates can't be removed once + // created. + PropertiesRemove(arg *RemovePropertiesArg) (err error) + // PropertiesTemplateGet : Get the schema for a specified template. + PropertiesTemplateGet(arg *properties.GetPropertyTemplateArg) (res *properties.GetPropertyTemplateResult, err error) + // PropertiesTemplateList : Get the property template identifiers for a + // user. To get the schema of each template use `propertiesTemplateGet`. + PropertiesTemplateList() (res *properties.ListPropertyTemplateIds, err error) + // PropertiesUpdate : Add, update or remove custom properties from a + // specified template associated with a file. Fields that already exist and + // not described in the request will not be modified. + PropertiesUpdate(arg *UpdatePropertyGroupArg) (err error) + // Restore : Restore a file to a specific revision. + Restore(arg *RestoreArg) (res *FileMetadata, err error) + // SaveUrl : Save a specified URL into a file in user's Dropbox. If the + // given path already exists, the file will be renamed to avoid the conflict + // (e.g. myfile (1).txt). + SaveUrl(arg *SaveUrlArg) (res *SaveUrlResult, err error) + // SaveUrlCheckJobStatus : Check the status of a `saveUrl` job. + SaveUrlCheckJobStatus(arg *async.PollArg) (res *SaveUrlJobStatus, err error) + // Search : Searches for files and folders. Note: Recent changes may not + // immediately be reflected in search results due to a short delay in + // indexing. + Search(arg *SearchArg) (res *SearchResult, err error) + // Upload : Create a new file with the contents provided in the request. Do + // not use this to upload a file larger than 150 MB. Instead, create an + // upload session with `uploadSessionStart`. + Upload(arg *CommitInfo, content io.Reader) (res *FileMetadata, err error) + // UploadSessionAppend : Append more data to an upload session. A single + // request should not upload more than 150 MB. + // Deprecated: Use `UploadSessionAppendV2` instead + UploadSessionAppend(arg *UploadSessionCursor, content io.Reader) (err error) + // UploadSessionAppendV2 : Append more data to an upload session. When the + // parameter close is set, this call will close the session. A single + // request should not upload more than 150 MB. + UploadSessionAppendV2(arg *UploadSessionAppendArg, content io.Reader) (err error) + // UploadSessionFinish : Finish an upload session and save the uploaded data + // to the given file path. A single request should not upload more than 150 + // MB. + UploadSessionFinish(arg *UploadSessionFinishArg, content io.Reader) (res *FileMetadata, err error) + // UploadSessionFinishBatch : This route helps you commit many files at once + // into a user's Dropbox. Use `uploadSessionStart` and + // `uploadSessionAppendV2` to upload file contents. We recommend uploading + // many files in parallel to increase throughput. Once the file contents + // have been uploaded, rather than calling `uploadSessionFinish`, use this + // route to finish all your upload sessions in a single request. + // `UploadSessionStartArg.close` or `UploadSessionAppendArg.close` needs to + // be true for the last `uploadSessionStart` or `uploadSessionAppendV2` + // call. This route will return a job_id immediately and do the async commit + // job in background. Use `uploadSessionFinishBatchCheck` to check the job + // status. For the same account, this route should be executed serially. + // That means you should not start the next job before current job finishes. + // We allow up to 1000 entries in a single request. + UploadSessionFinishBatch(arg *UploadSessionFinishBatchArg) (res *UploadSessionFinishBatchLaunch, err error) + // UploadSessionFinishBatchCheck : Returns the status of an asynchronous job + // for `uploadSessionFinishBatch`. If success, it returns list of result for + // each entry. + UploadSessionFinishBatchCheck(arg *async.PollArg) (res *UploadSessionFinishBatchJobStatus, err error) + // UploadSessionStart : Upload sessions allow you to upload a single file in + // one or more requests, for example where the size of the file is greater + // than 150 MB. This call starts a new upload session with the given data. + // You can then use `uploadSessionAppendV2` to add more data and + // `uploadSessionFinish` to save all the data to a file in Dropbox. A single + // request should not upload more than 150 MB. An upload session can be used + // for a maximum of 48 hours. Attempting to use an + // `UploadSessionStartResult.session_id` with `uploadSessionAppendV2` or + // `uploadSessionFinish` more than 48 hours after its creation will return a + // `UploadSessionLookupError.not_found`. + UploadSessionStart(arg *UploadSessionStartArg, content io.Reader) (res *UploadSessionStartResult, err error) +} + +type apiImpl dropbox.Context + +//AlphaGetMetadataAPIError is an error-wrapper for the alpha/get_metadata route +type AlphaGetMetadataAPIError struct { + dropbox.APIError + EndpointError *AlphaGetMetadataError `json:"error"` +} + +func (dbx *apiImpl) AlphaGetMetadata(arg *AlphaGetMetadataArg) (res IsMetadata, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "alpha/get_metadata", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + var tmp metadataUnion + err = json.Unmarshal(body, &tmp) + if err != nil { + return + } + switch tmp.Tag { + case "file": + res = tmp.File + + case "folder": + res = tmp.Folder + + case "deleted": + res = tmp.Deleted + + } + return + } + if resp.StatusCode == http.StatusConflict { + var apiError AlphaGetMetadataAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//AlphaUploadAPIError is an error-wrapper for the alpha/upload route +type AlphaUploadAPIError struct { + dropbox.APIError + EndpointError *UploadErrorWithProperties `json:"error"` +} + +func (dbx *apiImpl) AlphaUpload(arg *CommitInfoWithProperties, content io.Reader) (res *FileMetadata, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/octet-stream", + "Dropbox-API-Arg": string(b), + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("content", "upload", true, "files", "alpha/upload", headers, content) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError AlphaUploadAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//CopyAPIError is an error-wrapper for the copy route +type CopyAPIError struct { + dropbox.APIError + EndpointError *RelocationError `json:"error"` +} + +func (dbx *apiImpl) Copy(arg *RelocationArg) (res IsMetadata, err error) { + log.Printf("WARNING: API `Copy` is deprecated") + log.Printf("Use API `CopyV2` instead") + + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "copy", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + var tmp metadataUnion + err = json.Unmarshal(body, &tmp) + if err != nil { + return + } + switch tmp.Tag { + case "file": + res = tmp.File + + case "folder": + res = tmp.Folder + + case "deleted": + res = tmp.Deleted + + } + return + } + if resp.StatusCode == http.StatusConflict { + var apiError CopyAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//CopyBatchAPIError is an error-wrapper for the copy_batch route +type CopyBatchAPIError struct { + dropbox.APIError + EndpointError struct{} `json:"error"` +} + +func (dbx *apiImpl) CopyBatch(arg *RelocationBatchArg) (res *RelocationBatchLaunch, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "copy_batch", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError CopyBatchAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//CopyBatchCheckAPIError is an error-wrapper for the copy_batch/check route +type CopyBatchCheckAPIError struct { + dropbox.APIError + EndpointError *async.PollError `json:"error"` +} + +func (dbx *apiImpl) CopyBatchCheck(arg *async.PollArg) (res *RelocationBatchJobStatus, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "copy_batch/check", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError CopyBatchCheckAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//CopyReferenceGetAPIError is an error-wrapper for the copy_reference/get route +type CopyReferenceGetAPIError struct { + dropbox.APIError + EndpointError *GetCopyReferenceError `json:"error"` +} + +func (dbx *apiImpl) CopyReferenceGet(arg *GetCopyReferenceArg) (res *GetCopyReferenceResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "copy_reference/get", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError CopyReferenceGetAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//CopyReferenceSaveAPIError is an error-wrapper for the copy_reference/save route +type CopyReferenceSaveAPIError struct { + dropbox.APIError + EndpointError *SaveCopyReferenceError `json:"error"` +} + +func (dbx *apiImpl) CopyReferenceSave(arg *SaveCopyReferenceArg) (res *SaveCopyReferenceResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "copy_reference/save", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError CopyReferenceSaveAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//CopyV2APIError is an error-wrapper for the copy_v2 route +type CopyV2APIError struct { + dropbox.APIError + EndpointError *RelocationError `json:"error"` +} + +func (dbx *apiImpl) CopyV2(arg *RelocationArg) (res *RelocationResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "copy_v2", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError CopyV2APIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//CreateFolderAPIError is an error-wrapper for the create_folder route +type CreateFolderAPIError struct { + dropbox.APIError + EndpointError *CreateFolderError `json:"error"` +} + +func (dbx *apiImpl) CreateFolder(arg *CreateFolderArg) (res *FolderMetadata, err error) { + log.Printf("WARNING: API `CreateFolder` is deprecated") + log.Printf("Use API `CreateFolderV2` instead") + + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "create_folder", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError CreateFolderAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//CreateFolderV2APIError is an error-wrapper for the create_folder_v2 route +type CreateFolderV2APIError struct { + dropbox.APIError + EndpointError *CreateFolderError `json:"error"` +} + +func (dbx *apiImpl) CreateFolderV2(arg *CreateFolderArg) (res *CreateFolderResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "create_folder_v2", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError CreateFolderV2APIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//DeleteAPIError is an error-wrapper for the delete route +type DeleteAPIError struct { + dropbox.APIError + EndpointError *DeleteError `json:"error"` +} + +func (dbx *apiImpl) Delete(arg *DeleteArg) (res IsMetadata, err error) { + log.Printf("WARNING: API `Delete` is deprecated") + log.Printf("Use API `DeleteV2` instead") + + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "delete", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + var tmp metadataUnion + err = json.Unmarshal(body, &tmp) + if err != nil { + return + } + switch tmp.Tag { + case "file": + res = tmp.File + + case "folder": + res = tmp.Folder + + case "deleted": + res = tmp.Deleted + + } + return + } + if resp.StatusCode == http.StatusConflict { + var apiError DeleteAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//DeleteBatchAPIError is an error-wrapper for the delete_batch route +type DeleteBatchAPIError struct { + dropbox.APIError + EndpointError struct{} `json:"error"` +} + +func (dbx *apiImpl) DeleteBatch(arg *DeleteBatchArg) (res *DeleteBatchLaunch, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "delete_batch", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError DeleteBatchAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//DeleteBatchCheckAPIError is an error-wrapper for the delete_batch/check route +type DeleteBatchCheckAPIError struct { + dropbox.APIError + EndpointError *async.PollError `json:"error"` +} + +func (dbx *apiImpl) DeleteBatchCheck(arg *async.PollArg) (res *DeleteBatchJobStatus, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "delete_batch/check", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError DeleteBatchCheckAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//DeleteV2APIError is an error-wrapper for the delete_v2 route +type DeleteV2APIError struct { + dropbox.APIError + EndpointError *DeleteError `json:"error"` +} + +func (dbx *apiImpl) DeleteV2(arg *DeleteArg) (res *DeleteResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "delete_v2", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError DeleteV2APIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//DownloadAPIError is an error-wrapper for the download route +type DownloadAPIError struct { + dropbox.APIError + EndpointError *DownloadError `json:"error"` +} + +func (dbx *apiImpl) Download(arg *DownloadArg) (res *FileMetadata, content io.ReadCloser, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Dropbox-API-Arg": string(b), + } + for k, v := range arg.ExtraHeaders { + headers[k] = v + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("content", "download", true, "files", "download", headers, nil) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + body := []byte(resp.Header.Get("Dropbox-API-Result")) + content = resp.Body + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK || resp.StatusCode == http.StatusPartialContent { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError DownloadAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//GetMetadataAPIError is an error-wrapper for the get_metadata route +type GetMetadataAPIError struct { + dropbox.APIError + EndpointError *GetMetadataError `json:"error"` +} + +func (dbx *apiImpl) GetMetadata(arg *GetMetadataArg) (res IsMetadata, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "get_metadata", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + var tmp metadataUnion + err = json.Unmarshal(body, &tmp) + if err != nil { + return + } + switch tmp.Tag { + case "file": + res = tmp.File + + case "folder": + res = tmp.Folder + + case "deleted": + res = tmp.Deleted + + } + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GetMetadataAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//GetPreviewAPIError is an error-wrapper for the get_preview route +type GetPreviewAPIError struct { + dropbox.APIError + EndpointError *PreviewError `json:"error"` +} + +func (dbx *apiImpl) GetPreview(arg *PreviewArg) (res *FileMetadata, content io.ReadCloser, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Dropbox-API-Arg": string(b), + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("content", "download", true, "files", "get_preview", headers, nil) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + body := []byte(resp.Header.Get("Dropbox-API-Result")) + content = resp.Body + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GetPreviewAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//GetTemporaryLinkAPIError is an error-wrapper for the get_temporary_link route +type GetTemporaryLinkAPIError struct { + dropbox.APIError + EndpointError *GetTemporaryLinkError `json:"error"` +} + +func (dbx *apiImpl) GetTemporaryLink(arg *GetTemporaryLinkArg) (res *GetTemporaryLinkResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "get_temporary_link", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GetTemporaryLinkAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//GetThumbnailAPIError is an error-wrapper for the get_thumbnail route +type GetThumbnailAPIError struct { + dropbox.APIError + EndpointError *ThumbnailError `json:"error"` +} + +func (dbx *apiImpl) GetThumbnail(arg *ThumbnailArg) (res *FileMetadata, content io.ReadCloser, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Dropbox-API-Arg": string(b), + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("content", "download", true, "files", "get_thumbnail", headers, nil) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + body := []byte(resp.Header.Get("Dropbox-API-Result")) + content = resp.Body + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GetThumbnailAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//ListFolderAPIError is an error-wrapper for the list_folder route +type ListFolderAPIError struct { + dropbox.APIError + EndpointError *ListFolderError `json:"error"` +} + +func (dbx *apiImpl) ListFolder(arg *ListFolderArg) (res *ListFolderResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "list_folder", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError ListFolderAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//ListFolderContinueAPIError is an error-wrapper for the list_folder/continue route +type ListFolderContinueAPIError struct { + dropbox.APIError + EndpointError *ListFolderContinueError `json:"error"` +} + +func (dbx *apiImpl) ListFolderContinue(arg *ListFolderContinueArg) (res *ListFolderResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "list_folder/continue", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError ListFolderContinueAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//ListFolderGetLatestCursorAPIError is an error-wrapper for the list_folder/get_latest_cursor route +type ListFolderGetLatestCursorAPIError struct { + dropbox.APIError + EndpointError *ListFolderError `json:"error"` +} + +func (dbx *apiImpl) ListFolderGetLatestCursor(arg *ListFolderArg) (res *ListFolderGetLatestCursorResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "list_folder/get_latest_cursor", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError ListFolderGetLatestCursorAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//ListFolderLongpollAPIError is an error-wrapper for the list_folder/longpoll route +type ListFolderLongpollAPIError struct { + dropbox.APIError + EndpointError *ListFolderLongpollError `json:"error"` +} + +func (dbx *apiImpl) ListFolderLongpoll(arg *ListFolderLongpollArg) (res *ListFolderLongpollResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("notify", "rpc", false, "files", "list_folder/longpoll", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError ListFolderLongpollAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//ListRevisionsAPIError is an error-wrapper for the list_revisions route +type ListRevisionsAPIError struct { + dropbox.APIError + EndpointError *ListRevisionsError `json:"error"` +} + +func (dbx *apiImpl) ListRevisions(arg *ListRevisionsArg) (res *ListRevisionsResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "list_revisions", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError ListRevisionsAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//MoveAPIError is an error-wrapper for the move route +type MoveAPIError struct { + dropbox.APIError + EndpointError *RelocationError `json:"error"` +} + +func (dbx *apiImpl) Move(arg *RelocationArg) (res IsMetadata, err error) { + log.Printf("WARNING: API `Move` is deprecated") + log.Printf("Use API `MoveV2` instead") + + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "move", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + var tmp metadataUnion + err = json.Unmarshal(body, &tmp) + if err != nil { + return + } + switch tmp.Tag { + case "file": + res = tmp.File + + case "folder": + res = tmp.Folder + + case "deleted": + res = tmp.Deleted + + } + return + } + if resp.StatusCode == http.StatusConflict { + var apiError MoveAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//MoveBatchAPIError is an error-wrapper for the move_batch route +type MoveBatchAPIError struct { + dropbox.APIError + EndpointError struct{} `json:"error"` +} + +func (dbx *apiImpl) MoveBatch(arg *RelocationBatchArg) (res *RelocationBatchLaunch, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "move_batch", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError MoveBatchAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//MoveBatchCheckAPIError is an error-wrapper for the move_batch/check route +type MoveBatchCheckAPIError struct { + dropbox.APIError + EndpointError *async.PollError `json:"error"` +} + +func (dbx *apiImpl) MoveBatchCheck(arg *async.PollArg) (res *RelocationBatchJobStatus, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "move_batch/check", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError MoveBatchCheckAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//MoveV2APIError is an error-wrapper for the move_v2 route +type MoveV2APIError struct { + dropbox.APIError + EndpointError *RelocationError `json:"error"` +} + +func (dbx *apiImpl) MoveV2(arg *RelocationArg) (res *RelocationResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "move_v2", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError MoveV2APIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//PermanentlyDeleteAPIError is an error-wrapper for the permanently_delete route +type PermanentlyDeleteAPIError struct { + dropbox.APIError + EndpointError *DeleteError `json:"error"` +} + +func (dbx *apiImpl) PermanentlyDelete(arg *DeleteArg) (err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "permanently_delete", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + return + } + if resp.StatusCode == http.StatusConflict { + var apiError PermanentlyDeleteAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//PropertiesAddAPIError is an error-wrapper for the properties/add route +type PropertiesAddAPIError struct { + dropbox.APIError + EndpointError *AddPropertiesError `json:"error"` +} + +func (dbx *apiImpl) PropertiesAdd(arg *PropertyGroupWithPath) (err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "properties/add", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + return + } + if resp.StatusCode == http.StatusConflict { + var apiError PropertiesAddAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//PropertiesOverwriteAPIError is an error-wrapper for the properties/overwrite route +type PropertiesOverwriteAPIError struct { + dropbox.APIError + EndpointError *InvalidPropertyGroupError `json:"error"` +} + +func (dbx *apiImpl) PropertiesOverwrite(arg *PropertyGroupWithPath) (err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "properties/overwrite", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + return + } + if resp.StatusCode == http.StatusConflict { + var apiError PropertiesOverwriteAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//PropertiesRemoveAPIError is an error-wrapper for the properties/remove route +type PropertiesRemoveAPIError struct { + dropbox.APIError + EndpointError *RemovePropertiesError `json:"error"` +} + +func (dbx *apiImpl) PropertiesRemove(arg *RemovePropertiesArg) (err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "properties/remove", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + return + } + if resp.StatusCode == http.StatusConflict { + var apiError PropertiesRemoveAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//PropertiesTemplateGetAPIError is an error-wrapper for the properties/template/get route +type PropertiesTemplateGetAPIError struct { + dropbox.APIError + EndpointError *properties.PropertyTemplateError `json:"error"` +} + +func (dbx *apiImpl) PropertiesTemplateGet(arg *properties.GetPropertyTemplateArg) (res *properties.GetPropertyTemplateResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "properties/template/get", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError PropertiesTemplateGetAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//PropertiesTemplateListAPIError is an error-wrapper for the properties/template/list route +type PropertiesTemplateListAPIError struct { + dropbox.APIError + EndpointError *properties.PropertyTemplateError `json:"error"` +} + +func (dbx *apiImpl) PropertiesTemplateList() (res *properties.ListPropertyTemplateIds, err error) { + cli := dbx.Client + + headers := map[string]string{} + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "properties/template/list", headers, nil) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError PropertiesTemplateListAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//PropertiesUpdateAPIError is an error-wrapper for the properties/update route +type PropertiesUpdateAPIError struct { + dropbox.APIError + EndpointError *UpdatePropertiesError `json:"error"` +} + +func (dbx *apiImpl) PropertiesUpdate(arg *UpdatePropertyGroupArg) (err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "properties/update", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + return + } + if resp.StatusCode == http.StatusConflict { + var apiError PropertiesUpdateAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//RestoreAPIError is an error-wrapper for the restore route +type RestoreAPIError struct { + dropbox.APIError + EndpointError *RestoreError `json:"error"` +} + +func (dbx *apiImpl) Restore(arg *RestoreArg) (res *FileMetadata, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "restore", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError RestoreAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//SaveUrlAPIError is an error-wrapper for the save_url route +type SaveUrlAPIError struct { + dropbox.APIError + EndpointError *SaveUrlError `json:"error"` +} + +func (dbx *apiImpl) SaveUrl(arg *SaveUrlArg) (res *SaveUrlResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "save_url", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError SaveUrlAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//SaveUrlCheckJobStatusAPIError is an error-wrapper for the save_url/check_job_status route +type SaveUrlCheckJobStatusAPIError struct { + dropbox.APIError + EndpointError *async.PollError `json:"error"` +} + +func (dbx *apiImpl) SaveUrlCheckJobStatus(arg *async.PollArg) (res *SaveUrlJobStatus, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "save_url/check_job_status", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError SaveUrlCheckJobStatusAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//SearchAPIError is an error-wrapper for the search route +type SearchAPIError struct { + dropbox.APIError + EndpointError *SearchError `json:"error"` +} + +func (dbx *apiImpl) Search(arg *SearchArg) (res *SearchResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "search", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError SearchAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//UploadAPIError is an error-wrapper for the upload route +type UploadAPIError struct { + dropbox.APIError + EndpointError *UploadError `json:"error"` +} + +func (dbx *apiImpl) Upload(arg *CommitInfo, content io.Reader) (res *FileMetadata, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/octet-stream", + "Dropbox-API-Arg": string(b), + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("content", "upload", true, "files", "upload", headers, content) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError UploadAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//UploadSessionAppendAPIError is an error-wrapper for the upload_session/append route +type UploadSessionAppendAPIError struct { + dropbox.APIError + EndpointError *UploadSessionLookupError `json:"error"` +} + +func (dbx *apiImpl) UploadSessionAppend(arg *UploadSessionCursor, content io.Reader) (err error) { + log.Printf("WARNING: API `UploadSessionAppend` is deprecated") + log.Printf("Use API `UploadSessionAppendV2` instead") + + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/octet-stream", + "Dropbox-API-Arg": string(b), + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("content", "upload", true, "files", "upload_session/append", headers, content) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + return + } + if resp.StatusCode == http.StatusConflict { + var apiError UploadSessionAppendAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//UploadSessionAppendV2APIError is an error-wrapper for the upload_session/append_v2 route +type UploadSessionAppendV2APIError struct { + dropbox.APIError + EndpointError *UploadSessionLookupError `json:"error"` +} + +func (dbx *apiImpl) UploadSessionAppendV2(arg *UploadSessionAppendArg, content io.Reader) (err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/octet-stream", + "Dropbox-API-Arg": string(b), + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("content", "upload", true, "files", "upload_session/append_v2", headers, content) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + return + } + if resp.StatusCode == http.StatusConflict { + var apiError UploadSessionAppendV2APIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//UploadSessionFinishAPIError is an error-wrapper for the upload_session/finish route +type UploadSessionFinishAPIError struct { + dropbox.APIError + EndpointError *UploadSessionFinishError `json:"error"` +} + +func (dbx *apiImpl) UploadSessionFinish(arg *UploadSessionFinishArg, content io.Reader) (res *FileMetadata, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/octet-stream", + "Dropbox-API-Arg": string(b), + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("content", "upload", true, "files", "upload_session/finish", headers, content) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError UploadSessionFinishAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//UploadSessionFinishBatchAPIError is an error-wrapper for the upload_session/finish_batch route +type UploadSessionFinishBatchAPIError struct { + dropbox.APIError + EndpointError struct{} `json:"error"` +} + +func (dbx *apiImpl) UploadSessionFinishBatch(arg *UploadSessionFinishBatchArg) (res *UploadSessionFinishBatchLaunch, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "upload_session/finish_batch", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError UploadSessionFinishBatchAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//UploadSessionFinishBatchCheckAPIError is an error-wrapper for the upload_session/finish_batch/check route +type UploadSessionFinishBatchCheckAPIError struct { + dropbox.APIError + EndpointError *async.PollError `json:"error"` +} + +func (dbx *apiImpl) UploadSessionFinishBatchCheck(arg *async.PollArg) (res *UploadSessionFinishBatchJobStatus, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "upload_session/finish_batch/check", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError UploadSessionFinishBatchCheckAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//UploadSessionStartAPIError is an error-wrapper for the upload_session/start route +type UploadSessionStartAPIError struct { + dropbox.APIError + EndpointError struct{} `json:"error"` +} + +func (dbx *apiImpl) UploadSessionStart(arg *UploadSessionStartArg, content io.Reader) (res *UploadSessionStartResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/octet-stream", + "Dropbox-API-Arg": string(b), + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("content", "upload", true, "files", "upload_session/start", headers, content) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError UploadSessionStartAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +// New returns a Client implementation for this namespace +func New(c dropbox.Config) *apiImpl { + ctx := apiImpl(dropbox.NewContext(c)) + return &ctx +} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/metadata.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/metadata.go new file mode 100644 index 000000000..d2346b4f5 --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/metadata.go @@ -0,0 +1,99 @@ +// Copyright (c) Dropbox, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package files + +import "encoding/json" + +type listFolderResult struct { + Entries []metadataUnion `json:"entries"` + Cursor string `json:"cursor"` + HasMore bool `json:"has_more"` +} + +// UnmarshalJSON deserializes into a ListFolderResult instance +func (r *ListFolderResult) UnmarshalJSON(b []byte) error { + var l listFolderResult + if err := json.Unmarshal(b, &l); err != nil { + return err + } + r.Cursor = l.Cursor + r.HasMore = l.HasMore + r.Entries = make([]IsMetadata, len(l.Entries)) + for i, e := range l.Entries { + switch e.Tag { + case "file": + r.Entries[i] = e.File + case "folder": + r.Entries[i] = e.Folder + case "deleted": + r.Entries[i] = e.Deleted + } + } + return nil +} + +type searchMatch struct { + MatchType *SearchMatchType `json:"match_type"` + Metadata metadataUnion `json:"metadata"` +} + +// UnmarshalJSON deserializes into a SearchMatch instance +func (s *SearchMatch) UnmarshalJSON(b []byte) error { + var m searchMatch + if err := json.Unmarshal(b, &m); err != nil { + return err + } + s.MatchType = m.MatchType + e := m.Metadata + switch e.Tag { + case "file": + s.Metadata = e.File + case "folder": + s.Metadata = e.Folder + case "deleted": + s.Metadata = e.Deleted + } + return nil +} + +type deleteResult struct { + FileOpsResult + Metadata metadataUnion `json:"metadata"` +} + +// UnmarshalJSON deserializes into a SearchMatch instance +func (s *DeleteResult) UnmarshalJSON(b []byte) error { + var m deleteResult + if err := json.Unmarshal(b, &m); err != nil { + return err + } + s.FileOpsResult = m.FileOpsResult + e := m.Metadata + switch e.Tag { + case "file": + s.Metadata = e.File + case "folder": + s.Metadata = e.Folder + case "deleted": + s.Metadata = e.Deleted + } + return nil +} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/types.go new file mode 100644 index 000000000..f4bb5af87 --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/types.go @@ -0,0 +1,3053 @@ +// Copyright (c) Dropbox, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package files : This namespace contains endpoints and data types for basic +// file operations. +package files + +import ( + "encoding/json" + "time" + + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/properties" +) + +// PropertiesError : has no documentation (yet) +type PropertiesError struct { + dropbox.Tagged + // Path : has no documentation (yet) + Path *LookupError `json:"path,omitempty"` +} + +// Valid tag values for PropertiesError +const ( + PropertiesErrorPath = "path" +) + +// UnmarshalJSON deserializes into a PropertiesError instance +func (u *PropertiesError) 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 "path": + err = json.Unmarshal(w.Path, &u.Path) + + if err != nil { + return err + } + } + return nil +} + +// InvalidPropertyGroupError : has no documentation (yet) +type InvalidPropertyGroupError struct { + dropbox.Tagged +} + +// Valid tag values for InvalidPropertyGroupError +const ( + InvalidPropertyGroupErrorPropertyFieldTooLarge = "property_field_too_large" + InvalidPropertyGroupErrorDoesNotFitTemplate = "does_not_fit_template" +) + +// AddPropertiesError : has no documentation (yet) +type AddPropertiesError struct { + dropbox.Tagged +} + +// Valid tag values for AddPropertiesError +const ( + AddPropertiesErrorPropertyGroupAlreadyExists = "property_group_already_exists" +) + +// GetMetadataArg : has no documentation (yet) +type GetMetadataArg struct { + // Path : The path of a file or folder on Dropbox. + Path string `json:"path"` + // IncludeMediaInfo : If true, `FileMetadata.media_info` is set for photo + // and video. + IncludeMediaInfo bool `json:"include_media_info"` + // IncludeDeleted : If true, `DeletedMetadata` will be returned for deleted + // file or folder, otherwise `LookupError.not_found` will be returned. + IncludeDeleted bool `json:"include_deleted"` + // IncludeHasExplicitSharedMembers : If true, the results will include a + // flag for each file indicating whether or not that file has any explicit + // members. + IncludeHasExplicitSharedMembers bool `json:"include_has_explicit_shared_members"` +} + +// NewGetMetadataArg returns a new GetMetadataArg instance +func NewGetMetadataArg(Path string) *GetMetadataArg { + s := new(GetMetadataArg) + s.Path = Path + s.IncludeMediaInfo = false + s.IncludeDeleted = false + s.IncludeHasExplicitSharedMembers = false + return s +} + +// AlphaGetMetadataArg : has no documentation (yet) +type AlphaGetMetadataArg struct { + GetMetadataArg + // IncludePropertyTemplates : If set to a valid list of template IDs, + // `FileMetadata.property_groups` is set for files with custom properties. + IncludePropertyTemplates []string `json:"include_property_templates,omitempty"` +} + +// NewAlphaGetMetadataArg returns a new AlphaGetMetadataArg instance +func NewAlphaGetMetadataArg(Path string) *AlphaGetMetadataArg { + s := new(AlphaGetMetadataArg) + s.Path = Path + s.IncludeMediaInfo = false + s.IncludeDeleted = false + s.IncludeHasExplicitSharedMembers = false + return s +} + +// GetMetadataError : has no documentation (yet) +type GetMetadataError struct { + dropbox.Tagged + // Path : has no documentation (yet) + Path *LookupError `json:"path,omitempty"` +} + +// Valid tag values for GetMetadataError +const ( + GetMetadataErrorPath = "path" +) + +// UnmarshalJSON deserializes into a GetMetadataError instance +func (u *GetMetadataError) 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 "path": + err = json.Unmarshal(w.Path, &u.Path) + + if err != nil { + return err + } + } + return nil +} + +// AlphaGetMetadataError : has no documentation (yet) +type AlphaGetMetadataError struct { + dropbox.Tagged + // PropertiesError : has no documentation (yet) + PropertiesError *LookUpPropertiesError `json:"properties_error,omitempty"` +} + +// Valid tag values for AlphaGetMetadataError +const ( + AlphaGetMetadataErrorPropertiesError = "properties_error" +) + +// UnmarshalJSON deserializes into a AlphaGetMetadataError instance +func (u *AlphaGetMetadataError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // PropertiesError : has no documentation (yet) + PropertiesError json.RawMessage `json:"properties_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 "properties_error": + err = json.Unmarshal(w.PropertiesError, &u.PropertiesError) + + if err != nil { + return err + } + } + return nil +} + +// CommitInfo : has no documentation (yet) +type CommitInfo struct { + // Path : Path in the user's Dropbox to save the file. + Path string `json:"path"` + // Mode : Selects what to do if the file already exists. + Mode *WriteMode `json:"mode"` + // Autorename : If there's a conflict, as determined by `mode`, have the + // Dropbox server try to autorename the file to avoid conflict. + Autorename bool `json:"autorename"` + // ClientModified : The value to store as the `client_modified` timestamp. + // Dropbox automatically records the time at which the file was written to + // the Dropbox servers. It can also record an additional timestamp, provided + // by Dropbox desktop clients, mobile clients, and API apps of when the file + // was actually created or modified. + ClientModified time.Time `json:"client_modified,omitempty"` + // Mute : Normally, users are made aware of any file modifications in their + // Dropbox account via notifications in the client software. If true, this + // tells the clients that this modification shouldn't result in a user + // notification. + Mute bool `json:"mute"` +} + +// NewCommitInfo returns a new CommitInfo instance +func NewCommitInfo(Path string) *CommitInfo { + s := new(CommitInfo) + s.Path = Path + s.Mode = &WriteMode{Tagged: dropbox.Tagged{"add"}} + s.Autorename = false + s.Mute = false + return s +} + +// CommitInfoWithProperties : has no documentation (yet) +type CommitInfoWithProperties struct { + CommitInfo + // PropertyGroups : List of custom properties to add to file. + PropertyGroups []*properties.PropertyGroup `json:"property_groups,omitempty"` +} + +// NewCommitInfoWithProperties returns a new CommitInfoWithProperties instance +func NewCommitInfoWithProperties(Path string) *CommitInfoWithProperties { + s := new(CommitInfoWithProperties) + s.Path = Path + s.Mode = &WriteMode{Tagged: dropbox.Tagged{"add"}} + s.Autorename = false + s.Mute = false + return s +} + +// CreateFolderArg : has no documentation (yet) +type CreateFolderArg struct { + // Path : Path in the user's Dropbox to create. + Path string `json:"path"` + // Autorename : If there's a conflict, have the Dropbox server try to + // autorename the folder to avoid the conflict. + Autorename bool `json:"autorename"` +} + +// NewCreateFolderArg returns a new CreateFolderArg instance +func NewCreateFolderArg(Path string) *CreateFolderArg { + s := new(CreateFolderArg) + s.Path = Path + s.Autorename = false + return s +} + +// CreateFolderError : has no documentation (yet) +type CreateFolderError struct { + dropbox.Tagged + // Path : has no documentation (yet) + Path *WriteError `json:"path,omitempty"` +} + +// Valid tag values for CreateFolderError +const ( + CreateFolderErrorPath = "path" +) + +// UnmarshalJSON deserializes into a CreateFolderError instance +func (u *CreateFolderError) 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 "path": + err = json.Unmarshal(w.Path, &u.Path) + + if err != nil { + return err + } + } + return nil +} + +// FileOpsResult : has no documentation (yet) +type FileOpsResult struct { +} + +// NewFileOpsResult returns a new FileOpsResult instance +func NewFileOpsResult() *FileOpsResult { + s := new(FileOpsResult) + return s +} + +// CreateFolderResult : has no documentation (yet) +type CreateFolderResult struct { + FileOpsResult + // Metadata : Metadata of the created folder. + Metadata *FolderMetadata `json:"metadata"` +} + +// NewCreateFolderResult returns a new CreateFolderResult instance +func NewCreateFolderResult(Metadata *FolderMetadata) *CreateFolderResult { + s := new(CreateFolderResult) + s.Metadata = Metadata + return s +} + +// DeleteArg : has no documentation (yet) +type DeleteArg struct { + // Path : Path in the user's Dropbox to delete. + Path string `json:"path"` +} + +// NewDeleteArg returns a new DeleteArg instance +func NewDeleteArg(Path string) *DeleteArg { + s := new(DeleteArg) + s.Path = Path + return s +} + +// DeleteBatchArg : has no documentation (yet) +type DeleteBatchArg struct { + // Entries : has no documentation (yet) + Entries []*DeleteArg `json:"entries"` +} + +// NewDeleteBatchArg returns a new DeleteBatchArg instance +func NewDeleteBatchArg(Entries []*DeleteArg) *DeleteBatchArg { + s := new(DeleteBatchArg) + s.Entries = Entries + return s +} + +// DeleteBatchError : has no documentation (yet) +type DeleteBatchError struct { + dropbox.Tagged +} + +// Valid tag values for DeleteBatchError +const ( + DeleteBatchErrorTooManyWriteOperations = "too_many_write_operations" + DeleteBatchErrorOther = "other" +) + +// DeleteBatchJobStatus : has no documentation (yet) +type DeleteBatchJobStatus struct { + dropbox.Tagged + // Complete : The batch delete has finished. + Complete *DeleteBatchResult `json:"complete,omitempty"` + // Failed : The batch delete has failed. + Failed *DeleteBatchError `json:"failed,omitempty"` +} + +// Valid tag values for DeleteBatchJobStatus +const ( + DeleteBatchJobStatusComplete = "complete" + DeleteBatchJobStatusFailed = "failed" + DeleteBatchJobStatusOther = "other" +) + +// UnmarshalJSON deserializes into a DeleteBatchJobStatus instance +func (u *DeleteBatchJobStatus) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Complete : The batch delete has finished. + Complete json.RawMessage `json:"complete,omitempty"` + // Failed : The batch delete has failed. + Failed json.RawMessage `json:"failed,omitempty"` + } + var w wrap + var err error + if err = json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "complete": + err = json.Unmarshal(body, &u.Complete) + + if err != nil { + return err + } + case "failed": + err = json.Unmarshal(w.Failed, &u.Failed) + + if err != nil { + return err + } + } + return nil +} + +// DeleteBatchLaunch : Result returned by `deleteBatch` that may either launch +// an asynchronous job or complete synchronously. +type DeleteBatchLaunch struct { + dropbox.Tagged + // Complete : has no documentation (yet) + Complete *DeleteBatchResult `json:"complete,omitempty"` +} + +// Valid tag values for DeleteBatchLaunch +const ( + DeleteBatchLaunchComplete = "complete" + DeleteBatchLaunchOther = "other" +) + +// UnmarshalJSON deserializes into a DeleteBatchLaunch instance +func (u *DeleteBatchLaunch) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Complete : has no documentation (yet) + Complete json.RawMessage `json:"complete,omitempty"` + } + var w wrap + var err error + if err = json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "complete": + err = json.Unmarshal(body, &u.Complete) + + if err != nil { + return err + } + } + return nil +} + +// DeleteBatchResult : has no documentation (yet) +type DeleteBatchResult struct { + FileOpsResult + // Entries : has no documentation (yet) + Entries []*DeleteBatchResultEntry `json:"entries"` +} + +// NewDeleteBatchResult returns a new DeleteBatchResult instance +func NewDeleteBatchResult(Entries []*DeleteBatchResultEntry) *DeleteBatchResult { + s := new(DeleteBatchResult) + s.Entries = Entries + return s +} + +// DeleteBatchResultData : has no documentation (yet) +type DeleteBatchResultData struct { + // Metadata : Metadata of the deleted object. + Metadata IsMetadata `json:"metadata"` +} + +// NewDeleteBatchResultData returns a new DeleteBatchResultData instance +func NewDeleteBatchResultData(Metadata IsMetadata) *DeleteBatchResultData { + s := new(DeleteBatchResultData) + s.Metadata = Metadata + return s +} + +// DeleteBatchResultEntry : has no documentation (yet) +type DeleteBatchResultEntry struct { + dropbox.Tagged + // Success : has no documentation (yet) + Success *DeleteBatchResultData `json:"success,omitempty"` + // Failure : has no documentation (yet) + Failure *DeleteError `json:"failure,omitempty"` +} + +// Valid tag values for DeleteBatchResultEntry +const ( + DeleteBatchResultEntrySuccess = "success" + DeleteBatchResultEntryFailure = "failure" +) + +// UnmarshalJSON deserializes into a DeleteBatchResultEntry instance +func (u *DeleteBatchResultEntry) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Success : has no documentation (yet) + Success json.RawMessage `json:"success,omitempty"` + // Failure : has no documentation (yet) + Failure json.RawMessage `json:"failure,omitempty"` + } + var w wrap + var err error + if err = json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "success": + err = json.Unmarshal(body, &u.Success) + + if err != nil { + return err + } + case "failure": + err = json.Unmarshal(w.Failure, &u.Failure) + + if err != nil { + return err + } + } + return nil +} + +// DeleteError : has no documentation (yet) +type DeleteError struct { + dropbox.Tagged + // PathLookup : has no documentation (yet) + PathLookup *LookupError `json:"path_lookup,omitempty"` + // PathWrite : has no documentation (yet) + PathWrite *WriteError `json:"path_write,omitempty"` +} + +// Valid tag values for DeleteError +const ( + DeleteErrorPathLookup = "path_lookup" + DeleteErrorPathWrite = "path_write" + DeleteErrorTooManyWriteOperations = "too_many_write_operations" + DeleteErrorTooManyFiles = "too_many_files" + DeleteErrorOther = "other" +) + +// UnmarshalJSON deserializes into a DeleteError instance +func (u *DeleteError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // PathLookup : has no documentation (yet) + PathLookup json.RawMessage `json:"path_lookup,omitempty"` + // PathWrite : has no documentation (yet) + PathWrite json.RawMessage `json:"path_write,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 "path_lookup": + err = json.Unmarshal(w.PathLookup, &u.PathLookup) + + if err != nil { + return err + } + case "path_write": + err = json.Unmarshal(w.PathWrite, &u.PathWrite) + + if err != nil { + return err + } + } + return nil +} + +// DeleteResult : has no documentation (yet) +type DeleteResult struct { + FileOpsResult + // Metadata : Metadata of the deleted object. + Metadata IsMetadata `json:"metadata"` +} + +// NewDeleteResult returns a new DeleteResult instance +func NewDeleteResult(Metadata IsMetadata) *DeleteResult { + s := new(DeleteResult) + s.Metadata = Metadata + return s +} + +// Metadata : Metadata for a file or folder. +type Metadata struct { + // Name : The last component of the path (including extension). This never + // contains a slash. + Name string `json:"name"` + // PathLower : The lowercased full path in the user's Dropbox. This always + // starts with a slash. This field will be null if the file or folder is not + // mounted. + PathLower string `json:"path_lower,omitempty"` + // PathDisplay : The cased path to be used for display purposes only. In + // rare instances the casing will not correctly match the user's filesystem, + // but this behavior will match the path provided in the Core API v1, and at + // least the last path component will have the correct casing. Changes to + // only the casing of paths won't be returned by `listFolderContinue`. This + // field will be null if the file or folder is not mounted. + PathDisplay string `json:"path_display,omitempty"` + // ParentSharedFolderId : Deprecated. Please use + // `FileSharingInfo.parent_shared_folder_id` or + // `FolderSharingInfo.parent_shared_folder_id` instead. + ParentSharedFolderId string `json:"parent_shared_folder_id,omitempty"` +} + +// NewMetadata returns a new Metadata instance +func NewMetadata(Name string) *Metadata { + s := new(Metadata) + s.Name = Name + return s +} + +// IsMetadata is the interface type for Metadata and its subtypes +type IsMetadata interface { + IsMetadata() +} + +// IsMetadata implements the IsMetadata interface +func (u *Metadata) IsMetadata() {} + +type metadataUnion struct { + dropbox.Tagged + // File : has no documentation (yet) + File *FileMetadata `json:"file,omitempty"` + // Folder : has no documentation (yet) + Folder *FolderMetadata `json:"folder,omitempty"` + // Deleted : has no documentation (yet) + Deleted *DeletedMetadata `json:"deleted,omitempty"` +} + +// Valid tag values for Metadata +const ( + MetadataFile = "file" + MetadataFolder = "folder" + MetadataDeleted = "deleted" +) + +// UnmarshalJSON deserializes into a metadataUnion instance +func (u *metadataUnion) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // File : has no documentation (yet) + File json.RawMessage `json:"file,omitempty"` + // Folder : has no documentation (yet) + Folder json.RawMessage `json:"folder,omitempty"` + // Deleted : has no documentation (yet) + Deleted json.RawMessage `json:"deleted,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 "file": + err = json.Unmarshal(body, &u.File) + + if err != nil { + return err + } + case "folder": + err = json.Unmarshal(body, &u.Folder) + + if err != nil { + return err + } + case "deleted": + err = json.Unmarshal(body, &u.Deleted) + + if err != nil { + return err + } + } + return nil +} + +// IsMetadataFromJSON converts JSON to a concrete IsMetadata instance +func IsMetadataFromJSON(data []byte) (IsMetadata, error) { + var t metadataUnion + if err := json.Unmarshal(data, &t); err != nil { + return nil, err + } + switch t.Tag { + case "file": + return t.File, nil + + case "folder": + return t.Folder, nil + + case "deleted": + return t.Deleted, nil + + } + return nil, nil +} + +// DeletedMetadata : Indicates that there used to be a file or folder at this +// path, but it no longer exists. +type DeletedMetadata struct { + Metadata +} + +// NewDeletedMetadata returns a new DeletedMetadata instance +func NewDeletedMetadata(Name string) *DeletedMetadata { + s := new(DeletedMetadata) + s.Name = Name + return s +} + +// Dimensions : Dimensions for a photo or video. +type Dimensions struct { + // Height : Height of the photo/video. + Height uint64 `json:"height"` + // Width : Width of the photo/video. + Width uint64 `json:"width"` +} + +// NewDimensions returns a new Dimensions instance +func NewDimensions(Height uint64, Width uint64) *Dimensions { + s := new(Dimensions) + s.Height = Height + s.Width = Width + return s +} + +// DownloadArg : has no documentation (yet) +type DownloadArg struct { + // Path : The path of the file to download. + Path string `json:"path"` + // Rev : Deprecated. Please specify revision in `path` instead. + Rev string `json:"rev,omitempty"` + // ExtraHeaders can be used to pass Range, If-None-Match headers + ExtraHeaders map[string]string `json:"-"` +} + +// NewDownloadArg returns a new DownloadArg instance +func NewDownloadArg(Path string) *DownloadArg { + s := new(DownloadArg) + s.Path = Path + return s +} + +// DownloadError : has no documentation (yet) +type DownloadError struct { + dropbox.Tagged + // Path : has no documentation (yet) + Path *LookupError `json:"path,omitempty"` +} + +// Valid tag values for DownloadError +const ( + DownloadErrorPath = "path" + DownloadErrorOther = "other" +) + +// UnmarshalJSON deserializes into a DownloadError instance +func (u *DownloadError) 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 "path": + err = json.Unmarshal(w.Path, &u.Path) + + if err != nil { + return err + } + } + return nil +} + +// FileMetadata : has no documentation (yet) +type FileMetadata struct { + Metadata + // Id : A unique identifier for the file. + Id string `json:"id"` + // ClientModified : For files, this is the modification time set by the + // desktop client when the file was added to Dropbox. Since this time is not + // verified (the Dropbox server stores whatever the desktop client sends + // up), this should only be used for display purposes (such as sorting) and + // not, for example, to determine if a file has changed or not. + ClientModified time.Time `json:"client_modified"` + // ServerModified : The last time the file was modified on Dropbox. + ServerModified time.Time `json:"server_modified"` + // Rev : A unique identifier for the current revision of a file. This field + // is the same rev as elsewhere in the API and can be used to detect changes + // and avoid conflicts. + Rev string `json:"rev"` + // Size : The file size in bytes. + Size uint64 `json:"size"` + // MediaInfo : Additional information if the file is a photo or video. + MediaInfo *MediaInfo `json:"media_info,omitempty"` + // SharingInfo : Set if this file is contained in a shared folder. + SharingInfo *FileSharingInfo `json:"sharing_info,omitempty"` + // PropertyGroups : Additional information if the file has custom properties + // with the property template specified. + PropertyGroups []*properties.PropertyGroup `json:"property_groups,omitempty"` + // HasExplicitSharedMembers : This flag will only be present if + // include_has_explicit_shared_members is true in `listFolder` or + // `getMetadata`. If this flag is present, it will be true if this file has + // any explicit shared members. This is different from sharing_info in that + // this could be true in the case where a file has explicit members but is + // not contained within a shared folder. + HasExplicitSharedMembers bool `json:"has_explicit_shared_members,omitempty"` + // ContentHash : A hash of the file content. This field can be used to + // verify data integrity. For more information see our `Content hash` + // page. + ContentHash string `json:"content_hash,omitempty"` +} + +// NewFileMetadata returns a new FileMetadata instance +func NewFileMetadata(Name string, Id string, ClientModified time.Time, ServerModified time.Time, Rev string, Size uint64) *FileMetadata { + s := new(FileMetadata) + s.Name = Name + s.Id = Id + s.ClientModified = ClientModified + s.ServerModified = ServerModified + s.Rev = Rev + s.Size = Size + return s +} + +// SharingInfo : Sharing info for a file or folder. +type SharingInfo struct { + // ReadOnly : True if the file or folder is inside a read-only shared + // folder. + ReadOnly bool `json:"read_only"` +} + +// NewSharingInfo returns a new SharingInfo instance +func NewSharingInfo(ReadOnly bool) *SharingInfo { + s := new(SharingInfo) + s.ReadOnly = ReadOnly + return s +} + +// FileSharingInfo : Sharing info for a file which is contained by a shared +// folder. +type FileSharingInfo struct { + SharingInfo + // ParentSharedFolderId : ID of shared folder that holds this file. + ParentSharedFolderId string `json:"parent_shared_folder_id"` + // ModifiedBy : The last user who modified the file. This field will be null + // if the user's account has been deleted. + ModifiedBy string `json:"modified_by,omitempty"` +} + +// NewFileSharingInfo returns a new FileSharingInfo instance +func NewFileSharingInfo(ReadOnly bool, ParentSharedFolderId string) *FileSharingInfo { + s := new(FileSharingInfo) + s.ReadOnly = ReadOnly + s.ParentSharedFolderId = ParentSharedFolderId + return s +} + +// FolderMetadata : has no documentation (yet) +type FolderMetadata struct { + Metadata + // Id : A unique identifier for the folder. + Id string `json:"id"` + // SharedFolderId : Deprecated. Please use `sharing_info` instead. + SharedFolderId string `json:"shared_folder_id,omitempty"` + // SharingInfo : Set if the folder is contained in a shared folder or is a + // shared folder mount point. + SharingInfo *FolderSharingInfo `json:"sharing_info,omitempty"` + // PropertyGroups : Additional information if the file has custom properties + // with the property template specified. + PropertyGroups []*properties.PropertyGroup `json:"property_groups,omitempty"` +} + +// NewFolderMetadata returns a new FolderMetadata instance +func NewFolderMetadata(Name string, Id string) *FolderMetadata { + s := new(FolderMetadata) + s.Name = Name + s.Id = Id + return s +} + +// FolderSharingInfo : Sharing info for a folder which is contained in a shared +// folder or is a shared folder mount point. +type FolderSharingInfo struct { + SharingInfo + // ParentSharedFolderId : Set if the folder is contained by a shared folder. + ParentSharedFolderId string `json:"parent_shared_folder_id,omitempty"` + // SharedFolderId : If this folder is a shared folder mount point, the ID of + // the shared folder mounted at this location. + SharedFolderId string `json:"shared_folder_id,omitempty"` + // TraverseOnly : Specifies that the folder can only be traversed and the + // user can only see a limited subset of the contents of this folder because + // they don't have read access to this folder. They do, however, have access + // to some sub folder. + TraverseOnly bool `json:"traverse_only"` + // NoAccess : Specifies that the folder cannot be accessed by the user. + NoAccess bool `json:"no_access"` +} + +// NewFolderSharingInfo returns a new FolderSharingInfo instance +func NewFolderSharingInfo(ReadOnly bool) *FolderSharingInfo { + s := new(FolderSharingInfo) + s.ReadOnly = ReadOnly + s.TraverseOnly = false + s.NoAccess = false + return s +} + +// GetCopyReferenceArg : has no documentation (yet) +type GetCopyReferenceArg struct { + // Path : The path to the file or folder you want to get a copy reference + // to. + Path string `json:"path"` +} + +// NewGetCopyReferenceArg returns a new GetCopyReferenceArg instance +func NewGetCopyReferenceArg(Path string) *GetCopyReferenceArg { + s := new(GetCopyReferenceArg) + s.Path = Path + return s +} + +// GetCopyReferenceError : has no documentation (yet) +type GetCopyReferenceError struct { + dropbox.Tagged + // Path : has no documentation (yet) + Path *LookupError `json:"path,omitempty"` +} + +// Valid tag values for GetCopyReferenceError +const ( + GetCopyReferenceErrorPath = "path" + GetCopyReferenceErrorOther = "other" +) + +// UnmarshalJSON deserializes into a GetCopyReferenceError instance +func (u *GetCopyReferenceError) 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 "path": + err = json.Unmarshal(w.Path, &u.Path) + + if err != nil { + return err + } + } + return nil +} + +// GetCopyReferenceResult : has no documentation (yet) +type GetCopyReferenceResult struct { + // Metadata : Metadata of the file or folder. + Metadata IsMetadata `json:"metadata"` + // CopyReference : A copy reference to the file or folder. + CopyReference string `json:"copy_reference"` + // Expires : The expiration date of the copy reference. This value is + // currently set to be far enough in the future so that expiration is + // effectively not an issue. + Expires time.Time `json:"expires"` +} + +// NewGetCopyReferenceResult returns a new GetCopyReferenceResult instance +func NewGetCopyReferenceResult(Metadata IsMetadata, CopyReference string, Expires time.Time) *GetCopyReferenceResult { + s := new(GetCopyReferenceResult) + s.Metadata = Metadata + s.CopyReference = CopyReference + s.Expires = Expires + return s +} + +// GetTemporaryLinkArg : has no documentation (yet) +type GetTemporaryLinkArg struct { + // Path : The path to the file you want a temporary link to. + Path string `json:"path"` +} + +// NewGetTemporaryLinkArg returns a new GetTemporaryLinkArg instance +func NewGetTemporaryLinkArg(Path string) *GetTemporaryLinkArg { + s := new(GetTemporaryLinkArg) + s.Path = Path + return s +} + +// GetTemporaryLinkError : has no documentation (yet) +type GetTemporaryLinkError struct { + dropbox.Tagged + // Path : has no documentation (yet) + Path *LookupError `json:"path,omitempty"` +} + +// Valid tag values for GetTemporaryLinkError +const ( + GetTemporaryLinkErrorPath = "path" + GetTemporaryLinkErrorOther = "other" +) + +// UnmarshalJSON deserializes into a GetTemporaryLinkError instance +func (u *GetTemporaryLinkError) 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 "path": + err = json.Unmarshal(w.Path, &u.Path) + + if err != nil { + return err + } + } + return nil +} + +// GetTemporaryLinkResult : has no documentation (yet) +type GetTemporaryLinkResult struct { + // Metadata : Metadata of the file. + Metadata *FileMetadata `json:"metadata"` + // Link : The temporary link which can be used to stream content the file. + Link string `json:"link"` +} + +// NewGetTemporaryLinkResult returns a new GetTemporaryLinkResult instance +func NewGetTemporaryLinkResult(Metadata *FileMetadata, Link string) *GetTemporaryLinkResult { + s := new(GetTemporaryLinkResult) + s.Metadata = Metadata + s.Link = Link + return s +} + +// GpsCoordinates : GPS coordinates for a photo or video. +type GpsCoordinates struct { + // Latitude : Latitude of the GPS coordinates. + Latitude float64 `json:"latitude"` + // Longitude : Longitude of the GPS coordinates. + Longitude float64 `json:"longitude"` +} + +// NewGpsCoordinates returns a new GpsCoordinates instance +func NewGpsCoordinates(Latitude float64, Longitude float64) *GpsCoordinates { + s := new(GpsCoordinates) + s.Latitude = Latitude + s.Longitude = Longitude + return s +} + +// ListFolderArg : has no documentation (yet) +type ListFolderArg struct { + // Path : A unique identifier for the file. + Path string `json:"path"` + // Recursive : If true, the list folder operation will be applied + // recursively to all subfolders and the response will contain contents of + // all subfolders. + Recursive bool `json:"recursive"` + // IncludeMediaInfo : If true, `FileMetadata.media_info` is set for photo + // and video. + IncludeMediaInfo bool `json:"include_media_info"` + // IncludeDeleted : If true, the results will include entries for files and + // folders that used to exist but were deleted. + IncludeDeleted bool `json:"include_deleted"` + // IncludeHasExplicitSharedMembers : If true, the results will include a + // flag for each file indicating whether or not that file has any explicit + // members. + IncludeHasExplicitSharedMembers bool `json:"include_has_explicit_shared_members"` +} + +// NewListFolderArg returns a new ListFolderArg instance +func NewListFolderArg(Path string) *ListFolderArg { + s := new(ListFolderArg) + s.Path = Path + s.Recursive = false + s.IncludeMediaInfo = false + s.IncludeDeleted = false + s.IncludeHasExplicitSharedMembers = false + return s +} + +// ListFolderContinueArg : has no documentation (yet) +type ListFolderContinueArg struct { + // Cursor : The cursor returned by your last call to `listFolder` or + // `listFolderContinue`. + Cursor string `json:"cursor"` +} + +// NewListFolderContinueArg returns a new ListFolderContinueArg instance +func NewListFolderContinueArg(Cursor string) *ListFolderContinueArg { + s := new(ListFolderContinueArg) + s.Cursor = Cursor + return s +} + +// ListFolderContinueError : has no documentation (yet) +type ListFolderContinueError struct { + dropbox.Tagged + // Path : has no documentation (yet) + Path *LookupError `json:"path,omitempty"` +} + +// Valid tag values for ListFolderContinueError +const ( + ListFolderContinueErrorPath = "path" + ListFolderContinueErrorReset = "reset" + ListFolderContinueErrorOther = "other" +) + +// UnmarshalJSON deserializes into a ListFolderContinueError instance +func (u *ListFolderContinueError) 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 "path": + err = json.Unmarshal(w.Path, &u.Path) + + if err != nil { + return err + } + } + return nil +} + +// ListFolderError : has no documentation (yet) +type ListFolderError struct { + dropbox.Tagged + // Path : has no documentation (yet) + Path *LookupError `json:"path,omitempty"` +} + +// Valid tag values for ListFolderError +const ( + ListFolderErrorPath = "path" + ListFolderErrorOther = "other" +) + +// UnmarshalJSON deserializes into a ListFolderError instance +func (u *ListFolderError) 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 "path": + err = json.Unmarshal(w.Path, &u.Path) + + if err != nil { + return err + } + } + return nil +} + +// ListFolderGetLatestCursorResult : has no documentation (yet) +type ListFolderGetLatestCursorResult struct { + // Cursor : Pass the cursor into `listFolderContinue` to see what's changed + // in the folder since your previous query. + Cursor string `json:"cursor"` +} + +// NewListFolderGetLatestCursorResult returns a new ListFolderGetLatestCursorResult instance +func NewListFolderGetLatestCursorResult(Cursor string) *ListFolderGetLatestCursorResult { + s := new(ListFolderGetLatestCursorResult) + s.Cursor = Cursor + return s +} + +// ListFolderLongpollArg : has no documentation (yet) +type ListFolderLongpollArg struct { + // Cursor : A cursor as returned by `listFolder` or `listFolderContinue`. + // Cursors retrieved by setting `ListFolderArg.include_media_info` to true + // are not supported. + Cursor string `json:"cursor"` + // Timeout : A timeout in seconds. The request will block for at most this + // length of time, plus up to 90 seconds of random jitter added to avoid the + // thundering herd problem. Care should be taken when using this parameter, + // as some network infrastructure does not support long timeouts. + Timeout uint64 `json:"timeout"` +} + +// NewListFolderLongpollArg returns a new ListFolderLongpollArg instance +func NewListFolderLongpollArg(Cursor string) *ListFolderLongpollArg { + s := new(ListFolderLongpollArg) + s.Cursor = Cursor + s.Timeout = 30 + return s +} + +// ListFolderLongpollError : has no documentation (yet) +type ListFolderLongpollError struct { + dropbox.Tagged +} + +// Valid tag values for ListFolderLongpollError +const ( + ListFolderLongpollErrorReset = "reset" + ListFolderLongpollErrorOther = "other" +) + +// ListFolderLongpollResult : has no documentation (yet) +type ListFolderLongpollResult struct { + // Changes : Indicates whether new changes are available. If true, call + // `listFolderContinue` to retrieve the changes. + Changes bool `json:"changes"` + // Backoff : If present, backoff for at least this many seconds before + // calling `listFolderLongpoll` again. + Backoff uint64 `json:"backoff,omitempty"` +} + +// NewListFolderLongpollResult returns a new ListFolderLongpollResult instance +func NewListFolderLongpollResult(Changes bool) *ListFolderLongpollResult { + s := new(ListFolderLongpollResult) + s.Changes = Changes + return s +} + +// ListFolderResult : has no documentation (yet) +type ListFolderResult struct { + // Entries : The files and (direct) subfolders in the folder. + Entries []IsMetadata `json:"entries"` + // Cursor : Pass the cursor into `listFolderContinue` to see what's changed + // in the folder since your previous query. + Cursor string `json:"cursor"` + // HasMore : If true, then there are more entries available. Pass the cursor + // to `listFolderContinue` to retrieve the rest. + HasMore bool `json:"has_more"` +} + +// NewListFolderResult returns a new ListFolderResult instance +func NewListFolderResult(Entries []IsMetadata, Cursor string, HasMore bool) *ListFolderResult { + s := new(ListFolderResult) + s.Entries = Entries + s.Cursor = Cursor + s.HasMore = HasMore + return s +} + +// ListRevisionsArg : has no documentation (yet) +type ListRevisionsArg struct { + // Path : The path to the file you want to see the revisions of. + Path string `json:"path"` + // Limit : The maximum number of revision entries returned. + Limit uint64 `json:"limit"` +} + +// NewListRevisionsArg returns a new ListRevisionsArg instance +func NewListRevisionsArg(Path string) *ListRevisionsArg { + s := new(ListRevisionsArg) + s.Path = Path + s.Limit = 10 + return s +} + +// ListRevisionsError : has no documentation (yet) +type ListRevisionsError struct { + dropbox.Tagged + // Path : has no documentation (yet) + Path *LookupError `json:"path,omitempty"` +} + +// Valid tag values for ListRevisionsError +const ( + ListRevisionsErrorPath = "path" + ListRevisionsErrorOther = "other" +) + +// UnmarshalJSON deserializes into a ListRevisionsError instance +func (u *ListRevisionsError) 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 "path": + err = json.Unmarshal(w.Path, &u.Path) + + if err != nil { + return err + } + } + return nil +} + +// ListRevisionsResult : has no documentation (yet) +type ListRevisionsResult struct { + // IsDeleted : If the file is deleted. + IsDeleted bool `json:"is_deleted"` + // ServerDeleted : The time of deletion if the file was deleted. + ServerDeleted time.Time `json:"server_deleted,omitempty"` + // Entries : The revisions for the file. Only revisions that are not deleted + // will show up here. + Entries []*FileMetadata `json:"entries"` +} + +// NewListRevisionsResult returns a new ListRevisionsResult instance +func NewListRevisionsResult(IsDeleted bool, Entries []*FileMetadata) *ListRevisionsResult { + s := new(ListRevisionsResult) + s.IsDeleted = IsDeleted + s.Entries = Entries + return s +} + +// LookUpPropertiesError : has no documentation (yet) +type LookUpPropertiesError struct { + dropbox.Tagged +} + +// Valid tag values for LookUpPropertiesError +const ( + LookUpPropertiesErrorPropertyGroupNotFound = "property_group_not_found" +) + +// LookupError : has no documentation (yet) +type LookupError struct { + dropbox.Tagged + // MalformedPath : has no documentation (yet) + MalformedPath string `json:"malformed_path,omitempty"` +} + +// Valid tag values for LookupError +const ( + LookupErrorMalformedPath = "malformed_path" + LookupErrorNotFound = "not_found" + LookupErrorNotFile = "not_file" + LookupErrorNotFolder = "not_folder" + LookupErrorRestrictedContent = "restricted_content" + LookupErrorOther = "other" +) + +// UnmarshalJSON deserializes into a LookupError instance +func (u *LookupError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // MalformedPath : has no documentation (yet) + MalformedPath json.RawMessage `json:"malformed_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 "malformed_path": + err = json.Unmarshal(body, &u.MalformedPath) + + if err != nil { + return err + } + } + return nil +} + +// MediaInfo : has no documentation (yet) +type MediaInfo struct { + dropbox.Tagged + // Metadata : The metadata for the photo/video. + Metadata IsMediaMetadata `json:"metadata,omitempty"` +} + +// Valid tag values for MediaInfo +const ( + MediaInfoPending = "pending" + MediaInfoMetadata = "metadata" +) + +// UnmarshalJSON deserializes into a MediaInfo instance +func (u *MediaInfo) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Metadata : The metadata for the photo/video. + Metadata json.RawMessage `json:"metadata,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 "metadata": + u.Metadata, err = IsMediaMetadataFromJSON(body) + + if err != nil { + return err + } + } + return nil +} + +// MediaMetadata : Metadata for a photo or video. +type MediaMetadata struct { + // Dimensions : Dimension of the photo/video. + Dimensions *Dimensions `json:"dimensions,omitempty"` + // Location : The GPS coordinate of the photo/video. + Location *GpsCoordinates `json:"location,omitempty"` + // TimeTaken : The timestamp when the photo/video is taken. + TimeTaken time.Time `json:"time_taken,omitempty"` +} + +// NewMediaMetadata returns a new MediaMetadata instance +func NewMediaMetadata() *MediaMetadata { + s := new(MediaMetadata) + return s +} + +// IsMediaMetadata is the interface type for MediaMetadata and its subtypes +type IsMediaMetadata interface { + IsMediaMetadata() +} + +// IsMediaMetadata implements the IsMediaMetadata interface +func (u *MediaMetadata) IsMediaMetadata() {} + +type mediaMetadataUnion struct { + dropbox.Tagged + // Photo : has no documentation (yet) + Photo *PhotoMetadata `json:"photo,omitempty"` + // Video : has no documentation (yet) + Video *VideoMetadata `json:"video,omitempty"` +} + +// Valid tag values for MediaMetadata +const ( + MediaMetadataPhoto = "photo" + MediaMetadataVideo = "video" +) + +// UnmarshalJSON deserializes into a mediaMetadataUnion instance +func (u *mediaMetadataUnion) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Photo : has no documentation (yet) + Photo json.RawMessage `json:"photo,omitempty"` + // Video : has no documentation (yet) + Video json.RawMessage `json:"video,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 "photo": + err = json.Unmarshal(body, &u.Photo) + + if err != nil { + return err + } + case "video": + err = json.Unmarshal(body, &u.Video) + + if err != nil { + return err + } + } + return nil +} + +// IsMediaMetadataFromJSON converts JSON to a concrete IsMediaMetadata instance +func IsMediaMetadataFromJSON(data []byte) (IsMediaMetadata, error) { + var t mediaMetadataUnion + if err := json.Unmarshal(data, &t); err != nil { + return nil, err + } + switch t.Tag { + case "photo": + return t.Photo, nil + + case "video": + return t.Video, nil + + } + return nil, nil +} + +// PhotoMetadata : Metadata for a photo. +type PhotoMetadata struct { + MediaMetadata +} + +// NewPhotoMetadata returns a new PhotoMetadata instance +func NewPhotoMetadata() *PhotoMetadata { + s := new(PhotoMetadata) + return s +} + +// PreviewArg : has no documentation (yet) +type PreviewArg struct { + // Path : The path of the file to preview. + Path string `json:"path"` + // Rev : Deprecated. Please specify revision in `path` instead. + Rev string `json:"rev,omitempty"` +} + +// NewPreviewArg returns a new PreviewArg instance +func NewPreviewArg(Path string) *PreviewArg { + s := new(PreviewArg) + s.Path = Path + return s +} + +// PreviewError : has no documentation (yet) +type PreviewError struct { + dropbox.Tagged + // Path : An error occurs when downloading metadata for the file. + Path *LookupError `json:"path,omitempty"` +} + +// Valid tag values for PreviewError +const ( + PreviewErrorPath = "path" + PreviewErrorInProgress = "in_progress" + PreviewErrorUnsupportedExtension = "unsupported_extension" + PreviewErrorUnsupportedContent = "unsupported_content" +) + +// UnmarshalJSON deserializes into a PreviewError instance +func (u *PreviewError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Path : An error occurs when downloading metadata for the file. + 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 "path": + err = json.Unmarshal(w.Path, &u.Path) + + if err != nil { + return err + } + } + return nil +} + +// PropertyGroupUpdate : has no documentation (yet) +type PropertyGroupUpdate struct { + // TemplateId : A unique identifier for a property template. + TemplateId string `json:"template_id"` + // AddOrUpdateFields : List of property fields to update if the field + // already exists. If the field doesn't exist, add the field to the property + // group. + AddOrUpdateFields []*properties.PropertyField `json:"add_or_update_fields,omitempty"` + // RemoveFields : List of property field names to remove from property group + // if the field exists. + RemoveFields []string `json:"remove_fields,omitempty"` +} + +// NewPropertyGroupUpdate returns a new PropertyGroupUpdate instance +func NewPropertyGroupUpdate(TemplateId string) *PropertyGroupUpdate { + s := new(PropertyGroupUpdate) + s.TemplateId = TemplateId + return s +} + +// PropertyGroupWithPath : has no documentation (yet) +type PropertyGroupWithPath struct { + // Path : A unique identifier for the file. + Path string `json:"path"` + // PropertyGroups : Filled custom property templates associated with a file. + PropertyGroups []*properties.PropertyGroup `json:"property_groups"` +} + +// NewPropertyGroupWithPath returns a new PropertyGroupWithPath instance +func NewPropertyGroupWithPath(Path string, PropertyGroups []*properties.PropertyGroup) *PropertyGroupWithPath { + s := new(PropertyGroupWithPath) + s.Path = Path + s.PropertyGroups = PropertyGroups + return s +} + +// RelocationPath : has no documentation (yet) +type RelocationPath struct { + // FromPath : Path in the user's Dropbox to be copied or moved. + FromPath string `json:"from_path"` + // ToPath : Path in the user's Dropbox that is the destination. + ToPath string `json:"to_path"` +} + +// NewRelocationPath returns a new RelocationPath instance +func NewRelocationPath(FromPath string, ToPath string) *RelocationPath { + s := new(RelocationPath) + s.FromPath = FromPath + s.ToPath = ToPath + return s +} + +// RelocationArg : has no documentation (yet) +type RelocationArg struct { + RelocationPath + // AllowSharedFolder : If true, `copy` will copy contents in shared folder, + // otherwise `RelocationError.cant_copy_shared_folder` will be returned if + // `from_path` contains shared folder. This field is always true for `move`. + AllowSharedFolder bool `json:"allow_shared_folder"` + // Autorename : If there's a conflict, have the Dropbox server try to + // autorename the file to avoid the conflict. + Autorename bool `json:"autorename"` + // AllowOwnershipTransfer : Allow moves by owner even if it would result in + // an ownership transfer for the content being moved. This does not apply to + // copies. + AllowOwnershipTransfer bool `json:"allow_ownership_transfer"` +} + +// NewRelocationArg returns a new RelocationArg instance +func NewRelocationArg(FromPath string, ToPath string) *RelocationArg { + s := new(RelocationArg) + s.FromPath = FromPath + s.ToPath = ToPath + s.AllowSharedFolder = false + s.Autorename = false + s.AllowOwnershipTransfer = false + return s +} + +// RelocationBatchArg : has no documentation (yet) +type RelocationBatchArg struct { + // Entries : List of entries to be moved or copied. Each entry is + // `RelocationPath`. + Entries []*RelocationPath `json:"entries"` + // AllowSharedFolder : If true, `copyBatch` will copy contents in shared + // folder, otherwise `RelocationError.cant_copy_shared_folder` will be + // returned if `RelocationPath.from_path` contains shared folder. This + // field is always true for `moveBatch`. + AllowSharedFolder bool `json:"allow_shared_folder"` + // Autorename : If there's a conflict with any file, have the Dropbox server + // try to autorename that file to avoid the conflict. + Autorename bool `json:"autorename"` + // AllowOwnershipTransfer : Allow moves by owner even if it would result in + // an ownership transfer for the content being moved. This does not apply to + // copies. + AllowOwnershipTransfer bool `json:"allow_ownership_transfer"` +} + +// NewRelocationBatchArg returns a new RelocationBatchArg instance +func NewRelocationBatchArg(Entries []*RelocationPath) *RelocationBatchArg { + s := new(RelocationBatchArg) + s.Entries = Entries + s.AllowSharedFolder = false + s.Autorename = false + s.AllowOwnershipTransfer = false + return s +} + +// RelocationError : has no documentation (yet) +type RelocationError 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 RelocationError +const ( + RelocationErrorFromLookup = "from_lookup" + RelocationErrorFromWrite = "from_write" + RelocationErrorTo = "to" + RelocationErrorCantCopySharedFolder = "cant_copy_shared_folder" + RelocationErrorCantNestSharedFolder = "cant_nest_shared_folder" + RelocationErrorCantMoveFolderIntoItself = "cant_move_folder_into_itself" + RelocationErrorTooManyFiles = "too_many_files" + RelocationErrorDuplicatedOrNestedPaths = "duplicated_or_nested_paths" + RelocationErrorCantTransferOwnership = "cant_transfer_ownership" + RelocationErrorOther = "other" +) + +// UnmarshalJSON deserializes into a RelocationError instance +func (u *RelocationError) 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 +} + +// RelocationBatchError : has no documentation (yet) +type RelocationBatchError struct { + dropbox.Tagged +} + +// Valid tag values for RelocationBatchError +const ( + RelocationBatchErrorTooManyWriteOperations = "too_many_write_operations" +) + +// RelocationBatchJobStatus : has no documentation (yet) +type RelocationBatchJobStatus struct { + dropbox.Tagged + // Complete : The copy or move batch job has finished. + Complete *RelocationBatchResult `json:"complete,omitempty"` + // Failed : The copy or move batch job has failed with exception. + Failed *RelocationBatchError `json:"failed,omitempty"` +} + +// Valid tag values for RelocationBatchJobStatus +const ( + RelocationBatchJobStatusComplete = "complete" + RelocationBatchJobStatusFailed = "failed" +) + +// UnmarshalJSON deserializes into a RelocationBatchJobStatus instance +func (u *RelocationBatchJobStatus) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Complete : The copy or move batch job has finished. + Complete json.RawMessage `json:"complete,omitempty"` + // Failed : The copy or move batch job has failed with exception. + Failed json.RawMessage `json:"failed,omitempty"` + } + var w wrap + var err error + if err = json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "complete": + err = json.Unmarshal(body, &u.Complete) + + if err != nil { + return err + } + case "failed": + err = json.Unmarshal(w.Failed, &u.Failed) + + if err != nil { + return err + } + } + return nil +} + +// RelocationBatchLaunch : Result returned by `copyBatch` or `moveBatch` that +// may either launch an asynchronous job or complete synchronously. +type RelocationBatchLaunch struct { + dropbox.Tagged + // Complete : has no documentation (yet) + Complete *RelocationBatchResult `json:"complete,omitempty"` +} + +// Valid tag values for RelocationBatchLaunch +const ( + RelocationBatchLaunchComplete = "complete" + RelocationBatchLaunchOther = "other" +) + +// UnmarshalJSON deserializes into a RelocationBatchLaunch instance +func (u *RelocationBatchLaunch) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Complete : has no documentation (yet) + Complete json.RawMessage `json:"complete,omitempty"` + } + var w wrap + var err error + if err = json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "complete": + err = json.Unmarshal(body, &u.Complete) + + if err != nil { + return err + } + } + return nil +} + +// RelocationBatchResult : has no documentation (yet) +type RelocationBatchResult struct { + FileOpsResult + // Entries : has no documentation (yet) + Entries []*RelocationBatchResultData `json:"entries"` +} + +// NewRelocationBatchResult returns a new RelocationBatchResult instance +func NewRelocationBatchResult(Entries []*RelocationBatchResultData) *RelocationBatchResult { + s := new(RelocationBatchResult) + s.Entries = Entries + return s +} + +// RelocationBatchResultData : has no documentation (yet) +type RelocationBatchResultData struct { + // Metadata : Metadata of the relocated object. + Metadata IsMetadata `json:"metadata"` +} + +// NewRelocationBatchResultData returns a new RelocationBatchResultData instance +func NewRelocationBatchResultData(Metadata IsMetadata) *RelocationBatchResultData { + s := new(RelocationBatchResultData) + s.Metadata = Metadata + return s +} + +// RelocationResult : has no documentation (yet) +type RelocationResult struct { + FileOpsResult + // Metadata : Metadata of the relocated object. + Metadata IsMetadata `json:"metadata"` +} + +// NewRelocationResult returns a new RelocationResult instance +func NewRelocationResult(Metadata IsMetadata) *RelocationResult { + s := new(RelocationResult) + s.Metadata = Metadata + return s +} + +// RemovePropertiesArg : has no documentation (yet) +type RemovePropertiesArg struct { + // Path : A unique identifier for the file. + Path string `json:"path"` + // PropertyTemplateIds : A list of identifiers for a property template + // created by route properties/template/add. + PropertyTemplateIds []string `json:"property_template_ids"` +} + +// NewRemovePropertiesArg returns a new RemovePropertiesArg instance +func NewRemovePropertiesArg(Path string, PropertyTemplateIds []string) *RemovePropertiesArg { + s := new(RemovePropertiesArg) + s.Path = Path + s.PropertyTemplateIds = PropertyTemplateIds + return s +} + +// RemovePropertiesError : has no documentation (yet) +type RemovePropertiesError struct { + dropbox.Tagged + // PropertyGroupLookup : has no documentation (yet) + PropertyGroupLookup *LookUpPropertiesError `json:"property_group_lookup,omitempty"` +} + +// Valid tag values for RemovePropertiesError +const ( + RemovePropertiesErrorPropertyGroupLookup = "property_group_lookup" +) + +// UnmarshalJSON deserializes into a RemovePropertiesError instance +func (u *RemovePropertiesError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // PropertyGroupLookup : has no documentation (yet) + PropertyGroupLookup json.RawMessage `json:"property_group_lookup,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 "property_group_lookup": + err = json.Unmarshal(w.PropertyGroupLookup, &u.PropertyGroupLookup) + + if err != nil { + return err + } + } + return nil +} + +// RestoreArg : has no documentation (yet) +type RestoreArg struct { + // Path : The path to the file you want to restore. + Path string `json:"path"` + // Rev : The revision to restore for the file. + Rev string `json:"rev"` +} + +// NewRestoreArg returns a new RestoreArg instance +func NewRestoreArg(Path string, Rev string) *RestoreArg { + s := new(RestoreArg) + s.Path = Path + s.Rev = Rev + return s +} + +// RestoreError : has no documentation (yet) +type RestoreError struct { + dropbox.Tagged + // PathLookup : An error occurs when downloading metadata for the file. + PathLookup *LookupError `json:"path_lookup,omitempty"` + // PathWrite : An error occurs when trying to restore the file to that path. + PathWrite *WriteError `json:"path_write,omitempty"` +} + +// Valid tag values for RestoreError +const ( + RestoreErrorPathLookup = "path_lookup" + RestoreErrorPathWrite = "path_write" + RestoreErrorInvalidRevision = "invalid_revision" + RestoreErrorOther = "other" +) + +// UnmarshalJSON deserializes into a RestoreError instance +func (u *RestoreError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // PathLookup : An error occurs when downloading metadata for the file. + PathLookup json.RawMessage `json:"path_lookup,omitempty"` + // PathWrite : An error occurs when trying to restore the file to that + // path. + PathWrite json.RawMessage `json:"path_write,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 "path_lookup": + err = json.Unmarshal(w.PathLookup, &u.PathLookup) + + if err != nil { + return err + } + case "path_write": + err = json.Unmarshal(w.PathWrite, &u.PathWrite) + + if err != nil { + return err + } + } + return nil +} + +// SaveCopyReferenceArg : has no documentation (yet) +type SaveCopyReferenceArg struct { + // CopyReference : A copy reference returned by `copyReferenceGet`. + CopyReference string `json:"copy_reference"` + // Path : Path in the user's Dropbox that is the destination. + Path string `json:"path"` +} + +// NewSaveCopyReferenceArg returns a new SaveCopyReferenceArg instance +func NewSaveCopyReferenceArg(CopyReference string, Path string) *SaveCopyReferenceArg { + s := new(SaveCopyReferenceArg) + s.CopyReference = CopyReference + s.Path = Path + return s +} + +// SaveCopyReferenceError : has no documentation (yet) +type SaveCopyReferenceError struct { + dropbox.Tagged + // Path : has no documentation (yet) + Path *WriteError `json:"path,omitempty"` +} + +// Valid tag values for SaveCopyReferenceError +const ( + SaveCopyReferenceErrorPath = "path" + SaveCopyReferenceErrorInvalidCopyReference = "invalid_copy_reference" + SaveCopyReferenceErrorNoPermission = "no_permission" + SaveCopyReferenceErrorNotFound = "not_found" + SaveCopyReferenceErrorTooManyFiles = "too_many_files" + SaveCopyReferenceErrorOther = "other" +) + +// UnmarshalJSON deserializes into a SaveCopyReferenceError instance +func (u *SaveCopyReferenceError) 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 "path": + err = json.Unmarshal(w.Path, &u.Path) + + if err != nil { + return err + } + } + return nil +} + +// SaveCopyReferenceResult : has no documentation (yet) +type SaveCopyReferenceResult struct { + // Metadata : The metadata of the saved file or folder in the user's + // Dropbox. + Metadata IsMetadata `json:"metadata"` +} + +// NewSaveCopyReferenceResult returns a new SaveCopyReferenceResult instance +func NewSaveCopyReferenceResult(Metadata IsMetadata) *SaveCopyReferenceResult { + s := new(SaveCopyReferenceResult) + s.Metadata = Metadata + return s +} + +// SaveUrlArg : has no documentation (yet) +type SaveUrlArg struct { + // Path : The path in Dropbox where the URL will be saved to. + Path string `json:"path"` + // Url : The URL to be saved. + Url string `json:"url"` +} + +// NewSaveUrlArg returns a new SaveUrlArg instance +func NewSaveUrlArg(Path string, Url string) *SaveUrlArg { + s := new(SaveUrlArg) + s.Path = Path + s.Url = Url + return s +} + +// SaveUrlError : has no documentation (yet) +type SaveUrlError struct { + dropbox.Tagged + // Path : has no documentation (yet) + Path *WriteError `json:"path,omitempty"` +} + +// Valid tag values for SaveUrlError +const ( + SaveUrlErrorPath = "path" + SaveUrlErrorDownloadFailed = "download_failed" + SaveUrlErrorInvalidUrl = "invalid_url" + SaveUrlErrorNotFound = "not_found" + SaveUrlErrorOther = "other" +) + +// UnmarshalJSON deserializes into a SaveUrlError instance +func (u *SaveUrlError) 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 "path": + err = json.Unmarshal(w.Path, &u.Path) + + if err != nil { + return err + } + } + return nil +} + +// SaveUrlJobStatus : has no documentation (yet) +type SaveUrlJobStatus struct { + dropbox.Tagged + // Complete : Metadata of the file where the URL is saved to. + Complete *FileMetadata `json:"complete,omitempty"` + // Failed : has no documentation (yet) + Failed *SaveUrlError `json:"failed,omitempty"` +} + +// Valid tag values for SaveUrlJobStatus +const ( + SaveUrlJobStatusComplete = "complete" + SaveUrlJobStatusFailed = "failed" +) + +// UnmarshalJSON deserializes into a SaveUrlJobStatus instance +func (u *SaveUrlJobStatus) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Complete : Metadata of the file where the URL is saved to. + Complete json.RawMessage `json:"complete,omitempty"` + // Failed : has no documentation (yet) + Failed json.RawMessage `json:"failed,omitempty"` + } + var w wrap + var err error + if err = json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "complete": + err = json.Unmarshal(body, &u.Complete) + + if err != nil { + return err + } + case "failed": + err = json.Unmarshal(w.Failed, &u.Failed) + + if err != nil { + return err + } + } + return nil +} + +// SaveUrlResult : has no documentation (yet) +type SaveUrlResult struct { + dropbox.Tagged + // Complete : Metadata of the file where the URL is saved to. + Complete *FileMetadata `json:"complete,omitempty"` +} + +// Valid tag values for SaveUrlResult +const ( + SaveUrlResultComplete = "complete" +) + +// UnmarshalJSON deserializes into a SaveUrlResult instance +func (u *SaveUrlResult) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Complete : Metadata of the file where the URL is saved to. + Complete json.RawMessage `json:"complete,omitempty"` + } + var w wrap + var err error + if err = json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "complete": + err = json.Unmarshal(body, &u.Complete) + + if err != nil { + return err + } + } + return nil +} + +// SearchArg : has no documentation (yet) +type SearchArg struct { + // Path : The path in the user's Dropbox to search. Should probably be a + // folder. + Path string `json:"path"` + // Query : The string to search for. The search string is split on spaces + // into multiple tokens. For file name searching, the last token is used for + // prefix matching (i.e. "bat c" matches "bat cave" but not "batman car"). + Query string `json:"query"` + // Start : The starting index within the search results (used for paging). + Start uint64 `json:"start"` + // MaxResults : The maximum number of search results to return. + MaxResults uint64 `json:"max_results"` + // Mode : The search mode (filename, filename_and_content, or + // deleted_filename). Note that searching file content is only available for + // Dropbox Business accounts. + Mode *SearchMode `json:"mode"` +} + +// NewSearchArg returns a new SearchArg instance +func NewSearchArg(Path string, Query string) *SearchArg { + s := new(SearchArg) + s.Path = Path + s.Query = Query + s.Start = 0 + s.MaxResults = 100 + s.Mode = &SearchMode{Tagged: dropbox.Tagged{"filename"}} + return s +} + +// SearchError : has no documentation (yet) +type SearchError struct { + dropbox.Tagged + // Path : has no documentation (yet) + Path *LookupError `json:"path,omitempty"` +} + +// Valid tag values for SearchError +const ( + SearchErrorPath = "path" + SearchErrorOther = "other" +) + +// UnmarshalJSON deserializes into a SearchError instance +func (u *SearchError) 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 "path": + err = json.Unmarshal(w.Path, &u.Path) + + if err != nil { + return err + } + } + return nil +} + +// SearchMatch : has no documentation (yet) +type SearchMatch struct { + // MatchType : The type of the match. + MatchType *SearchMatchType `json:"match_type"` + // Metadata : The metadata for the matched file or folder. + Metadata IsMetadata `json:"metadata"` +} + +// NewSearchMatch returns a new SearchMatch instance +func NewSearchMatch(MatchType *SearchMatchType, Metadata IsMetadata) *SearchMatch { + s := new(SearchMatch) + s.MatchType = MatchType + s.Metadata = Metadata + return s +} + +// SearchMatchType : Indicates what type of match was found for a given item. +type SearchMatchType struct { + dropbox.Tagged +} + +// Valid tag values for SearchMatchType +const ( + SearchMatchTypeFilename = "filename" + SearchMatchTypeContent = "content" + SearchMatchTypeBoth = "both" +) + +// SearchMode : has no documentation (yet) +type SearchMode struct { + dropbox.Tagged +} + +// Valid tag values for SearchMode +const ( + SearchModeFilename = "filename" + SearchModeFilenameAndContent = "filename_and_content" + SearchModeDeletedFilename = "deleted_filename" +) + +// SearchResult : has no documentation (yet) +type SearchResult struct { + // Matches : A list (possibly empty) of matches for the query. + Matches []*SearchMatch `json:"matches"` + // More : Used for paging. If true, indicates there is another page of + // results available that can be fetched by calling `search` again. + More bool `json:"more"` + // Start : Used for paging. Value to set the start argument to when calling + // `search` to fetch the next page of results. + Start uint64 `json:"start"` +} + +// NewSearchResult returns a new SearchResult instance +func NewSearchResult(Matches []*SearchMatch, More bool, Start uint64) *SearchResult { + s := new(SearchResult) + s.Matches = Matches + s.More = More + s.Start = Start + return s +} + +// ThumbnailArg : has no documentation (yet) +type ThumbnailArg struct { + // Path : The path to the image file you want to thumbnail. + Path string `json:"path"` + // Format : The format for the thumbnail image, jpeg (default) or png. For + // images that are photos, jpeg should be preferred, while png is better + // for screenshots and digital arts. + Format *ThumbnailFormat `json:"format"` + // Size : The size for the thumbnail image. + Size *ThumbnailSize `json:"size"` +} + +// NewThumbnailArg returns a new ThumbnailArg instance +func NewThumbnailArg(Path string) *ThumbnailArg { + s := new(ThumbnailArg) + s.Path = Path + s.Format = &ThumbnailFormat{Tagged: dropbox.Tagged{"jpeg"}} + s.Size = &ThumbnailSize{Tagged: dropbox.Tagged{"w64h64"}} + return s +} + +// ThumbnailError : has no documentation (yet) +type ThumbnailError struct { + dropbox.Tagged + // Path : An error occurs when downloading metadata for the image. + Path *LookupError `json:"path,omitempty"` +} + +// Valid tag values for ThumbnailError +const ( + ThumbnailErrorPath = "path" + ThumbnailErrorUnsupportedExtension = "unsupported_extension" + ThumbnailErrorUnsupportedImage = "unsupported_image" + ThumbnailErrorConversionError = "conversion_error" +) + +// UnmarshalJSON deserializes into a ThumbnailError instance +func (u *ThumbnailError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Path : An error occurs when downloading metadata for the image. + 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 "path": + err = json.Unmarshal(w.Path, &u.Path) + + if err != nil { + return err + } + } + return nil +} + +// ThumbnailFormat : has no documentation (yet) +type ThumbnailFormat struct { + dropbox.Tagged +} + +// Valid tag values for ThumbnailFormat +const ( + ThumbnailFormatJpeg = "jpeg" + ThumbnailFormatPng = "png" +) + +// ThumbnailSize : has no documentation (yet) +type ThumbnailSize struct { + dropbox.Tagged +} + +// Valid tag values for ThumbnailSize +const ( + ThumbnailSizeW32h32 = "w32h32" + ThumbnailSizeW64h64 = "w64h64" + ThumbnailSizeW128h128 = "w128h128" + ThumbnailSizeW640h480 = "w640h480" + ThumbnailSizeW1024h768 = "w1024h768" +) + +// UpdatePropertiesError : has no documentation (yet) +type UpdatePropertiesError struct { + dropbox.Tagged + // PropertyGroupLookup : has no documentation (yet) + PropertyGroupLookup *LookUpPropertiesError `json:"property_group_lookup,omitempty"` +} + +// Valid tag values for UpdatePropertiesError +const ( + UpdatePropertiesErrorPropertyGroupLookup = "property_group_lookup" +) + +// UnmarshalJSON deserializes into a UpdatePropertiesError instance +func (u *UpdatePropertiesError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // PropertyGroupLookup : has no documentation (yet) + PropertyGroupLookup json.RawMessage `json:"property_group_lookup,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 "property_group_lookup": + err = json.Unmarshal(w.PropertyGroupLookup, &u.PropertyGroupLookup) + + if err != nil { + return err + } + } + return nil +} + +// UpdatePropertyGroupArg : has no documentation (yet) +type UpdatePropertyGroupArg struct { + // Path : A unique identifier for the file. + Path string `json:"path"` + // UpdatePropertyGroups : Filled custom property templates associated with a + // file. + UpdatePropertyGroups []*PropertyGroupUpdate `json:"update_property_groups"` +} + +// NewUpdatePropertyGroupArg returns a new UpdatePropertyGroupArg instance +func NewUpdatePropertyGroupArg(Path string, UpdatePropertyGroups []*PropertyGroupUpdate) *UpdatePropertyGroupArg { + s := new(UpdatePropertyGroupArg) + s.Path = Path + s.UpdatePropertyGroups = UpdatePropertyGroups + return s +} + +// UploadError : has no documentation (yet) +type UploadError struct { + dropbox.Tagged + // Path : Unable to save the uploaded contents to a file. + Path *UploadWriteFailed `json:"path,omitempty"` +} + +// Valid tag values for UploadError +const ( + UploadErrorPath = "path" + UploadErrorOther = "other" +) + +// UnmarshalJSON deserializes into a UploadError instance +func (u *UploadError) 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"` + } + var w wrap + var err error + if err = json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "path": + err = json.Unmarshal(body, &u.Path) + + if err != nil { + return err + } + } + return nil +} + +// UploadErrorWithProperties : has no documentation (yet) +type UploadErrorWithProperties struct { + dropbox.Tagged + // PropertiesError : has no documentation (yet) + PropertiesError *InvalidPropertyGroupError `json:"properties_error,omitempty"` +} + +// Valid tag values for UploadErrorWithProperties +const ( + UploadErrorWithPropertiesPropertiesError = "properties_error" +) + +// UnmarshalJSON deserializes into a UploadErrorWithProperties instance +func (u *UploadErrorWithProperties) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // PropertiesError : has no documentation (yet) + PropertiesError json.RawMessage `json:"properties_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 "properties_error": + err = json.Unmarshal(w.PropertiesError, &u.PropertiesError) + + if err != nil { + return err + } + } + return nil +} + +// UploadSessionAppendArg : has no documentation (yet) +type UploadSessionAppendArg struct { + // Cursor : Contains the upload session ID and the offset. + Cursor *UploadSessionCursor `json:"cursor"` + // Close : If true, the current session will be closed, at which point you + // won't be able to call `uploadSessionAppendV2` anymore with the current + // session. + Close bool `json:"close"` +} + +// NewUploadSessionAppendArg returns a new UploadSessionAppendArg instance +func NewUploadSessionAppendArg(Cursor *UploadSessionCursor) *UploadSessionAppendArg { + s := new(UploadSessionAppendArg) + s.Cursor = Cursor + s.Close = false + return s +} + +// UploadSessionCursor : has no documentation (yet) +type UploadSessionCursor struct { + // SessionId : The upload session ID (returned by `uploadSessionStart`). + SessionId string `json:"session_id"` + // Offset : The amount of data that has been uploaded so far. We use this to + // make sure upload data isn't lost or duplicated in the event of a network + // error. + Offset uint64 `json:"offset"` +} + +// NewUploadSessionCursor returns a new UploadSessionCursor instance +func NewUploadSessionCursor(SessionId string, Offset uint64) *UploadSessionCursor { + s := new(UploadSessionCursor) + s.SessionId = SessionId + s.Offset = Offset + return s +} + +// UploadSessionFinishArg : has no documentation (yet) +type UploadSessionFinishArg struct { + // Cursor : Contains the upload session ID and the offset. + Cursor *UploadSessionCursor `json:"cursor"` + // Commit : Contains the path and other optional modifiers for the commit. + Commit *CommitInfo `json:"commit"` +} + +// NewUploadSessionFinishArg returns a new UploadSessionFinishArg instance +func NewUploadSessionFinishArg(Cursor *UploadSessionCursor, Commit *CommitInfo) *UploadSessionFinishArg { + s := new(UploadSessionFinishArg) + s.Cursor = Cursor + s.Commit = Commit + return s +} + +// UploadSessionFinishBatchArg : has no documentation (yet) +type UploadSessionFinishBatchArg struct { + // Entries : Commit information for each file in the batch. + Entries []*UploadSessionFinishArg `json:"entries"` +} + +// NewUploadSessionFinishBatchArg returns a new UploadSessionFinishBatchArg instance +func NewUploadSessionFinishBatchArg(Entries []*UploadSessionFinishArg) *UploadSessionFinishBatchArg { + s := new(UploadSessionFinishBatchArg) + s.Entries = Entries + return s +} + +// UploadSessionFinishBatchJobStatus : has no documentation (yet) +type UploadSessionFinishBatchJobStatus struct { + dropbox.Tagged + // Complete : The `uploadSessionFinishBatch` has finished. + Complete *UploadSessionFinishBatchResult `json:"complete,omitempty"` +} + +// Valid tag values for UploadSessionFinishBatchJobStatus +const ( + UploadSessionFinishBatchJobStatusComplete = "complete" +) + +// UnmarshalJSON deserializes into a UploadSessionFinishBatchJobStatus instance +func (u *UploadSessionFinishBatchJobStatus) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Complete : The `uploadSessionFinishBatch` has finished. + Complete json.RawMessage `json:"complete,omitempty"` + } + var w wrap + var err error + if err = json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "complete": + err = json.Unmarshal(body, &u.Complete) + + if err != nil { + return err + } + } + return nil +} + +// UploadSessionFinishBatchLaunch : Result returned by +// `uploadSessionFinishBatch` that may either launch an asynchronous job or +// complete synchronously. +type UploadSessionFinishBatchLaunch struct { + dropbox.Tagged + // Complete : has no documentation (yet) + Complete *UploadSessionFinishBatchResult `json:"complete,omitempty"` +} + +// Valid tag values for UploadSessionFinishBatchLaunch +const ( + UploadSessionFinishBatchLaunchComplete = "complete" + UploadSessionFinishBatchLaunchOther = "other" +) + +// UnmarshalJSON deserializes into a UploadSessionFinishBatchLaunch instance +func (u *UploadSessionFinishBatchLaunch) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Complete : has no documentation (yet) + Complete json.RawMessage `json:"complete,omitempty"` + } + var w wrap + var err error + if err = json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "complete": + err = json.Unmarshal(body, &u.Complete) + + if err != nil { + return err + } + } + return nil +} + +// UploadSessionFinishBatchResult : has no documentation (yet) +type UploadSessionFinishBatchResult struct { + // Entries : Commit result for each file in the batch. + Entries []*UploadSessionFinishBatchResultEntry `json:"entries"` +} + +// NewUploadSessionFinishBatchResult returns a new UploadSessionFinishBatchResult instance +func NewUploadSessionFinishBatchResult(Entries []*UploadSessionFinishBatchResultEntry) *UploadSessionFinishBatchResult { + s := new(UploadSessionFinishBatchResult) + s.Entries = Entries + return s +} + +// UploadSessionFinishBatchResultEntry : has no documentation (yet) +type UploadSessionFinishBatchResultEntry struct { + dropbox.Tagged + // Success : has no documentation (yet) + Success *FileMetadata `json:"success,omitempty"` + // Failure : has no documentation (yet) + Failure *UploadSessionFinishError `json:"failure,omitempty"` +} + +// Valid tag values for UploadSessionFinishBatchResultEntry +const ( + UploadSessionFinishBatchResultEntrySuccess = "success" + UploadSessionFinishBatchResultEntryFailure = "failure" +) + +// UnmarshalJSON deserializes into a UploadSessionFinishBatchResultEntry instance +func (u *UploadSessionFinishBatchResultEntry) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Success : has no documentation (yet) + Success json.RawMessage `json:"success,omitempty"` + // Failure : has no documentation (yet) + Failure json.RawMessage `json:"failure,omitempty"` + } + var w wrap + var err error + if err = json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "success": + err = json.Unmarshal(body, &u.Success) + + if err != nil { + return err + } + case "failure": + err = json.Unmarshal(w.Failure, &u.Failure) + + if err != nil { + return err + } + } + return nil +} + +// UploadSessionFinishError : has no documentation (yet) +type UploadSessionFinishError struct { + dropbox.Tagged + // LookupFailed : The session arguments are incorrect; the value explains + // the reason. + LookupFailed *UploadSessionLookupError `json:"lookup_failed,omitempty"` + // Path : Unable to save the uploaded contents to a file. + Path *WriteError `json:"path,omitempty"` +} + +// Valid tag values for UploadSessionFinishError +const ( + UploadSessionFinishErrorLookupFailed = "lookup_failed" + UploadSessionFinishErrorPath = "path" + UploadSessionFinishErrorTooManySharedFolderTargets = "too_many_shared_folder_targets" + UploadSessionFinishErrorTooManyWriteOperations = "too_many_write_operations" + UploadSessionFinishErrorOther = "other" +) + +// UnmarshalJSON deserializes into a UploadSessionFinishError instance +func (u *UploadSessionFinishError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // LookupFailed : The session arguments are incorrect; the value + // explains the reason. + LookupFailed json.RawMessage `json:"lookup_failed,omitempty"` + // Path : Unable to save the uploaded contents to a file. + 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 "lookup_failed": + err = json.Unmarshal(w.LookupFailed, &u.LookupFailed) + + if err != nil { + return err + } + case "path": + err = json.Unmarshal(w.Path, &u.Path) + + if err != nil { + return err + } + } + return nil +} + +// UploadSessionLookupError : has no documentation (yet) +type UploadSessionLookupError struct { + dropbox.Tagged + // IncorrectOffset : The specified offset was incorrect. See the value for + // the correct offset. This error may occur when a previous request was + // received and processed successfully but the client did not receive the + // response, e.g. due to a network error. + IncorrectOffset *UploadSessionOffsetError `json:"incorrect_offset,omitempty"` +} + +// Valid tag values for UploadSessionLookupError +const ( + UploadSessionLookupErrorNotFound = "not_found" + UploadSessionLookupErrorIncorrectOffset = "incorrect_offset" + UploadSessionLookupErrorClosed = "closed" + UploadSessionLookupErrorNotClosed = "not_closed" + UploadSessionLookupErrorOther = "other" +) + +// UnmarshalJSON deserializes into a UploadSessionLookupError instance +func (u *UploadSessionLookupError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // IncorrectOffset : The specified offset was incorrect. See the value + // for the correct offset. This error may occur when a previous request + // was received and processed successfully but the client did not + // receive the response, e.g. due to a network error. + IncorrectOffset json.RawMessage `json:"incorrect_offset,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 "incorrect_offset": + err = json.Unmarshal(body, &u.IncorrectOffset) + + if err != nil { + return err + } + } + return nil +} + +// UploadSessionOffsetError : has no documentation (yet) +type UploadSessionOffsetError struct { + // CorrectOffset : The offset up to which data has been collected. + CorrectOffset uint64 `json:"correct_offset"` +} + +// NewUploadSessionOffsetError returns a new UploadSessionOffsetError instance +func NewUploadSessionOffsetError(CorrectOffset uint64) *UploadSessionOffsetError { + s := new(UploadSessionOffsetError) + s.CorrectOffset = CorrectOffset + return s +} + +// UploadSessionStartArg : has no documentation (yet) +type UploadSessionStartArg struct { + // Close : If true, the current session will be closed, at which point you + // won't be able to call `uploadSessionAppendV2` anymore with the current + // session. + Close bool `json:"close"` +} + +// NewUploadSessionStartArg returns a new UploadSessionStartArg instance +func NewUploadSessionStartArg() *UploadSessionStartArg { + s := new(UploadSessionStartArg) + s.Close = false + return s +} + +// UploadSessionStartResult : has no documentation (yet) +type UploadSessionStartResult struct { + // SessionId : A unique identifier for the upload session. Pass this to + // `uploadSessionAppendV2` and `uploadSessionFinish`. + SessionId string `json:"session_id"` +} + +// NewUploadSessionStartResult returns a new UploadSessionStartResult instance +func NewUploadSessionStartResult(SessionId string) *UploadSessionStartResult { + s := new(UploadSessionStartResult) + s.SessionId = SessionId + return s +} + +// UploadWriteFailed : has no documentation (yet) +type UploadWriteFailed struct { + // Reason : The reason why the file couldn't be saved. + Reason *WriteError `json:"reason"` + // UploadSessionId : The upload session ID; this may be used to retry the + // commit. + UploadSessionId string `json:"upload_session_id"` +} + +// NewUploadWriteFailed returns a new UploadWriteFailed instance +func NewUploadWriteFailed(Reason *WriteError, UploadSessionId string) *UploadWriteFailed { + s := new(UploadWriteFailed) + s.Reason = Reason + s.UploadSessionId = UploadSessionId + return s +} + +// VideoMetadata : Metadata for a video. +type VideoMetadata struct { + MediaMetadata + // Duration : The duration of the video in milliseconds. + Duration uint64 `json:"duration,omitempty"` +} + +// NewVideoMetadata returns a new VideoMetadata instance +func NewVideoMetadata() *VideoMetadata { + s := new(VideoMetadata) + return s +} + +// WriteConflictError : has no documentation (yet) +type WriteConflictError struct { + dropbox.Tagged +} + +// Valid tag values for WriteConflictError +const ( + WriteConflictErrorFile = "file" + WriteConflictErrorFolder = "folder" + WriteConflictErrorFileAncestor = "file_ancestor" + WriteConflictErrorOther = "other" +) + +// WriteError : has no documentation (yet) +type WriteError struct { + dropbox.Tagged + // MalformedPath : has no documentation (yet) + MalformedPath string `json:"malformed_path,omitempty"` + // Conflict : Couldn't write to the target path because there was something + // in the way. + Conflict *WriteConflictError `json:"conflict,omitempty"` +} + +// Valid tag values for WriteError +const ( + WriteErrorMalformedPath = "malformed_path" + WriteErrorConflict = "conflict" + WriteErrorNoWritePermission = "no_write_permission" + WriteErrorInsufficientSpace = "insufficient_space" + WriteErrorDisallowedName = "disallowed_name" + WriteErrorTeamFolder = "team_folder" + WriteErrorOther = "other" +) + +// UnmarshalJSON deserializes into a WriteError instance +func (u *WriteError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // MalformedPath : has no documentation (yet) + MalformedPath json.RawMessage `json:"malformed_path,omitempty"` + // Conflict : Couldn't write to the target path because there was + // something in the way. + Conflict json.RawMessage `json:"conflict,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 "malformed_path": + err = json.Unmarshal(body, &u.MalformedPath) + + if err != nil { + return err + } + case "conflict": + err = json.Unmarshal(w.Conflict, &u.Conflict) + + if err != nil { + return err + } + } + return nil +} + +// WriteMode : Your intent when writing a file to some path. This is used to +// determine what constitutes a conflict and what the autorename strategy is. In +// some situations, the conflict behavior is identical: (a) If the target path +// doesn't refer to anything, the file is always written; no conflict. (b) If +// the target path refers to a folder, it's always a conflict. (c) If the target +// path refers to a file with identical contents, nothing gets written; no +// conflict. The conflict checking differs in the case where there's a file at +// the target path with contents different from the contents you're trying to +// write. +type WriteMode struct { + dropbox.Tagged + // Update : Overwrite if the given "rev" matches the existing file's "rev". + // The autorename strategy is to append the string "conflicted copy" to the + // file name. For example, "document.txt" might become "document (conflicted + // copy).txt" or "document (Panda's conflicted copy).txt". + Update string `json:"update,omitempty"` +} + +// Valid tag values for WriteMode +const ( + WriteModeAdd = "add" + WriteModeOverwrite = "overwrite" + WriteModeUpdate = "update" +) + +// UnmarshalJSON deserializes into a WriteMode instance +func (u *WriteMode) 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 "update": + err = json.Unmarshal(body, &u.Update) + + if err != nil { + return err + } + } + return nil +} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/paper/client.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/paper/client.go new file mode 100644 index 000000000..a2815ce24 --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/paper/client.go @@ -0,0 +1,1086 @@ +// Copyright (c) Dropbox, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package paper + +import ( + "bytes" + "encoding/json" + "io" + "io/ioutil" + "net/http" + + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" +) + +// Client interface describes all routes in this namespace +type Client interface { + // DocsArchive : Marks the given Paper doc as archived. Note: This action + // can be performed or undone by anyone with edit permissions to the doc. + DocsArchive(arg *RefPaperDoc) (err error) + // DocsDownload : Exports and downloads Paper doc either as HTML or + // markdown. + DocsDownload(arg *PaperDocExport) (res *PaperDocExportResult, content io.ReadCloser, err error) + // DocsFolderUsersList : Lists the users who are explicitly invited to the + // Paper folder in which the Paper doc is contained. For private folders all + // users (including owner) shared on the folder are listed and for team + // folders all non-team users shared on the folder are returned. + DocsFolderUsersList(arg *ListUsersOnFolderArgs) (res *ListUsersOnFolderResponse, err error) + // DocsFolderUsersListContinue : Once a cursor has been retrieved from + // `docsFolderUsersList`, use this to paginate through all users on the + // Paper folder. + DocsFolderUsersListContinue(arg *ListUsersOnFolderContinueArgs) (res *ListUsersOnFolderResponse, err error) + // DocsGetFolderInfo : Retrieves folder information for the given Paper doc. + // This includes: - folder sharing policy; permissions for subfolders are + // set by the top-level folder. - full 'filepath', i.e. the list of + // folders (both folderId and folderName) from the root folder to the folder + // directly containing the Paper doc. Note: If the Paper doc is not in any + // folder (aka unfiled) the response will be empty. + DocsGetFolderInfo(arg *RefPaperDoc) (res *FoldersContainingPaperDoc, err error) + // DocsList : Return the list of all Paper docs according to the argument + // specifications. To iterate over through the full pagination, pass the + // cursor to `docsListContinue`. + DocsList(arg *ListPaperDocsArgs) (res *ListPaperDocsResponse, err error) + // DocsListContinue : Once a cursor has been retrieved from `docsList`, use + // this to paginate through all Paper doc. + DocsListContinue(arg *ListPaperDocsContinueArgs) (res *ListPaperDocsResponse, err error) + // DocsPermanentlyDelete : Permanently deletes the given Paper doc. This + // operation is final as the doc cannot be recovered. Note: This action can + // be performed only by the doc owner. + DocsPermanentlyDelete(arg *RefPaperDoc) (err error) + // DocsSharingPolicyGet : Gets the default sharing policy for the given + // Paper doc. + DocsSharingPolicyGet(arg *RefPaperDoc) (res *SharingPolicy, err error) + // DocsSharingPolicySet : Sets the default sharing policy for the given + // Paper doc. The default 'team_sharing_policy' can be changed only by + // teams, omit this field for personal accounts. Note: + // 'public_sharing_policy' cannot be set to the value 'disabled' because + // this setting can be changed only via the team admin console. + DocsSharingPolicySet(arg *PaperDocSharingPolicy) (err error) + // DocsUsersAdd : Allows an owner or editor to add users to a Paper doc or + // change their permissions using their email address or Dropbox account ID. + // Note: The Doc owner's permissions cannot be changed. + DocsUsersAdd(arg *AddPaperDocUser) (res []*AddPaperDocUserMemberResult, err error) + // DocsUsersList : Lists all users who visited the Paper doc or users with + // explicit access. This call excludes users who have been removed. The list + // is sorted by the date of the visit or the share date. The list will + // include both users, the explicitly shared ones as well as those who came + // in using the Paper url link. + DocsUsersList(arg *ListUsersOnPaperDocArgs) (res *ListUsersOnPaperDocResponse, err error) + // DocsUsersListContinue : Once a cursor has been retrieved from + // `docsUsersList`, use this to paginate through all users on the Paper doc. + DocsUsersListContinue(arg *ListUsersOnPaperDocContinueArgs) (res *ListUsersOnPaperDocResponse, err error) + // DocsUsersRemove : Allows an owner or editor to remove users from a Paper + // doc using their email address or Dropbox account ID. Note: Doc owner + // cannot be removed. + DocsUsersRemove(arg *RemovePaperDocUser) (err error) +} + +type apiImpl dropbox.Context + +//DocsArchiveAPIError is an error-wrapper for the docs/archive route +type DocsArchiveAPIError struct { + dropbox.APIError + EndpointError *DocLookupError `json:"error"` +} + +func (dbx *apiImpl) DocsArchive(arg *RefPaperDoc) (err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "paper", "docs/archive", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + return + } + if resp.StatusCode == http.StatusConflict { + var apiError DocsArchiveAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//DocsDownloadAPIError is an error-wrapper for the docs/download route +type DocsDownloadAPIError struct { + dropbox.APIError + EndpointError *DocLookupError `json:"error"` +} + +func (dbx *apiImpl) DocsDownload(arg *PaperDocExport) (res *PaperDocExportResult, content io.ReadCloser, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "download", true, "paper", "docs/download", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + body := []byte(resp.Header.Get("Dropbox-API-Result")) + content = resp.Body + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError DocsDownloadAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//DocsFolderUsersListAPIError is an error-wrapper for the docs/folder_users/list route +type DocsFolderUsersListAPIError struct { + dropbox.APIError + EndpointError *DocLookupError `json:"error"` +} + +func (dbx *apiImpl) DocsFolderUsersList(arg *ListUsersOnFolderArgs) (res *ListUsersOnFolderResponse, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "paper", "docs/folder_users/list", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError DocsFolderUsersListAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//DocsFolderUsersListContinueAPIError is an error-wrapper for the docs/folder_users/list/continue route +type DocsFolderUsersListContinueAPIError struct { + dropbox.APIError + EndpointError *ListUsersCursorError `json:"error"` +} + +func (dbx *apiImpl) DocsFolderUsersListContinue(arg *ListUsersOnFolderContinueArgs) (res *ListUsersOnFolderResponse, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "paper", "docs/folder_users/list/continue", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError DocsFolderUsersListContinueAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//DocsGetFolderInfoAPIError is an error-wrapper for the docs/get_folder_info route +type DocsGetFolderInfoAPIError struct { + dropbox.APIError + EndpointError *DocLookupError `json:"error"` +} + +func (dbx *apiImpl) DocsGetFolderInfo(arg *RefPaperDoc) (res *FoldersContainingPaperDoc, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "paper", "docs/get_folder_info", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError DocsGetFolderInfoAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//DocsListAPIError is an error-wrapper for the docs/list route +type DocsListAPIError struct { + dropbox.APIError + EndpointError struct{} `json:"error"` +} + +func (dbx *apiImpl) DocsList(arg *ListPaperDocsArgs) (res *ListPaperDocsResponse, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "paper", "docs/list", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError DocsListAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//DocsListContinueAPIError is an error-wrapper for the docs/list/continue route +type DocsListContinueAPIError struct { + dropbox.APIError + EndpointError *ListDocsCursorError `json:"error"` +} + +func (dbx *apiImpl) DocsListContinue(arg *ListPaperDocsContinueArgs) (res *ListPaperDocsResponse, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "paper", "docs/list/continue", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError DocsListContinueAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//DocsPermanentlyDeleteAPIError is an error-wrapper for the docs/permanently_delete route +type DocsPermanentlyDeleteAPIError struct { + dropbox.APIError + EndpointError *DocLookupError `json:"error"` +} + +func (dbx *apiImpl) DocsPermanentlyDelete(arg *RefPaperDoc) (err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "paper", "docs/permanently_delete", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + return + } + if resp.StatusCode == http.StatusConflict { + var apiError DocsPermanentlyDeleteAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//DocsSharingPolicyGetAPIError is an error-wrapper for the docs/sharing_policy/get route +type DocsSharingPolicyGetAPIError struct { + dropbox.APIError + EndpointError *DocLookupError `json:"error"` +} + +func (dbx *apiImpl) DocsSharingPolicyGet(arg *RefPaperDoc) (res *SharingPolicy, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "paper", "docs/sharing_policy/get", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError DocsSharingPolicyGetAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//DocsSharingPolicySetAPIError is an error-wrapper for the docs/sharing_policy/set route +type DocsSharingPolicySetAPIError struct { + dropbox.APIError + EndpointError *DocLookupError `json:"error"` +} + +func (dbx *apiImpl) DocsSharingPolicySet(arg *PaperDocSharingPolicy) (err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "paper", "docs/sharing_policy/set", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + return + } + if resp.StatusCode == http.StatusConflict { + var apiError DocsSharingPolicySetAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//DocsUsersAddAPIError is an error-wrapper for the docs/users/add route +type DocsUsersAddAPIError struct { + dropbox.APIError + EndpointError *DocLookupError `json:"error"` +} + +func (dbx *apiImpl) DocsUsersAdd(arg *AddPaperDocUser) (res []*AddPaperDocUserMemberResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "paper", "docs/users/add", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError DocsUsersAddAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//DocsUsersListAPIError is an error-wrapper for the docs/users/list route +type DocsUsersListAPIError struct { + dropbox.APIError + EndpointError *DocLookupError `json:"error"` +} + +func (dbx *apiImpl) DocsUsersList(arg *ListUsersOnPaperDocArgs) (res *ListUsersOnPaperDocResponse, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "paper", "docs/users/list", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError DocsUsersListAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//DocsUsersListContinueAPIError is an error-wrapper for the docs/users/list/continue route +type DocsUsersListContinueAPIError struct { + dropbox.APIError + EndpointError *ListUsersCursorError `json:"error"` +} + +func (dbx *apiImpl) DocsUsersListContinue(arg *ListUsersOnPaperDocContinueArgs) (res *ListUsersOnPaperDocResponse, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "paper", "docs/users/list/continue", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError DocsUsersListContinueAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//DocsUsersRemoveAPIError is an error-wrapper for the docs/users/remove route +type DocsUsersRemoveAPIError struct { + dropbox.APIError + EndpointError *DocLookupError `json:"error"` +} + +func (dbx *apiImpl) DocsUsersRemove(arg *RemovePaperDocUser) (err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "paper", "docs/users/remove", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + return + } + if resp.StatusCode == http.StatusConflict { + var apiError DocsUsersRemoveAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +// New returns a Client implementation for this namespace +func New(c dropbox.Config) *apiImpl { + ctx := apiImpl(dropbox.NewContext(c)) + return &ctx +} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/paper/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/paper/types.go new file mode 100644 index 000000000..35ab81857 --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/paper/types.go @@ -0,0 +1,729 @@ +// Copyright (c) Dropbox, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package paper : This namespace contains endpoints and data types for managing +// docs and folders in Dropbox Paper. +package paper + +import ( + "encoding/json" + "time" + + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing" +) + +// AddMember : has no documentation (yet) +type AddMember struct { + // PermissionLevel : Permission for the user. + PermissionLevel *PaperDocPermissionLevel `json:"permission_level"` + // Member : User which should be added to the Paper doc. Specify only email + // address or Dropbox account ID. + Member *sharing.MemberSelector `json:"member"` +} + +// NewAddMember returns a new AddMember instance +func NewAddMember(Member *sharing.MemberSelector) *AddMember { + s := new(AddMember) + s.Member = Member + s.PermissionLevel = &PaperDocPermissionLevel{Tagged: dropbox.Tagged{"edit"}} + return s +} + +// RefPaperDoc : has no documentation (yet) +type RefPaperDoc struct { + // DocId : The Paper doc ID. + DocId string `json:"doc_id"` +} + +// NewRefPaperDoc returns a new RefPaperDoc instance +func NewRefPaperDoc(DocId string) *RefPaperDoc { + s := new(RefPaperDoc) + s.DocId = DocId + return s +} + +// AddPaperDocUser : has no documentation (yet) +type AddPaperDocUser struct { + RefPaperDoc + // Members : User which should be added to the Paper doc. Specify only email + // address or Dropbox account ID. + Members []*AddMember `json:"members"` + // CustomMessage : A personal message that will be emailed to each + // successfully added member. + CustomMessage string `json:"custom_message,omitempty"` + // Quiet : Clients should set this to true if no email message shall be sent + // to added users. + Quiet bool `json:"quiet"` +} + +// NewAddPaperDocUser returns a new AddPaperDocUser instance +func NewAddPaperDocUser(DocId string, Members []*AddMember) *AddPaperDocUser { + s := new(AddPaperDocUser) + s.DocId = DocId + s.Members = Members + s.Quiet = false + return s +} + +// AddPaperDocUserMemberResult : Per-member result for `docsUsersAdd`. +type AddPaperDocUserMemberResult struct { + // Member : One of specified input members. + Member *sharing.MemberSelector `json:"member"` + // Result : The outcome of the action on this member. + Result *AddPaperDocUserResult `json:"result"` +} + +// NewAddPaperDocUserMemberResult returns a new AddPaperDocUserMemberResult instance +func NewAddPaperDocUserMemberResult(Member *sharing.MemberSelector, Result *AddPaperDocUserResult) *AddPaperDocUserMemberResult { + s := new(AddPaperDocUserMemberResult) + s.Member = Member + s.Result = Result + return s +} + +// AddPaperDocUserResult : has no documentation (yet) +type AddPaperDocUserResult struct { + dropbox.Tagged +} + +// Valid tag values for AddPaperDocUserResult +const ( + AddPaperDocUserResultSuccess = "success" + AddPaperDocUserResultUnknownError = "unknown_error" + AddPaperDocUserResultSharingOutsideTeamDisabled = "sharing_outside_team_disabled" + AddPaperDocUserResultDailyLimitReached = "daily_limit_reached" + AddPaperDocUserResultUserIsOwner = "user_is_owner" + AddPaperDocUserResultFailedUserDataRetrieval = "failed_user_data_retrieval" + AddPaperDocUserResultPermissionAlreadyGranted = "permission_already_granted" + AddPaperDocUserResultOther = "other" +) + +// Cursor : has no documentation (yet) +type Cursor struct { + // Value : The actual cursor value. + Value string `json:"value"` + // Expiration : Expiration time of `value`. Some cursors might have + // expiration time assigned. This is a UTC value after which the cursor is + // no longer valid and the API starts returning an error. If cursor expires + // a new one needs to be obtained and pagination needs to be restarted. Some + // cursors might be short-lived some cursors might be long-lived. This + // really depends on the sorting type and order, e.g.: 1. on one hand, + // listing docs created by the user, sorted by the created time ascending + // will have undefinite expiration because the results cannot change while + // the iteration is happening. This cursor would be suitable for long term + // polling. 2. on the other hand, listing docs sorted by the last modified + // time will have a very short expiration as docs do get modified very often + // and the modified time can be changed while the iteration is happening + // thus altering the results. + Expiration time.Time `json:"expiration,omitempty"` +} + +// NewCursor returns a new Cursor instance +func NewCursor(Value string) *Cursor { + s := new(Cursor) + s.Value = Value + return s +} + +// PaperApiBaseError : has no documentation (yet) +type PaperApiBaseError struct { + dropbox.Tagged +} + +// Valid tag values for PaperApiBaseError +const ( + PaperApiBaseErrorInsufficientPermissions = "insufficient_permissions" + PaperApiBaseErrorOther = "other" +) + +// DocLookupError : has no documentation (yet) +type DocLookupError struct { + dropbox.Tagged +} + +// Valid tag values for DocLookupError +const ( + DocLookupErrorDocNotFound = "doc_not_found" +) + +// DocSubscriptionLevel : The subscription level of a Paper doc. +type DocSubscriptionLevel struct { + dropbox.Tagged +} + +// Valid tag values for DocSubscriptionLevel +const ( + DocSubscriptionLevelDefault = "default" + DocSubscriptionLevelIgnore = "ignore" + DocSubscriptionLevelEvery = "every" + DocSubscriptionLevelNoEmail = "no_email" +) + +// ExportFormat : The desired export format of the Paper doc. +type ExportFormat struct { + dropbox.Tagged +} + +// Valid tag values for ExportFormat +const ( + ExportFormatHtml = "html" + ExportFormatMarkdown = "markdown" + ExportFormatOther = "other" +) + +// Folder : Data structure representing a Paper folder. +type Folder struct { + // Id : Paper folder ID. This ID uniquely identifies the folder. + Id string `json:"id"` + // Name : Paper folder name. + Name string `json:"name"` +} + +// NewFolder returns a new Folder instance +func NewFolder(Id string, Name string) *Folder { + s := new(Folder) + s.Id = Id + s.Name = Name + return s +} + +// FolderSharingPolicyType : The sharing policy of a Paper folder. Note: The +// sharing policy of subfolders is inherited from the root folder. +type FolderSharingPolicyType struct { + dropbox.Tagged +} + +// Valid tag values for FolderSharingPolicyType +const ( + FolderSharingPolicyTypeTeam = "team" + FolderSharingPolicyTypeInviteOnly = "invite_only" +) + +// FolderSubscriptionLevel : The subscription level of a Paper folder. +type FolderSubscriptionLevel struct { + dropbox.Tagged +} + +// Valid tag values for FolderSubscriptionLevel +const ( + FolderSubscriptionLevelNone = "none" + FolderSubscriptionLevelActivityOnly = "activity_only" + FolderSubscriptionLevelDailyEmails = "daily_emails" + FolderSubscriptionLevelWeeklyEmails = "weekly_emails" +) + +// FoldersContainingPaperDoc : Metadata about Paper folders containing the +// specififed Paper doc. +type FoldersContainingPaperDoc struct { + // FolderSharingPolicyType : The sharing policy of the folder containing the + // Paper doc. + FolderSharingPolicyType *FolderSharingPolicyType `json:"folder_sharing_policy_type,omitempty"` + // Folders : The folder path. If present the first folder is the root + // folder. + Folders []*Folder `json:"folders,omitempty"` +} + +// NewFoldersContainingPaperDoc returns a new FoldersContainingPaperDoc instance +func NewFoldersContainingPaperDoc() *FoldersContainingPaperDoc { + s := new(FoldersContainingPaperDoc) + return s +} + +// InviteeInfoWithPermissionLevel : has no documentation (yet) +type InviteeInfoWithPermissionLevel struct { + // Invitee : Email address invited to the Paper doc. + Invitee *sharing.InviteeInfo `json:"invitee"` + // PermissionLevel : Permission level for the invitee. + PermissionLevel *PaperDocPermissionLevel `json:"permission_level"` +} + +// NewInviteeInfoWithPermissionLevel returns a new InviteeInfoWithPermissionLevel instance +func NewInviteeInfoWithPermissionLevel(Invitee *sharing.InviteeInfo, PermissionLevel *PaperDocPermissionLevel) *InviteeInfoWithPermissionLevel { + s := new(InviteeInfoWithPermissionLevel) + s.Invitee = Invitee + s.PermissionLevel = PermissionLevel + return s +} + +// ListDocsCursorError : has no documentation (yet) +type ListDocsCursorError struct { + dropbox.Tagged + // CursorError : has no documentation (yet) + CursorError *PaperApiCursorError `json:"cursor_error,omitempty"` +} + +// Valid tag values for ListDocsCursorError +const ( + ListDocsCursorErrorCursorError = "cursor_error" + ListDocsCursorErrorOther = "other" +) + +// UnmarshalJSON deserializes into a ListDocsCursorError instance +func (u *ListDocsCursorError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // CursorError : has no documentation (yet) + CursorError json.RawMessage `json:"cursor_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 "cursor_error": + err = json.Unmarshal(w.CursorError, &u.CursorError) + + if err != nil { + return err + } + } + return nil +} + +// ListPaperDocsArgs : has no documentation (yet) +type ListPaperDocsArgs struct { + // FilterBy : Allows user to specify how the Paper docs should be filtered. + FilterBy *ListPaperDocsFilterBy `json:"filter_by"` + // SortBy : Allows user to specify how the Paper docs should be sorted. + SortBy *ListPaperDocsSortBy `json:"sort_by"` + // SortOrder : Allows user to specify the sort order of the result. + SortOrder *ListPaperDocsSortOrder `json:"sort_order"` + // Limit : Size limit per batch. The maximum number of docs that can be + // retrieved per batch is 1000. Higher value results in invalid arguments + // error. + Limit int32 `json:"limit"` +} + +// NewListPaperDocsArgs returns a new ListPaperDocsArgs instance +func NewListPaperDocsArgs() *ListPaperDocsArgs { + s := new(ListPaperDocsArgs) + s.FilterBy = &ListPaperDocsFilterBy{Tagged: dropbox.Tagged{"docs_accessed"}} + s.SortBy = &ListPaperDocsSortBy{Tagged: dropbox.Tagged{"accessed"}} + s.SortOrder = &ListPaperDocsSortOrder{Tagged: dropbox.Tagged{"ascending"}} + s.Limit = 1000 + return s +} + +// ListPaperDocsContinueArgs : has no documentation (yet) +type ListPaperDocsContinueArgs struct { + // Cursor : The cursor obtained from `docsList` or `docsListContinue`. + // Allows for pagination. + Cursor string `json:"cursor"` +} + +// NewListPaperDocsContinueArgs returns a new ListPaperDocsContinueArgs instance +func NewListPaperDocsContinueArgs(Cursor string) *ListPaperDocsContinueArgs { + s := new(ListPaperDocsContinueArgs) + s.Cursor = Cursor + return s +} + +// ListPaperDocsFilterBy : has no documentation (yet) +type ListPaperDocsFilterBy struct { + dropbox.Tagged +} + +// Valid tag values for ListPaperDocsFilterBy +const ( + ListPaperDocsFilterByDocsAccessed = "docs_accessed" + ListPaperDocsFilterByDocsCreated = "docs_created" + ListPaperDocsFilterByOther = "other" +) + +// ListPaperDocsResponse : has no documentation (yet) +type ListPaperDocsResponse struct { + // DocIds : The list of Paper doc IDs that can be used to access the given + // Paper docs or supplied to other API methods. The list is sorted in the + // order specified by the initial call to `docsList`. + DocIds []string `json:"doc_ids"` + // Cursor : Pass the cursor into `docsListContinue` to paginate through all + // files. The cursor preserves all properties as specified in the original + // call to `docsList`. + Cursor *Cursor `json:"cursor"` + // HasMore : Will be set to True if a subsequent call with the provided + // cursor to `docsListContinue` returns immediately with some results. If + // set to False please allow some delay before making another call to + // `docsListContinue`. + HasMore bool `json:"has_more"` +} + +// NewListPaperDocsResponse returns a new ListPaperDocsResponse instance +func NewListPaperDocsResponse(DocIds []string, Cursor *Cursor, HasMore bool) *ListPaperDocsResponse { + s := new(ListPaperDocsResponse) + s.DocIds = DocIds + s.Cursor = Cursor + s.HasMore = HasMore + return s +} + +// ListPaperDocsSortBy : has no documentation (yet) +type ListPaperDocsSortBy struct { + dropbox.Tagged +} + +// Valid tag values for ListPaperDocsSortBy +const ( + ListPaperDocsSortByAccessed = "accessed" + ListPaperDocsSortByModified = "modified" + ListPaperDocsSortByCreated = "created" + ListPaperDocsSortByOther = "other" +) + +// ListPaperDocsSortOrder : has no documentation (yet) +type ListPaperDocsSortOrder struct { + dropbox.Tagged +} + +// Valid tag values for ListPaperDocsSortOrder +const ( + ListPaperDocsSortOrderAscending = "ascending" + ListPaperDocsSortOrderDescending = "descending" + ListPaperDocsSortOrderOther = "other" +) + +// ListUsersCursorError : has no documentation (yet) +type ListUsersCursorError struct { + dropbox.Tagged + // CursorError : has no documentation (yet) + CursorError *PaperApiCursorError `json:"cursor_error,omitempty"` +} + +// Valid tag values for ListUsersCursorError +const ( + ListUsersCursorErrorDocNotFound = "doc_not_found" + ListUsersCursorErrorCursorError = "cursor_error" +) + +// UnmarshalJSON deserializes into a ListUsersCursorError instance +func (u *ListUsersCursorError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // CursorError : has no documentation (yet) + CursorError json.RawMessage `json:"cursor_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 "cursor_error": + err = json.Unmarshal(w.CursorError, &u.CursorError) + + if err != nil { + return err + } + } + return nil +} + +// ListUsersOnFolderArgs : has no documentation (yet) +type ListUsersOnFolderArgs struct { + RefPaperDoc + // Limit : Size limit per batch. The maximum number of users that can be + // retrieved per batch is 1000. Higher value results in invalid arguments + // error. + Limit int32 `json:"limit"` +} + +// NewListUsersOnFolderArgs returns a new ListUsersOnFolderArgs instance +func NewListUsersOnFolderArgs(DocId string) *ListUsersOnFolderArgs { + s := new(ListUsersOnFolderArgs) + s.DocId = DocId + s.Limit = 1000 + return s +} + +// ListUsersOnFolderContinueArgs : has no documentation (yet) +type ListUsersOnFolderContinueArgs struct { + RefPaperDoc + // Cursor : The cursor obtained from `docsFolderUsersList` or + // `docsFolderUsersListContinue`. Allows for pagination. + Cursor string `json:"cursor"` +} + +// NewListUsersOnFolderContinueArgs returns a new ListUsersOnFolderContinueArgs instance +func NewListUsersOnFolderContinueArgs(DocId string, Cursor string) *ListUsersOnFolderContinueArgs { + s := new(ListUsersOnFolderContinueArgs) + s.DocId = DocId + s.Cursor = Cursor + return s +} + +// ListUsersOnFolderResponse : has no documentation (yet) +type ListUsersOnFolderResponse struct { + // Invitees : List of email addresses that are invited on the Paper folder. + Invitees []*sharing.InviteeInfo `json:"invitees"` + // Users : List of users that are invited on the Paper folder. + Users []*sharing.UserInfo `json:"users"` + // Cursor : Pass the cursor into `docsFolderUsersListContinue` to paginate + // through all users. The cursor preserves all properties as specified in + // the original call to `docsFolderUsersList`. + Cursor *Cursor `json:"cursor"` + // HasMore : Will be set to True if a subsequent call with the provided + // cursor to `docsFolderUsersListContinue` returns immediately with some + // results. If set to False please allow some delay before making another + // call to `docsFolderUsersListContinue`. + HasMore bool `json:"has_more"` +} + +// NewListUsersOnFolderResponse returns a new ListUsersOnFolderResponse instance +func NewListUsersOnFolderResponse(Invitees []*sharing.InviteeInfo, Users []*sharing.UserInfo, Cursor *Cursor, HasMore bool) *ListUsersOnFolderResponse { + s := new(ListUsersOnFolderResponse) + s.Invitees = Invitees + s.Users = Users + s.Cursor = Cursor + s.HasMore = HasMore + return s +} + +// ListUsersOnPaperDocArgs : has no documentation (yet) +type ListUsersOnPaperDocArgs struct { + RefPaperDoc + // Limit : Size limit per batch. The maximum number of users that can be + // retrieved per batch is 1000. Higher value results in invalid arguments + // error. + Limit int32 `json:"limit"` + // FilterBy : Specify this attribute if you want to obtain users that have + // already accessed the Paper doc. + FilterBy *UserOnPaperDocFilter `json:"filter_by"` +} + +// NewListUsersOnPaperDocArgs returns a new ListUsersOnPaperDocArgs instance +func NewListUsersOnPaperDocArgs(DocId string) *ListUsersOnPaperDocArgs { + s := new(ListUsersOnPaperDocArgs) + s.DocId = DocId + s.Limit = 1000 + s.FilterBy = &UserOnPaperDocFilter{Tagged: dropbox.Tagged{"shared"}} + return s +} + +// ListUsersOnPaperDocContinueArgs : has no documentation (yet) +type ListUsersOnPaperDocContinueArgs struct { + RefPaperDoc + // Cursor : The cursor obtained from `docsUsersList` or + // `docsUsersListContinue`. Allows for pagination. + Cursor string `json:"cursor"` +} + +// NewListUsersOnPaperDocContinueArgs returns a new ListUsersOnPaperDocContinueArgs instance +func NewListUsersOnPaperDocContinueArgs(DocId string, Cursor string) *ListUsersOnPaperDocContinueArgs { + s := new(ListUsersOnPaperDocContinueArgs) + s.DocId = DocId + s.Cursor = Cursor + return s +} + +// ListUsersOnPaperDocResponse : has no documentation (yet) +type ListUsersOnPaperDocResponse struct { + // Invitees : List of email addresses with their respective permission + // levels that are invited on the Paper doc. + Invitees []*InviteeInfoWithPermissionLevel `json:"invitees"` + // Users : List of users with their respective permission levels that are + // invited on the Paper folder. + Users []*UserInfoWithPermissionLevel `json:"users"` + // DocOwner : The Paper doc owner. This field is populated on every single + // response. + DocOwner *sharing.UserInfo `json:"doc_owner"` + // Cursor : Pass the cursor into `docsUsersListContinue` to paginate through + // all users. The cursor preserves all properties as specified in the + // original call to `docsUsersList`. + Cursor *Cursor `json:"cursor"` + // HasMore : Will be set to True if a subsequent call with the provided + // cursor to `docsUsersListContinue` returns immediately with some results. + // If set to False please allow some delay before making another call to + // `docsUsersListContinue`. + HasMore bool `json:"has_more"` +} + +// NewListUsersOnPaperDocResponse returns a new ListUsersOnPaperDocResponse instance +func NewListUsersOnPaperDocResponse(Invitees []*InviteeInfoWithPermissionLevel, Users []*UserInfoWithPermissionLevel, DocOwner *sharing.UserInfo, Cursor *Cursor, HasMore bool) *ListUsersOnPaperDocResponse { + s := new(ListUsersOnPaperDocResponse) + s.Invitees = Invitees + s.Users = Users + s.DocOwner = DocOwner + s.Cursor = Cursor + s.HasMore = HasMore + return s +} + +// PaperApiCursorError : has no documentation (yet) +type PaperApiCursorError struct { + dropbox.Tagged +} + +// Valid tag values for PaperApiCursorError +const ( + PaperApiCursorErrorExpiredCursor = "expired_cursor" + PaperApiCursorErrorInvalidCursor = "invalid_cursor" + PaperApiCursorErrorWrongUserInCursor = "wrong_user_in_cursor" + PaperApiCursorErrorReset = "reset" + PaperApiCursorErrorOther = "other" +) + +// PaperDocExport : has no documentation (yet) +type PaperDocExport struct { + RefPaperDoc + // ExportFormat : has no documentation (yet) + ExportFormat *ExportFormat `json:"export_format"` +} + +// NewPaperDocExport returns a new PaperDocExport instance +func NewPaperDocExport(DocId string, ExportFormat *ExportFormat) *PaperDocExport { + s := new(PaperDocExport) + s.DocId = DocId + s.ExportFormat = ExportFormat + return s +} + +// PaperDocExportResult : has no documentation (yet) +type PaperDocExportResult struct { + // Owner : The Paper doc owner's email address. + Owner string `json:"owner"` + // Title : The Paper doc title. + Title string `json:"title"` + // Revision : The Paper doc revision. Simply an ever increasing number. + Revision int64 `json:"revision"` + // MimeType : MIME type of the export. This corresponds to `ExportFormat` + // specified in the request. + MimeType string `json:"mime_type"` +} + +// NewPaperDocExportResult returns a new PaperDocExportResult instance +func NewPaperDocExportResult(Owner string, Title string, Revision int64, MimeType string) *PaperDocExportResult { + s := new(PaperDocExportResult) + s.Owner = Owner + s.Title = Title + s.Revision = Revision + s.MimeType = MimeType + return s +} + +// PaperDocPermissionLevel : has no documentation (yet) +type PaperDocPermissionLevel struct { + dropbox.Tagged +} + +// Valid tag values for PaperDocPermissionLevel +const ( + PaperDocPermissionLevelEdit = "edit" + PaperDocPermissionLevelViewAndComment = "view_and_comment" + PaperDocPermissionLevelOther = "other" +) + +// PaperDocSharingPolicy : has no documentation (yet) +type PaperDocSharingPolicy struct { + RefPaperDoc + // SharingPolicy : The default sharing policy to be set for the Paper doc. + SharingPolicy *SharingPolicy `json:"sharing_policy"` +} + +// NewPaperDocSharingPolicy returns a new PaperDocSharingPolicy instance +func NewPaperDocSharingPolicy(DocId string, SharingPolicy *SharingPolicy) *PaperDocSharingPolicy { + s := new(PaperDocSharingPolicy) + s.DocId = DocId + s.SharingPolicy = SharingPolicy + return s +} + +// RemovePaperDocUser : has no documentation (yet) +type RemovePaperDocUser struct { + RefPaperDoc + // Member : User which should be removed from the Paper doc. Specify only + // email address or Dropbox account ID. + Member *sharing.MemberSelector `json:"member"` +} + +// NewRemovePaperDocUser returns a new RemovePaperDocUser instance +func NewRemovePaperDocUser(DocId string, Member *sharing.MemberSelector) *RemovePaperDocUser { + s := new(RemovePaperDocUser) + s.DocId = DocId + s.Member = Member + return s +} + +// SharingPolicy : Sharing policy of Paper doc. +type SharingPolicy struct { + // PublicSharingPolicy : This value applies to the non-team members. + PublicSharingPolicy *SharingPublicPolicyType `json:"public_sharing_policy,omitempty"` + // TeamSharingPolicy : This value applies to the team members only. The + // value is null for all personal accounts. + TeamSharingPolicy *SharingTeamPolicyType `json:"team_sharing_policy,omitempty"` +} + +// NewSharingPolicy returns a new SharingPolicy instance +func NewSharingPolicy() *SharingPolicy { + s := new(SharingPolicy) + return s +} + +// SharingTeamPolicyType : The sharing policy type of the Paper doc. +type SharingTeamPolicyType struct { + dropbox.Tagged +} + +// Valid tag values for SharingTeamPolicyType +const ( + SharingTeamPolicyTypePeopleWithLinkCanEdit = "people_with_link_can_edit" + SharingTeamPolicyTypePeopleWithLinkCanViewAndComment = "people_with_link_can_view_and_comment" + SharingTeamPolicyTypeInviteOnly = "invite_only" +) + +// SharingPublicPolicyType : has no documentation (yet) +type SharingPublicPolicyType struct { + dropbox.Tagged +} + +// Valid tag values for SharingPublicPolicyType +const ( + SharingPublicPolicyTypeDisabled = "disabled" +) + +// UserInfoWithPermissionLevel : has no documentation (yet) +type UserInfoWithPermissionLevel struct { + // User : User shared on the Paper doc. + User *sharing.UserInfo `json:"user"` + // PermissionLevel : Permission level for the user. + PermissionLevel *PaperDocPermissionLevel `json:"permission_level"` +} + +// NewUserInfoWithPermissionLevel returns a new UserInfoWithPermissionLevel instance +func NewUserInfoWithPermissionLevel(User *sharing.UserInfo, PermissionLevel *PaperDocPermissionLevel) *UserInfoWithPermissionLevel { + s := new(UserInfoWithPermissionLevel) + s.User = User + s.PermissionLevel = PermissionLevel + return s +} + +// UserOnPaperDocFilter : has no documentation (yet) +type UserOnPaperDocFilter struct { + dropbox.Tagged +} + +// Valid tag values for UserOnPaperDocFilter +const ( + UserOnPaperDocFilterVisited = "visited" + UserOnPaperDocFilterShared = "shared" + UserOnPaperDocFilterOther = "other" +) diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/properties/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/properties/types.go new file mode 100644 index 000000000..c03ea0e16 --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/properties/types.go @@ -0,0 +1,213 @@ +// Copyright (c) Dropbox, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package properties : This namespace contains helper entities for property and +// property/template endpoints. +package properties + +import ( + "encoding/json" + + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" +) + +// GetPropertyTemplateArg : has no documentation (yet) +type GetPropertyTemplateArg struct { + // TemplateId : An identifier for property template added by route + // properties/template/add. + TemplateId string `json:"template_id"` +} + +// NewGetPropertyTemplateArg returns a new GetPropertyTemplateArg instance +func NewGetPropertyTemplateArg(TemplateId string) *GetPropertyTemplateArg { + s := new(GetPropertyTemplateArg) + s.TemplateId = TemplateId + return s +} + +// PropertyGroupTemplate : Describes property templates that can be filled and +// associated with a file. +type PropertyGroupTemplate struct { + // Name : A display name for the property template. Property template names + // can be up to 256 bytes. + Name string `json:"name"` + // Description : Description for new property template. Property template + // descriptions can be up to 1024 bytes. + Description string `json:"description"` + // Fields : This is a list of custom properties associated with a property + // template. There can be up to 64 properties in a single property template. + Fields []*PropertyFieldTemplate `json:"fields"` +} + +// NewPropertyGroupTemplate returns a new PropertyGroupTemplate instance +func NewPropertyGroupTemplate(Name string, Description string, Fields []*PropertyFieldTemplate) *PropertyGroupTemplate { + s := new(PropertyGroupTemplate) + s.Name = Name + s.Description = Description + s.Fields = Fields + return s +} + +// GetPropertyTemplateResult : The Property template for the specified template. +type GetPropertyTemplateResult struct { + PropertyGroupTemplate +} + +// NewGetPropertyTemplateResult returns a new GetPropertyTemplateResult instance +func NewGetPropertyTemplateResult(Name string, Description string, Fields []*PropertyFieldTemplate) *GetPropertyTemplateResult { + s := new(GetPropertyTemplateResult) + s.Name = Name + s.Description = Description + s.Fields = Fields + return s +} + +// ListPropertyTemplateIds : has no documentation (yet) +type ListPropertyTemplateIds struct { + // TemplateIds : List of identifiers for templates added by route + // properties/template/add. + TemplateIds []string `json:"template_ids"` +} + +// NewListPropertyTemplateIds returns a new ListPropertyTemplateIds instance +func NewListPropertyTemplateIds(TemplateIds []string) *ListPropertyTemplateIds { + s := new(ListPropertyTemplateIds) + s.TemplateIds = TemplateIds + return s +} + +// PropertyTemplateError : has no documentation (yet) +type PropertyTemplateError struct { + dropbox.Tagged + // TemplateNotFound : Property template does not exist for given identifier. + TemplateNotFound string `json:"template_not_found,omitempty"` +} + +// Valid tag values for PropertyTemplateError +const ( + PropertyTemplateErrorTemplateNotFound = "template_not_found" + PropertyTemplateErrorRestrictedContent = "restricted_content" + PropertyTemplateErrorOther = "other" +) + +// UnmarshalJSON deserializes into a PropertyTemplateError instance +func (u *PropertyTemplateError) 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 +} + +// ModifyPropertyTemplateError : has no documentation (yet) +type ModifyPropertyTemplateError struct { + dropbox.Tagged +} + +// Valid tag values for ModifyPropertyTemplateError +const ( + ModifyPropertyTemplateErrorConflictingPropertyNames = "conflicting_property_names" + ModifyPropertyTemplateErrorTooManyProperties = "too_many_properties" + ModifyPropertyTemplateErrorTooManyTemplates = "too_many_templates" + ModifyPropertyTemplateErrorTemplateAttributeTooLarge = "template_attribute_too_large" +) + +// PropertyField : has no documentation (yet) +type PropertyField struct { + // Name : This is the name or key of a custom property in a property + // template. File property names can be up to 256 bytes. + Name string `json:"name"` + // Value : Value of a custom property attached to a file. Values can be up + // to 1024 bytes. + Value string `json:"value"` +} + +// NewPropertyField returns a new PropertyField instance +func NewPropertyField(Name string, Value string) *PropertyField { + s := new(PropertyField) + s.Name = Name + s.Value = Value + return s +} + +// PropertyFieldTemplate : Describe a single property field type which that can +// be part of a property template. +type PropertyFieldTemplate struct { + // Name : This is the name or key of a custom property in a property + // template. File property names can be up to 256 bytes. + Name string `json:"name"` + // Description : This is the description for a custom property in a property + // template. File property description can be up to 1024 bytes. + Description string `json:"description"` + // Type : This is the data type of the value of this property. This type + // will be enforced upon property creation and modifications. + Type *PropertyType `json:"type"` +} + +// NewPropertyFieldTemplate returns a new PropertyFieldTemplate instance +func NewPropertyFieldTemplate(Name string, Description string, Type *PropertyType) *PropertyFieldTemplate { + s := new(PropertyFieldTemplate) + s.Name = Name + s.Description = Description + s.Type = Type + return s +} + +// PropertyGroup : Collection of custom properties in filled property templates. +type PropertyGroup struct { + // TemplateId : A unique identifier for a property template type. + TemplateId string `json:"template_id"` + // Fields : This is a list of custom properties associated with a file. + // There can be up to 32 properties for a template. + Fields []*PropertyField `json:"fields"` +} + +// NewPropertyGroup returns a new PropertyGroup instance +func NewPropertyGroup(TemplateId string, Fields []*PropertyField) *PropertyGroup { + s := new(PropertyGroup) + s.TemplateId = TemplateId + s.Fields = Fields + return s +} + +// PropertyType : Data type of the given property added. This endpoint is in +// beta and only properties of type strings is supported. +type PropertyType struct { + dropbox.Tagged +} + +// Valid tag values for PropertyType +const ( + PropertyTypeString = "string" + PropertyTypeOther = "other" +) diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sdk.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sdk.go new file mode 100644 index 000000000..2da138970 --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sdk.go @@ -0,0 +1,186 @@ +// Copyright (c) Dropbox, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package dropbox + +import ( + "fmt" + "io" + "log" + "net/http" + + "golang.org/x/oauth2" +) + +const ( + apiVersion = 2 + defaultDomain = ".dropboxapi.com" + hostAPI = "api" + hostContent = "content" + hostNotify = "notify" + sdkVersion = "1.0.0-beta" + specVersion = "6194bea" +) + +// Version returns the current SDK version and API Spec version +func Version() (string, string) { + return sdkVersion, specVersion +} + +// Config contains parameters for configuring the SDK. +type Config struct { + // OAuth2 access token + Token string + // Enable verbose logging in SDK + Verbose bool + // Logging target for verbose SDK logging + Logger *log.Logger + // Used with APIs that support operations as another user + AsMemberID string + // No need to set -- for testing only + Domain string + // No need to set -- for testing only + Client *http.Client + // No need to set -- for testing only + HeaderGenerator func(hostType string, style string, namespace string, route string) map[string]string + // No need to set -- for testing only + 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 { + return + } + if c.Logger != nil { + c.Logger.Printf(format, v...) + } else { + log.Printf(format, v...) + } +} + +// Context is the base client context used to implement per-namespace clients. +type Context struct { + Config Config + Client *http.Client + HeaderGenerator func(hostType string, style string, namespace string, route string) map[string]string + URLGenerator func(hostType string, style string, namespace string, route string) string +} + +// NewRequest returns an appropriate Request object for the given namespace/route. +func (c *Context) NewRequest( + hostType string, + style string, + authed bool, + namespace string, + route string, + headers map[string]string, + body io.Reader, +) (*http.Request, error) { + url := c.URLGenerator(hostType, style, namespace, route) + req, err := http.NewRequest("POST", url, body) + if err != nil { + return nil, err + } + for k, v := range headers { + req.Header.Add(k, v) + } + for k, v := range c.HeaderGenerator(hostType, style, namespace, route) { + req.Header.Add(k, v) + } + if req.Header.Get("Host") != "" { + req.Host = req.Header.Get("Host") + } + if !authed { + req.Header.Del("Authorization") + } + return req, nil +} + +// NewContext returns a new Context with the given Config. +func NewContext(c Config) Context { + domain := c.Domain + if domain == "" { + domain = defaultDomain + } + + client := c.Client + if client == nil { + var conf = &oauth2.Config{Endpoint: OAuthEndpoint(domain)} + tok := &oauth2.Token{AccessToken: c.Token} + client = conf.Client(oauth2.NoContext, tok) + } + + headerGenerator := c.HeaderGenerator + if headerGenerator == nil { + headerGenerator = func(hostType string, style string, namespace string, route string) map[string]string { + return map[string]string{} + } + } + + urlGenerator := c.URLGenerator + if urlGenerator == nil { + hostMap := map[string]string{ + hostAPI: hostAPI + domain, + hostContent: hostContent + domain, + hostNotify: hostNotify + domain, + } + urlGenerator = func(hostType string, style string, namespace string, route string) string { + fqHost := hostMap[hostType] + return fmt.Sprintf("https://%s/%d/%s/%s", fqHost, apiVersion, namespace, route) + } + } + + return Context{c, client, headerGenerator, urlGenerator} +} + +// OAuthEndpoint constructs an `oauth2.Endpoint` for the given domain +func OAuthEndpoint(domain string) oauth2.Endpoint { + if domain == "" { + domain = defaultDomain + } + authURL := fmt.Sprintf("https://meta%s/1/oauth2/authorize", domain) + tokenURL := fmt.Sprintf("https://api%s/1/oauth2/token", domain) + if domain == defaultDomain { + authURL = "https://www.dropbox.com/1/oauth2/authorize" + } + return oauth2.Endpoint{AuthURL: authURL, TokenURL: tokenURL} +} + +// Tagged is used for tagged unions. +type Tagged struct { + Tag string `json:".tag"` +} + +// APIError is the base type for endpoint-specific errors. +type APIError struct { + ErrorSummary string `json:"error_summary"` +} + +func (e APIError) Error() string { + return e.ErrorSummary +} + +func init() { + // These are not registered in the oauth library by default + oauth2.RegisterBrokenAuthHeaderProvider("https://api.dropboxapi.com") + oauth2.RegisterBrokenAuthHeaderProvider("https://api-dbdev.dev.corp.dropbox.com") +} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/client.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/client.go new file mode 100644 index 000000000..e1c7a4aed --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/client.go @@ -0,0 +1,3267 @@ +// Copyright (c) Dropbox, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package sharing + +import ( + "bytes" + "encoding/json" + "io" + "io/ioutil" + "log" + "net/http" + + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/async" +) + +// Client interface describes all routes in this namespace +type Client interface { + // AddFileMember : Adds specified members to a file. + AddFileMember(arg *AddFileMemberArgs) (res []*FileMemberActionResult, err error) + // AddFolderMember : Allows an owner or editor (if the ACL update policy + // allows) of a shared folder to add another member. For the new member to + // get access to all the functionality for this folder, you will need to + // call `mountFolder` on their behalf. Apps must have full Dropbox access to + // use this endpoint. + AddFolderMember(arg *AddFolderMemberArg) (err error) + // ChangeFileMemberAccess : Identical to update_file_member but with less + // information returned. + // Deprecated: Use `UpdateFileMember` instead + ChangeFileMemberAccess(arg *ChangeFileMemberAccessArgs) (res *FileMemberActionResult, err error) + // CheckJobStatus : Returns the status of an asynchronous job. Apps must + // have full Dropbox access to use this endpoint. + CheckJobStatus(arg *async.PollArg) (res *JobStatus, err error) + // CheckRemoveMemberJobStatus : Returns the status of an asynchronous job + // for sharing a folder. Apps must have full Dropbox access to use this + // endpoint. + CheckRemoveMemberJobStatus(arg *async.PollArg) (res *RemoveMemberJobStatus, err error) + // CheckShareJobStatus : Returns the status of an asynchronous job for + // sharing a folder. Apps must have full Dropbox access to use this + // endpoint. + CheckShareJobStatus(arg *async.PollArg) (res *ShareFolderJobStatus, err error) + // CreateSharedLink : Create a shared link. If a shared link already exists + // for the given path, that link is returned. Note that in the returned + // `PathLinkMetadata`, the `PathLinkMetadata.url` field is the shortened URL + // if `CreateSharedLinkArg.short_url` argument is set to true. Previously, + // it was technically possible to break a shared link by moving or renaming + // the corresponding file or folder. In the future, this will no longer be + // the case, so your app shouldn't rely on this behavior. Instead, if your + // app needs to revoke a shared link, use `revokeSharedLink`. + // Deprecated: Use `CreateSharedLinkWithSettings` instead + CreateSharedLink(arg *CreateSharedLinkArg) (res *PathLinkMetadata, err error) + // CreateSharedLinkWithSettings : Create a shared link with custom settings. + // If no settings are given then the default visibility is + // `RequestedVisibility.public` (The resolved visibility, though, may depend + // on other aspects such as team and shared folder settings). + CreateSharedLinkWithSettings(arg *CreateSharedLinkWithSettingsArg) (res IsSharedLinkMetadata, err error) + // GetFileMetadata : Returns shared file metadata. + GetFileMetadata(arg *GetFileMetadataArg) (res *SharedFileMetadata, err error) + // GetFileMetadataBatch : Returns shared file metadata. + GetFileMetadataBatch(arg *GetFileMetadataBatchArg) (res []*GetFileMetadataBatchResult, err error) + // GetFolderMetadata : Returns shared folder metadata by its folder ID. Apps + // must have full Dropbox access to use this endpoint. + GetFolderMetadata(arg *GetMetadataArgs) (res *SharedFolderMetadata, err error) + // GetSharedLinkFile : Download the shared link's file from a user's + // Dropbox. + GetSharedLinkFile(arg *GetSharedLinkMetadataArg) (res IsSharedLinkMetadata, content io.ReadCloser, err error) + // GetSharedLinkMetadata : Get the shared link's metadata. + GetSharedLinkMetadata(arg *GetSharedLinkMetadataArg) (res IsSharedLinkMetadata, err error) + // GetSharedLinks : Returns a list of `LinkMetadata` objects for this user, + // including collection links. If no path is given, returns a list of all + // shared links for the current user, including collection links, up to a + // maximum of 1000 links. If a non-empty path is given, returns a list of + // all shared links that allow access to the given path. Collection links + // are never returned in this case. Note that the url field in the response + // is never the shortened URL. + // Deprecated: Use `ListSharedLinks` instead + GetSharedLinks(arg *GetSharedLinksArg) (res *GetSharedLinksResult, err error) + // ListFileMembers : Use to obtain the members who have been invited to a + // file, both inherited and uninherited members. + ListFileMembers(arg *ListFileMembersArg) (res *SharedFileMembers, err error) + // ListFileMembersBatch : Get members of multiple files at once. The + // arguments to this route are more limited, and the limit on query result + // size per file is more strict. To customize the results more, use the + // individual file endpoint. Inherited users and groups are not included in + // the result, and permissions are not returned for this endpoint. + ListFileMembersBatch(arg *ListFileMembersBatchArg) (res []*ListFileMembersBatchResult, err error) + // ListFileMembersContinue : Once a cursor has been retrieved from + // `listFileMembers` or `listFileMembersBatch`, use this to paginate through + // all shared file members. + ListFileMembersContinue(arg *ListFileMembersContinueArg) (res *SharedFileMembers, err error) + // ListFolderMembers : Returns shared folder membership by its folder ID. + // Apps must have full Dropbox access to use this endpoint. + ListFolderMembers(arg *ListFolderMembersArgs) (res *SharedFolderMembers, err error) + // ListFolderMembersContinue : Once a cursor has been retrieved from + // `listFolderMembers`, use this to paginate through all shared folder + // members. Apps must have full Dropbox access to use this endpoint. + ListFolderMembersContinue(arg *ListFolderMembersContinueArg) (res *SharedFolderMembers, err error) + // ListFolders : Return the list of all shared folders the current user has + // access to. Apps must have full Dropbox access to use this endpoint. + ListFolders(arg *ListFoldersArgs) (res *ListFoldersResult, err error) + // ListFoldersContinue : Once a cursor has been retrieved from + // `listFolders`, use this to paginate through all shared folders. The + // cursor must come from a previous call to `listFolders` or + // `listFoldersContinue`. Apps must have full Dropbox access to use this + // endpoint. + ListFoldersContinue(arg *ListFoldersContinueArg) (res *ListFoldersResult, err error) + // ListMountableFolders : Return the list of all shared folders the current + // user can mount or unmount. Apps must have full Dropbox access to use this + // endpoint. + ListMountableFolders(arg *ListFoldersArgs) (res *ListFoldersResult, err error) + // ListMountableFoldersContinue : Once a cursor has been retrieved from + // `listMountableFolders`, use this to paginate through all mountable shared + // folders. The cursor must come from a previous call to + // `listMountableFolders` or `listMountableFoldersContinue`. Apps must have + // full Dropbox access to use this endpoint. + ListMountableFoldersContinue(arg *ListFoldersContinueArg) (res *ListFoldersResult, err error) + // ListReceivedFiles : Returns a list of all files shared with current user. + // Does not include files the user has received via shared folders, and does + // not include unclaimed invitations. + ListReceivedFiles(arg *ListFilesArg) (res *ListFilesResult, err error) + // ListReceivedFilesContinue : Get more results with a cursor from + // `listReceivedFiles`. + ListReceivedFilesContinue(arg *ListFilesContinueArg) (res *ListFilesResult, err error) + // ListSharedLinks : List shared links of this user. If no path is given, + // returns a list of all shared links for the current user. If a non-empty + // path is given, returns a list of all shared links that allow access to + // the given path - direct links to the given path and links to parent + // folders of the given path. Links to parent folders can be suppressed by + // setting direct_only to true. + ListSharedLinks(arg *ListSharedLinksArg) (res *ListSharedLinksResult, err error) + // ModifySharedLinkSettings : Modify the shared link's settings. If the + // requested visibility conflict with the shared links policy of the team or + // the shared folder (in case the linked file is part of a shared folder) + // then the `LinkPermissions.resolved_visibility` of the returned + // `SharedLinkMetadata` will reflect the actual visibility of the shared + // link and the `LinkPermissions.requested_visibility` will reflect the + // requested visibility. + ModifySharedLinkSettings(arg *ModifySharedLinkSettingsArgs) (res IsSharedLinkMetadata, err error) + // MountFolder : The current user mounts the designated folder. Mount a + // shared folder for a user after they have been added as a member. Once + // mounted, the shared folder will appear in their Dropbox. Apps must have + // full Dropbox access to use this endpoint. + MountFolder(arg *MountFolderArg) (res *SharedFolderMetadata, err error) + // RelinquishFileMembership : The current user relinquishes their membership + // in the designated file. Note that the current user may still have + // inherited access to this file through the parent folder. Apps must have + // full Dropbox access to use this endpoint. + RelinquishFileMembership(arg *RelinquishFileMembershipArg) (err error) + // RelinquishFolderMembership : The current user relinquishes their + // membership in the designated shared folder and will no longer have access + // to the folder. A folder owner cannot relinquish membership in their own + // folder. This will run synchronously if leave_a_copy is false, and + // asynchronously if leave_a_copy is true. Apps must have full Dropbox + // access to use this endpoint. + RelinquishFolderMembership(arg *RelinquishFolderMembershipArg) (res *async.LaunchEmptyResult, err error) + // RemoveFileMember : Identical to remove_file_member_2 but with less + // information returned. + // Deprecated: Use `RemoveFileMember2` instead + RemoveFileMember(arg *RemoveFileMemberArg) (res *FileMemberActionIndividualResult, err error) + // RemoveFileMember2 : Removes a specified member from the file. + RemoveFileMember2(arg *RemoveFileMemberArg) (res *FileMemberRemoveActionResult, err error) + // RemoveFolderMember : Allows an owner or editor (if the ACL update policy + // allows) of a shared folder to remove another member. Apps must have full + // Dropbox access to use this endpoint. + RemoveFolderMember(arg *RemoveFolderMemberArg) (res *async.LaunchResultBase, err error) + // RevokeSharedLink : Revoke a shared link. Note that even after revoking a + // shared link to a file, the file may be accessible if there are shared + // links leading to any of the file parent folders. To list all shared links + // that enable access to a specific file, you can use the `listSharedLinks` + // with the file as the `ListSharedLinksArg.path` argument. + RevokeSharedLink(arg *RevokeSharedLinkArg) (err error) + // ShareFolder : Share a folder with collaborators. Most sharing will be + // completed synchronously. Large folders will be completed asynchronously. + // To make testing the async case repeatable, set + // `ShareFolderArg.force_async`. If a `ShareFolderLaunch.async_job_id` is + // returned, you'll need to call `checkShareJobStatus` until the action + // completes to get the metadata for the folder. Apps must have full Dropbox + // access to use this endpoint. + ShareFolder(arg *ShareFolderArg) (res *ShareFolderLaunch, err error) + // TransferFolder : Transfer ownership of a shared folder to a member of the + // shared folder. User must have `AccessLevel.owner` access to the shared + // folder to perform a transfer. Apps must have full Dropbox access to use + // this endpoint. + TransferFolder(arg *TransferFolderArg) (err error) + // UnmountFolder : The current user unmounts the designated folder. They can + // re-mount the folder at a later time using `mountFolder`. Apps must have + // full Dropbox access to use this endpoint. + UnmountFolder(arg *UnmountFolderArg) (err error) + // UnshareFile : Remove all members from this file. Does not remove + // inherited members. + UnshareFile(arg *UnshareFileArg) (err error) + // UnshareFolder : Allows a shared folder owner to unshare the folder. + // You'll need to call `checkJobStatus` to determine if the action has + // completed successfully. Apps must have full Dropbox access to use this + // endpoint. + UnshareFolder(arg *UnshareFolderArg) (res *async.LaunchEmptyResult, err error) + // UpdateFileMember : Changes a member's access on a shared file. + UpdateFileMember(arg *UpdateFileMemberArgs) (res *MemberAccessLevelResult, err error) + // UpdateFolderMember : Allows an owner or editor of a shared folder to + // update another member's permissions. Apps must have full Dropbox access + // to use this endpoint. + UpdateFolderMember(arg *UpdateFolderMemberArg) (res *MemberAccessLevelResult, err error) + // UpdateFolderPolicy : Update the sharing policies for a shared folder. + // User must have `AccessLevel.owner` access to the shared folder to update + // its policies. Apps must have full Dropbox access to use this endpoint. + UpdateFolderPolicy(arg *UpdateFolderPolicyArg) (res *SharedFolderMetadata, err error) +} + +type apiImpl dropbox.Context + +//AddFileMemberAPIError is an error-wrapper for the add_file_member route +type AddFileMemberAPIError struct { + dropbox.APIError + EndpointError *AddFileMemberError `json:"error"` +} + +func (dbx *apiImpl) AddFileMember(arg *AddFileMemberArgs) (res []*FileMemberActionResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "add_file_member", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError AddFileMemberAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//AddFolderMemberAPIError is an error-wrapper for the add_folder_member route +type AddFolderMemberAPIError struct { + dropbox.APIError + EndpointError *AddFolderMemberError `json:"error"` +} + +func (dbx *apiImpl) AddFolderMember(arg *AddFolderMemberArg) (err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "add_folder_member", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + return + } + if resp.StatusCode == http.StatusConflict { + var apiError AddFolderMemberAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//ChangeFileMemberAccessAPIError is an error-wrapper for the change_file_member_access route +type ChangeFileMemberAccessAPIError struct { + dropbox.APIError + EndpointError *FileMemberActionError `json:"error"` +} + +func (dbx *apiImpl) ChangeFileMemberAccess(arg *ChangeFileMemberAccessArgs) (res *FileMemberActionResult, err error) { + log.Printf("WARNING: API `ChangeFileMemberAccess` is deprecated") + log.Printf("Use API `UpdateFileMember` instead") + + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "change_file_member_access", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError ChangeFileMemberAccessAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//CheckJobStatusAPIError is an error-wrapper for the check_job_status route +type CheckJobStatusAPIError struct { + dropbox.APIError + EndpointError *async.PollError `json:"error"` +} + +func (dbx *apiImpl) CheckJobStatus(arg *async.PollArg) (res *JobStatus, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "check_job_status", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError CheckJobStatusAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//CheckRemoveMemberJobStatusAPIError is an error-wrapper for the check_remove_member_job_status route +type CheckRemoveMemberJobStatusAPIError struct { + dropbox.APIError + EndpointError *async.PollError `json:"error"` +} + +func (dbx *apiImpl) CheckRemoveMemberJobStatus(arg *async.PollArg) (res *RemoveMemberJobStatus, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "check_remove_member_job_status", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError CheckRemoveMemberJobStatusAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//CheckShareJobStatusAPIError is an error-wrapper for the check_share_job_status route +type CheckShareJobStatusAPIError struct { + dropbox.APIError + EndpointError *async.PollError `json:"error"` +} + +func (dbx *apiImpl) CheckShareJobStatus(arg *async.PollArg) (res *ShareFolderJobStatus, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "check_share_job_status", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError CheckShareJobStatusAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//CreateSharedLinkAPIError is an error-wrapper for the create_shared_link route +type CreateSharedLinkAPIError struct { + dropbox.APIError + EndpointError *CreateSharedLinkError `json:"error"` +} + +func (dbx *apiImpl) CreateSharedLink(arg *CreateSharedLinkArg) (res *PathLinkMetadata, err error) { + log.Printf("WARNING: API `CreateSharedLink` is deprecated") + log.Printf("Use API `CreateSharedLinkWithSettings` instead") + + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "create_shared_link", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError CreateSharedLinkAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//CreateSharedLinkWithSettingsAPIError is an error-wrapper for the create_shared_link_with_settings route +type CreateSharedLinkWithSettingsAPIError struct { + dropbox.APIError + EndpointError *CreateSharedLinkWithSettingsError `json:"error"` +} + +func (dbx *apiImpl) CreateSharedLinkWithSettings(arg *CreateSharedLinkWithSettingsArg) (res IsSharedLinkMetadata, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "create_shared_link_with_settings", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + var tmp sharedLinkMetadataUnion + err = json.Unmarshal(body, &tmp) + if err != nil { + return + } + switch tmp.Tag { + case "file": + res = tmp.File + + case "folder": + res = tmp.Folder + + } + return + } + if resp.StatusCode == http.StatusConflict { + var apiError CreateSharedLinkWithSettingsAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//GetFileMetadataAPIError is an error-wrapper for the get_file_metadata route +type GetFileMetadataAPIError struct { + dropbox.APIError + EndpointError *GetFileMetadataError `json:"error"` +} + +func (dbx *apiImpl) GetFileMetadata(arg *GetFileMetadataArg) (res *SharedFileMetadata, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "get_file_metadata", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GetFileMetadataAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//GetFileMetadataBatchAPIError is an error-wrapper for the get_file_metadata/batch route +type GetFileMetadataBatchAPIError struct { + dropbox.APIError + EndpointError *SharingUserError `json:"error"` +} + +func (dbx *apiImpl) GetFileMetadataBatch(arg *GetFileMetadataBatchArg) (res []*GetFileMetadataBatchResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "get_file_metadata/batch", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GetFileMetadataBatchAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//GetFolderMetadataAPIError is an error-wrapper for the get_folder_metadata route +type GetFolderMetadataAPIError struct { + dropbox.APIError + EndpointError *SharedFolderAccessError `json:"error"` +} + +func (dbx *apiImpl) GetFolderMetadata(arg *GetMetadataArgs) (res *SharedFolderMetadata, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "get_folder_metadata", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GetFolderMetadataAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//GetSharedLinkFileAPIError is an error-wrapper for the get_shared_link_file route +type GetSharedLinkFileAPIError struct { + dropbox.APIError + EndpointError *GetSharedLinkFileError `json:"error"` +} + +func (dbx *apiImpl) GetSharedLinkFile(arg *GetSharedLinkMetadataArg) (res IsSharedLinkMetadata, content io.ReadCloser, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Dropbox-API-Arg": string(b), + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("content", "download", true, "sharing", "get_shared_link_file", headers, nil) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + body := []byte(resp.Header.Get("Dropbox-API-Result")) + content = resp.Body + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + var tmp sharedLinkMetadataUnion + err = json.Unmarshal(body, &tmp) + if err != nil { + return + } + switch tmp.Tag { + case "file": + res = tmp.File + + case "folder": + res = tmp.Folder + + } + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GetSharedLinkFileAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//GetSharedLinkMetadataAPIError is an error-wrapper for the get_shared_link_metadata route +type GetSharedLinkMetadataAPIError struct { + dropbox.APIError + EndpointError *SharedLinkError `json:"error"` +} + +func (dbx *apiImpl) GetSharedLinkMetadata(arg *GetSharedLinkMetadataArg) (res IsSharedLinkMetadata, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "get_shared_link_metadata", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + var tmp sharedLinkMetadataUnion + err = json.Unmarshal(body, &tmp) + if err != nil { + return + } + switch tmp.Tag { + case "file": + res = tmp.File + + case "folder": + res = tmp.Folder + + } + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GetSharedLinkMetadataAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//GetSharedLinksAPIError is an error-wrapper for the get_shared_links route +type GetSharedLinksAPIError struct { + dropbox.APIError + EndpointError *GetSharedLinksError `json:"error"` +} + +func (dbx *apiImpl) GetSharedLinks(arg *GetSharedLinksArg) (res *GetSharedLinksResult, err error) { + log.Printf("WARNING: API `GetSharedLinks` is deprecated") + log.Printf("Use API `ListSharedLinks` instead") + + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "get_shared_links", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GetSharedLinksAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//ListFileMembersAPIError is an error-wrapper for the list_file_members route +type ListFileMembersAPIError struct { + dropbox.APIError + EndpointError *ListFileMembersError `json:"error"` +} + +func (dbx *apiImpl) ListFileMembers(arg *ListFileMembersArg) (res *SharedFileMembers, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "list_file_members", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError ListFileMembersAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//ListFileMembersBatchAPIError is an error-wrapper for the list_file_members/batch route +type ListFileMembersBatchAPIError struct { + dropbox.APIError + EndpointError *SharingUserError `json:"error"` +} + +func (dbx *apiImpl) ListFileMembersBatch(arg *ListFileMembersBatchArg) (res []*ListFileMembersBatchResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "list_file_members/batch", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError ListFileMembersBatchAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//ListFileMembersContinueAPIError is an error-wrapper for the list_file_members/continue route +type ListFileMembersContinueAPIError struct { + dropbox.APIError + EndpointError *ListFileMembersContinueError `json:"error"` +} + +func (dbx *apiImpl) ListFileMembersContinue(arg *ListFileMembersContinueArg) (res *SharedFileMembers, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "list_file_members/continue", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError ListFileMembersContinueAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//ListFolderMembersAPIError is an error-wrapper for the list_folder_members route +type ListFolderMembersAPIError struct { + dropbox.APIError + EndpointError *SharedFolderAccessError `json:"error"` +} + +func (dbx *apiImpl) ListFolderMembers(arg *ListFolderMembersArgs) (res *SharedFolderMembers, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "list_folder_members", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError ListFolderMembersAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//ListFolderMembersContinueAPIError is an error-wrapper for the list_folder_members/continue route +type ListFolderMembersContinueAPIError struct { + dropbox.APIError + EndpointError *ListFolderMembersContinueError `json:"error"` +} + +func (dbx *apiImpl) ListFolderMembersContinue(arg *ListFolderMembersContinueArg) (res *SharedFolderMembers, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "list_folder_members/continue", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError ListFolderMembersContinueAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//ListFoldersAPIError is an error-wrapper for the list_folders route +type ListFoldersAPIError struct { + dropbox.APIError + EndpointError struct{} `json:"error"` +} + +func (dbx *apiImpl) ListFolders(arg *ListFoldersArgs) (res *ListFoldersResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "list_folders", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError ListFoldersAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//ListFoldersContinueAPIError is an error-wrapper for the list_folders/continue route +type ListFoldersContinueAPIError struct { + dropbox.APIError + EndpointError *ListFoldersContinueError `json:"error"` +} + +func (dbx *apiImpl) ListFoldersContinue(arg *ListFoldersContinueArg) (res *ListFoldersResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "list_folders/continue", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError ListFoldersContinueAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//ListMountableFoldersAPIError is an error-wrapper for the list_mountable_folders route +type ListMountableFoldersAPIError struct { + dropbox.APIError + EndpointError struct{} `json:"error"` +} + +func (dbx *apiImpl) ListMountableFolders(arg *ListFoldersArgs) (res *ListFoldersResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "list_mountable_folders", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError ListMountableFoldersAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//ListMountableFoldersContinueAPIError is an error-wrapper for the list_mountable_folders/continue route +type ListMountableFoldersContinueAPIError struct { + dropbox.APIError + EndpointError *ListFoldersContinueError `json:"error"` +} + +func (dbx *apiImpl) ListMountableFoldersContinue(arg *ListFoldersContinueArg) (res *ListFoldersResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "list_mountable_folders/continue", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError ListMountableFoldersContinueAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//ListReceivedFilesAPIError is an error-wrapper for the list_received_files route +type ListReceivedFilesAPIError struct { + dropbox.APIError + EndpointError *SharingUserError `json:"error"` +} + +func (dbx *apiImpl) ListReceivedFiles(arg *ListFilesArg) (res *ListFilesResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "list_received_files", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError ListReceivedFilesAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//ListReceivedFilesContinueAPIError is an error-wrapper for the list_received_files/continue route +type ListReceivedFilesContinueAPIError struct { + dropbox.APIError + EndpointError *ListFilesContinueError `json:"error"` +} + +func (dbx *apiImpl) ListReceivedFilesContinue(arg *ListFilesContinueArg) (res *ListFilesResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "list_received_files/continue", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError ListReceivedFilesContinueAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//ListSharedLinksAPIError is an error-wrapper for the list_shared_links route +type ListSharedLinksAPIError struct { + dropbox.APIError + EndpointError *ListSharedLinksError `json:"error"` +} + +func (dbx *apiImpl) ListSharedLinks(arg *ListSharedLinksArg) (res *ListSharedLinksResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "list_shared_links", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError ListSharedLinksAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//ModifySharedLinkSettingsAPIError is an error-wrapper for the modify_shared_link_settings route +type ModifySharedLinkSettingsAPIError struct { + dropbox.APIError + EndpointError *ModifySharedLinkSettingsError `json:"error"` +} + +func (dbx *apiImpl) ModifySharedLinkSettings(arg *ModifySharedLinkSettingsArgs) (res IsSharedLinkMetadata, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "modify_shared_link_settings", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + var tmp sharedLinkMetadataUnion + err = json.Unmarshal(body, &tmp) + if err != nil { + return + } + switch tmp.Tag { + case "file": + res = tmp.File + + case "folder": + res = tmp.Folder + + } + return + } + if resp.StatusCode == http.StatusConflict { + var apiError ModifySharedLinkSettingsAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//MountFolderAPIError is an error-wrapper for the mount_folder route +type MountFolderAPIError struct { + dropbox.APIError + EndpointError *MountFolderError `json:"error"` +} + +func (dbx *apiImpl) MountFolder(arg *MountFolderArg) (res *SharedFolderMetadata, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "mount_folder", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError MountFolderAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//RelinquishFileMembershipAPIError is an error-wrapper for the relinquish_file_membership route +type RelinquishFileMembershipAPIError struct { + dropbox.APIError + EndpointError *RelinquishFileMembershipError `json:"error"` +} + +func (dbx *apiImpl) RelinquishFileMembership(arg *RelinquishFileMembershipArg) (err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "relinquish_file_membership", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + return + } + if resp.StatusCode == http.StatusConflict { + var apiError RelinquishFileMembershipAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//RelinquishFolderMembershipAPIError is an error-wrapper for the relinquish_folder_membership route +type RelinquishFolderMembershipAPIError struct { + dropbox.APIError + EndpointError *RelinquishFolderMembershipError `json:"error"` +} + +func (dbx *apiImpl) RelinquishFolderMembership(arg *RelinquishFolderMembershipArg) (res *async.LaunchEmptyResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "relinquish_folder_membership", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError RelinquishFolderMembershipAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//RemoveFileMemberAPIError is an error-wrapper for the remove_file_member route +type RemoveFileMemberAPIError struct { + dropbox.APIError + EndpointError *RemoveFileMemberError `json:"error"` +} + +func (dbx *apiImpl) RemoveFileMember(arg *RemoveFileMemberArg) (res *FileMemberActionIndividualResult, err error) { + log.Printf("WARNING: API `RemoveFileMember` is deprecated") + log.Printf("Use API `RemoveFileMember2` instead") + + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "remove_file_member", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError RemoveFileMemberAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//RemoveFileMember2APIError is an error-wrapper for the remove_file_member_2 route +type RemoveFileMember2APIError struct { + dropbox.APIError + EndpointError *RemoveFileMemberError `json:"error"` +} + +func (dbx *apiImpl) RemoveFileMember2(arg *RemoveFileMemberArg) (res *FileMemberRemoveActionResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "remove_file_member_2", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError RemoveFileMember2APIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//RemoveFolderMemberAPIError is an error-wrapper for the remove_folder_member route +type RemoveFolderMemberAPIError struct { + dropbox.APIError + EndpointError *RemoveFolderMemberError `json:"error"` +} + +func (dbx *apiImpl) RemoveFolderMember(arg *RemoveFolderMemberArg) (res *async.LaunchResultBase, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "remove_folder_member", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError RemoveFolderMemberAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//RevokeSharedLinkAPIError is an error-wrapper for the revoke_shared_link route +type RevokeSharedLinkAPIError struct { + dropbox.APIError + EndpointError *RevokeSharedLinkError `json:"error"` +} + +func (dbx *apiImpl) RevokeSharedLink(arg *RevokeSharedLinkArg) (err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "revoke_shared_link", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + return + } + if resp.StatusCode == http.StatusConflict { + var apiError RevokeSharedLinkAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//ShareFolderAPIError is an error-wrapper for the share_folder route +type ShareFolderAPIError struct { + dropbox.APIError + EndpointError *ShareFolderError `json:"error"` +} + +func (dbx *apiImpl) ShareFolder(arg *ShareFolderArg) (res *ShareFolderLaunch, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "share_folder", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError ShareFolderAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//TransferFolderAPIError is an error-wrapper for the transfer_folder route +type TransferFolderAPIError struct { + dropbox.APIError + EndpointError *TransferFolderError `json:"error"` +} + +func (dbx *apiImpl) TransferFolder(arg *TransferFolderArg) (err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "transfer_folder", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + return + } + if resp.StatusCode == http.StatusConflict { + var apiError TransferFolderAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//UnmountFolderAPIError is an error-wrapper for the unmount_folder route +type UnmountFolderAPIError struct { + dropbox.APIError + EndpointError *UnmountFolderError `json:"error"` +} + +func (dbx *apiImpl) UnmountFolder(arg *UnmountFolderArg) (err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "unmount_folder", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + return + } + if resp.StatusCode == http.StatusConflict { + var apiError UnmountFolderAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//UnshareFileAPIError is an error-wrapper for the unshare_file route +type UnshareFileAPIError struct { + dropbox.APIError + EndpointError *UnshareFileError `json:"error"` +} + +func (dbx *apiImpl) UnshareFile(arg *UnshareFileArg) (err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "unshare_file", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + return + } + if resp.StatusCode == http.StatusConflict { + var apiError UnshareFileAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//UnshareFolderAPIError is an error-wrapper for the unshare_folder route +type UnshareFolderAPIError struct { + dropbox.APIError + EndpointError *UnshareFolderError `json:"error"` +} + +func (dbx *apiImpl) UnshareFolder(arg *UnshareFolderArg) (res *async.LaunchEmptyResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "unshare_folder", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError UnshareFolderAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//UpdateFileMemberAPIError is an error-wrapper for the update_file_member route +type UpdateFileMemberAPIError struct { + dropbox.APIError + EndpointError *FileMemberActionError `json:"error"` +} + +func (dbx *apiImpl) UpdateFileMember(arg *UpdateFileMemberArgs) (res *MemberAccessLevelResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "update_file_member", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError UpdateFileMemberAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//UpdateFolderMemberAPIError is an error-wrapper for the update_folder_member route +type UpdateFolderMemberAPIError struct { + dropbox.APIError + EndpointError *UpdateFolderMemberError `json:"error"` +} + +func (dbx *apiImpl) UpdateFolderMember(arg *UpdateFolderMemberArg) (res *MemberAccessLevelResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "update_folder_member", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError UpdateFolderMemberAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//UpdateFolderPolicyAPIError is an error-wrapper for the update_folder_policy route +type UpdateFolderPolicyAPIError struct { + dropbox.APIError + EndpointError *UpdateFolderPolicyError `json:"error"` +} + +func (dbx *apiImpl) UpdateFolderPolicy(arg *UpdateFolderPolicyArg) (res *SharedFolderMetadata, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "sharing", "update_folder_policy", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError UpdateFolderPolicyAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +// New returns a Client implementation for this namespace +func New(c dropbox.Config) *apiImpl { + ctx := apiImpl(dropbox.NewContext(c)) + return &ctx +} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/metadata.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/metadata.go new file mode 100644 index 000000000..9d70db8b6 --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/metadata.go @@ -0,0 +1,49 @@ +// Copyright (c) Dropbox, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package sharing + +import "encoding/json" + +type listSharedLinksResult struct { + Links []sharedLinkMetadataUnion `json:"links"` + HasMore bool `json:"has_more"` + Cursor string `json:"cursor,omitempty"` +} + +// UnmarshalJSON deserializes into a ListSharedLinksResult instance +func (r *ListSharedLinksResult) UnmarshalJSON(b []byte) error { + var l listSharedLinksResult + if err := json.Unmarshal(b, &l); err != nil { + return err + } + r.Cursor = l.Cursor + r.HasMore = l.HasMore + r.Links = make([]IsSharedLinkMetadata, len(l.Links)) + for i, e := range l.Links { + switch e.Tag { + case "file": + r.Links[i] = e.File + case "folder": + r.Links[i] = e.Folder + } + } + return nil +} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/types.go new file mode 100644 index 000000000..0c4d669a8 --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/types.go @@ -0,0 +1,4172 @@ +// Copyright (c) Dropbox, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package sharing : This namespace contains endpoints and data types for +// creating and managing shared links and shared folders. +package sharing + +import ( + "encoding/json" + "time" + + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files" + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_common" + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users" +) + +// AccessLevel : Defines the access levels for collaborators. +type AccessLevel struct { + dropbox.Tagged +} + +// Valid tag values for AccessLevel +const ( + AccessLevelOwner = "owner" + AccessLevelEditor = "editor" + AccessLevelViewer = "viewer" + AccessLevelViewerNoComment = "viewer_no_comment" + AccessLevelOther = "other" +) + +// AclUpdatePolicy : Who can change a shared folder's access control list (ACL). +// In other words, who can add, remove, or change the privileges of members. +type AclUpdatePolicy struct { + dropbox.Tagged +} + +// Valid tag values for AclUpdatePolicy +const ( + AclUpdatePolicyOwner = "owner" + AclUpdatePolicyEditors = "editors" + AclUpdatePolicyOther = "other" +) + +// AddFileMemberArgs : Arguments for `addFileMember`. +type AddFileMemberArgs struct { + // File : File to which to add members. + File string `json:"file"` + // Members : Members to add. Note that even an email address is given, this + // may result in a user being directy added to the membership if that email + // is the user's main account email. + Members []*MemberSelector `json:"members"` + // CustomMessage : Message to send to added members in their invitation. + CustomMessage string `json:"custom_message,omitempty"` + // Quiet : Whether added members should be notified via device notifications + // of their invitation. + Quiet bool `json:"quiet"` + // AccessLevel : AccessLevel union object, describing what access level we + // want to give new members. + AccessLevel *AccessLevel `json:"access_level"` + // AddMessageAsComment : If the custom message should be added as a comment + // on the file. + AddMessageAsComment bool `json:"add_message_as_comment"` +} + +// NewAddFileMemberArgs returns a new AddFileMemberArgs instance +func NewAddFileMemberArgs(File string, Members []*MemberSelector) *AddFileMemberArgs { + s := new(AddFileMemberArgs) + s.File = File + s.Members = Members + s.Quiet = false + s.AccessLevel = &AccessLevel{Tagged: dropbox.Tagged{"viewer"}} + s.AddMessageAsComment = false + return s +} + +// AddFileMemberError : Errors for `addFileMember`. +type AddFileMemberError struct { + dropbox.Tagged + // UserError : has no documentation (yet) + UserError *SharingUserError `json:"user_error,omitempty"` + // AccessError : has no documentation (yet) + AccessError *SharingFileAccessError `json:"access_error,omitempty"` +} + +// Valid tag values for AddFileMemberError +const ( + AddFileMemberErrorUserError = "user_error" + AddFileMemberErrorAccessError = "access_error" + AddFileMemberErrorRateLimit = "rate_limit" + AddFileMemberErrorInvalidComment = "invalid_comment" + AddFileMemberErrorOther = "other" +) + +// UnmarshalJSON deserializes into a AddFileMemberError instance +func (u *AddFileMemberError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // UserError : has no documentation (yet) + UserError json.RawMessage `json:"user_error,omitempty"` + // AccessError : has no documentation (yet) + AccessError json.RawMessage `json:"access_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 "user_error": + err = json.Unmarshal(w.UserError, &u.UserError) + + if err != nil { + return err + } + case "access_error": + err = json.Unmarshal(w.AccessError, &u.AccessError) + + if err != nil { + return err + } + } + return nil +} + +// AddFolderMemberArg : has no documentation (yet) +type AddFolderMemberArg struct { + // SharedFolderId : The ID for the shared folder. + SharedFolderId string `json:"shared_folder_id"` + // Members : The intended list of members to add. Added members will + // receive invites to join the shared folder. + Members []*AddMember `json:"members"` + // Quiet : Whether added members should be notified via email and device + // notifications of their invite. + Quiet bool `json:"quiet"` + // CustomMessage : Optional message to display to added members in their + // invitation. + CustomMessage string `json:"custom_message,omitempty"` +} + +// NewAddFolderMemberArg returns a new AddFolderMemberArg instance +func NewAddFolderMemberArg(SharedFolderId string, Members []*AddMember) *AddFolderMemberArg { + s := new(AddFolderMemberArg) + s.SharedFolderId = SharedFolderId + s.Members = Members + s.Quiet = false + return s +} + +// AddFolderMemberError : has no documentation (yet) +type AddFolderMemberError struct { + dropbox.Tagged + // AccessError : Unable to access shared folder. + AccessError *SharedFolderAccessError `json:"access_error,omitempty"` + // BadMember : `AddFolderMemberArg.members` contains a bad invitation + // recipient. + BadMember *AddMemberSelectorError `json:"bad_member,omitempty"` + // TooManyMembers : The value is the member limit that was reached. + TooManyMembers uint64 `json:"too_many_members,omitempty"` + // TooManyPendingInvites : The value is the pending invite limit that was + // reached. + TooManyPendingInvites uint64 `json:"too_many_pending_invites,omitempty"` +} + +// Valid tag values for AddFolderMemberError +const ( + AddFolderMemberErrorAccessError = "access_error" + AddFolderMemberErrorEmailUnverified = "email_unverified" + AddFolderMemberErrorBadMember = "bad_member" + AddFolderMemberErrorCantShareOutsideTeam = "cant_share_outside_team" + AddFolderMemberErrorTooManyMembers = "too_many_members" + AddFolderMemberErrorTooManyPendingInvites = "too_many_pending_invites" + AddFolderMemberErrorRateLimit = "rate_limit" + AddFolderMemberErrorTooManyInvitees = "too_many_invitees" + AddFolderMemberErrorInsufficientPlan = "insufficient_plan" + AddFolderMemberErrorTeamFolder = "team_folder" + AddFolderMemberErrorNoPermission = "no_permission" + AddFolderMemberErrorOther = "other" +) + +// UnmarshalJSON deserializes into a AddFolderMemberError instance +func (u *AddFolderMemberError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // AccessError : Unable to access shared folder. + AccessError json.RawMessage `json:"access_error,omitempty"` + // BadMember : `AddFolderMemberArg.members` contains a bad invitation + // recipient. + BadMember json.RawMessage `json:"bad_member,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 "bad_member": + err = json.Unmarshal(w.BadMember, &u.BadMember) + + if err != nil { + return err + } + case "too_many_members": + err = json.Unmarshal(body, &u.TooManyMembers) + + if err != nil { + return err + } + case "too_many_pending_invites": + err = json.Unmarshal(body, &u.TooManyPendingInvites) + + if err != nil { + return err + } + } + return nil +} + +// AddMember : The member and type of access the member should have when added +// to a shared folder. +type AddMember struct { + // Member : The member to add to the shared folder. + Member *MemberSelector `json:"member"` + // AccessLevel : The access level to grant `member` to the shared folder. + // `AccessLevel.owner` is disallowed. + AccessLevel *AccessLevel `json:"access_level"` +} + +// NewAddMember returns a new AddMember instance +func NewAddMember(Member *MemberSelector) *AddMember { + s := new(AddMember) + s.Member = Member + s.AccessLevel = &AccessLevel{Tagged: dropbox.Tagged{"viewer"}} + return s +} + +// AddMemberSelectorError : has no documentation (yet) +type AddMemberSelectorError struct { + dropbox.Tagged + // InvalidDropboxId : The value is the ID that could not be identified. + InvalidDropboxId string `json:"invalid_dropbox_id,omitempty"` + // InvalidEmail : The value is the e-email address that is malformed. + InvalidEmail string `json:"invalid_email,omitempty"` + // UnverifiedDropboxId : The value is the ID of the Dropbox user with an + // unverified e-mail address. Invite unverified users by e-mail address + // instead of by their Dropbox ID. + UnverifiedDropboxId string `json:"unverified_dropbox_id,omitempty"` +} + +// Valid tag values for AddMemberSelectorError +const ( + AddMemberSelectorErrorAutomaticGroup = "automatic_group" + AddMemberSelectorErrorInvalidDropboxId = "invalid_dropbox_id" + AddMemberSelectorErrorInvalidEmail = "invalid_email" + AddMemberSelectorErrorUnverifiedDropboxId = "unverified_dropbox_id" + AddMemberSelectorErrorGroupDeleted = "group_deleted" + AddMemberSelectorErrorGroupNotOnTeam = "group_not_on_team" + AddMemberSelectorErrorOther = "other" +) + +// UnmarshalJSON deserializes into a AddMemberSelectorError instance +func (u *AddMemberSelectorError) 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 "invalid_dropbox_id": + err = json.Unmarshal(body, &u.InvalidDropboxId) + + if err != nil { + return err + } + case "invalid_email": + err = json.Unmarshal(body, &u.InvalidEmail) + + if err != nil { + return err + } + case "unverified_dropbox_id": + err = json.Unmarshal(body, &u.UnverifiedDropboxId) + + if err != nil { + return err + } + } + return nil +} + +// AudienceExceptionContentInfo : Information about the content that has a link +// audience different than that of this folder. +type AudienceExceptionContentInfo struct { + // Name : The name of the content, which is either a file or a folder. + Name string `json:"name"` +} + +// NewAudienceExceptionContentInfo returns a new AudienceExceptionContentInfo instance +func NewAudienceExceptionContentInfo(Name string) *AudienceExceptionContentInfo { + s := new(AudienceExceptionContentInfo) + s.Name = Name + return s +} + +// AudienceExceptions : The total count and truncated list of information of +// content inside this folder that has a different audience than the link on +// this folder. This is only returned for folders. +type AudienceExceptions struct { + // Count : has no documentation (yet) + Count uint32 `json:"count"` + // Exceptions : A truncated list of some of the content that is an + // exception. The length of this list could be smaller than the count since + // it is only a sample but will not be empty as long as count is not 0. + Exceptions []*AudienceExceptionContentInfo `json:"exceptions"` +} + +// NewAudienceExceptions returns a new AudienceExceptions instance +func NewAudienceExceptions(Count uint32, Exceptions []*AudienceExceptionContentInfo) *AudienceExceptions { + s := new(AudienceExceptions) + s.Count = Count + s.Exceptions = Exceptions + return s +} + +// AudienceRestrictingSharedFolder : Information about the shared folder that +// prevents the link audience for this link from being more restrictive. +type AudienceRestrictingSharedFolder struct { + // SharedFolderId : The ID of the shared folder. + SharedFolderId string `json:"shared_folder_id"` + // Name : The name of the shared folder. + Name string `json:"name"` + // Audience : The link audience of the shared folder. + Audience *LinkAudience `json:"audience"` +} + +// NewAudienceRestrictingSharedFolder returns a new AudienceRestrictingSharedFolder instance +func NewAudienceRestrictingSharedFolder(SharedFolderId string, Name string, Audience *LinkAudience) *AudienceRestrictingSharedFolder { + s := new(AudienceRestrictingSharedFolder) + s.SharedFolderId = SharedFolderId + s.Name = Name + s.Audience = Audience + return s +} + +// ChangeFileMemberAccessArgs : Arguments for `changeFileMemberAccess`. +type ChangeFileMemberAccessArgs struct { + // File : File for which we are changing a member's access. + File string `json:"file"` + // Member : The member whose access we are changing. + Member *MemberSelector `json:"member"` + // AccessLevel : The new access level for the member. + AccessLevel *AccessLevel `json:"access_level"` +} + +// NewChangeFileMemberAccessArgs returns a new ChangeFileMemberAccessArgs instance +func NewChangeFileMemberAccessArgs(File string, Member *MemberSelector, AccessLevel *AccessLevel) *ChangeFileMemberAccessArgs { + s := new(ChangeFileMemberAccessArgs) + s.File = File + s.Member = Member + s.AccessLevel = AccessLevel + return s +} + +// LinkMetadata : Metadata for a shared link. This can be either a +// `PathLinkMetadata` or `CollectionLinkMetadata`. +type LinkMetadata struct { + // Url : URL of the shared link. + Url string `json:"url"` + // Visibility : Who can access the link. + Visibility *Visibility `json:"visibility"` + // Expires : Expiration time, if set. By default the link won't expire. + Expires time.Time `json:"expires,omitempty"` +} + +// NewLinkMetadata returns a new LinkMetadata instance +func NewLinkMetadata(Url string, Visibility *Visibility) *LinkMetadata { + s := new(LinkMetadata) + s.Url = Url + s.Visibility = Visibility + return s +} + +// IsLinkMetadata is the interface type for LinkMetadata and its subtypes +type IsLinkMetadata interface { + IsLinkMetadata() +} + +// IsLinkMetadata implements the IsLinkMetadata interface +func (u *LinkMetadata) IsLinkMetadata() {} + +type linkMetadataUnion struct { + dropbox.Tagged + // Path : has no documentation (yet) + Path *PathLinkMetadata `json:"path,omitempty"` + // Collection : has no documentation (yet) + Collection *CollectionLinkMetadata `json:"collection,omitempty"` +} + +// Valid tag values for LinkMetadata +const ( + LinkMetadataPath = "path" + LinkMetadataCollection = "collection" +) + +// UnmarshalJSON deserializes into a linkMetadataUnion instance +func (u *linkMetadataUnion) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Path : has no documentation (yet) + Path json.RawMessage `json:"path,omitempty"` + // Collection : has no documentation (yet) + Collection json.RawMessage `json:"collection,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 "path": + err = json.Unmarshal(body, &u.Path) + + if err != nil { + return err + } + case "collection": + err = json.Unmarshal(body, &u.Collection) + + if err != nil { + return err + } + } + return nil +} + +// IsLinkMetadataFromJSON converts JSON to a concrete IsLinkMetadata instance +func IsLinkMetadataFromJSON(data []byte) (IsLinkMetadata, error) { + var t linkMetadataUnion + if err := json.Unmarshal(data, &t); err != nil { + return nil, err + } + switch t.Tag { + case "path": + return t.Path, nil + + case "collection": + return t.Collection, nil + + } + return nil, nil +} + +// CollectionLinkMetadata : Metadata for a collection-based shared link. +type CollectionLinkMetadata struct { + LinkMetadata +} + +// NewCollectionLinkMetadata returns a new CollectionLinkMetadata instance +func NewCollectionLinkMetadata(Url string, Visibility *Visibility) *CollectionLinkMetadata { + s := new(CollectionLinkMetadata) + s.Url = Url + s.Visibility = Visibility + return s +} + +// CreateSharedLinkArg : has no documentation (yet) +type CreateSharedLinkArg struct { + // Path : The path to share. + Path string `json:"path"` + // ShortUrl : Whether to return a shortened URL. + ShortUrl bool `json:"short_url"` + // PendingUpload : If it's okay to share a path that does not yet exist, set + // this to either `PendingUploadMode.file` or `PendingUploadMode.folder` to + // indicate whether to assume it's a file or folder. + PendingUpload *PendingUploadMode `json:"pending_upload,omitempty"` +} + +// NewCreateSharedLinkArg returns a new CreateSharedLinkArg instance +func NewCreateSharedLinkArg(Path string) *CreateSharedLinkArg { + s := new(CreateSharedLinkArg) + s.Path = Path + s.ShortUrl = false + return s +} + +// CreateSharedLinkError : has no documentation (yet) +type CreateSharedLinkError struct { + dropbox.Tagged + // Path : has no documentation (yet) + Path *files.LookupError `json:"path,omitempty"` +} + +// Valid tag values for CreateSharedLinkError +const ( + CreateSharedLinkErrorPath = "path" + CreateSharedLinkErrorOther = "other" +) + +// UnmarshalJSON deserializes into a CreateSharedLinkError instance +func (u *CreateSharedLinkError) 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 "path": + err = json.Unmarshal(w.Path, &u.Path) + + if err != nil { + return err + } + } + return nil +} + +// CreateSharedLinkWithSettingsArg : has no documentation (yet) +type CreateSharedLinkWithSettingsArg struct { + // Path : The path to be shared by the shared link + Path string `json:"path"` + // Settings : The requested settings for the newly created shared link + Settings *SharedLinkSettings `json:"settings,omitempty"` +} + +// NewCreateSharedLinkWithSettingsArg returns a new CreateSharedLinkWithSettingsArg instance +func NewCreateSharedLinkWithSettingsArg(Path string) *CreateSharedLinkWithSettingsArg { + s := new(CreateSharedLinkWithSettingsArg) + s.Path = Path + return s +} + +// CreateSharedLinkWithSettingsError : has no documentation (yet) +type CreateSharedLinkWithSettingsError struct { + dropbox.Tagged + // Path : has no documentation (yet) + Path *files.LookupError `json:"path,omitempty"` + // SettingsError : There is an error with the given settings + SettingsError *SharedLinkSettingsError `json:"settings_error,omitempty"` +} + +// Valid tag values for CreateSharedLinkWithSettingsError +const ( + CreateSharedLinkWithSettingsErrorPath = "path" + CreateSharedLinkWithSettingsErrorEmailNotVerified = "email_not_verified" + CreateSharedLinkWithSettingsErrorSharedLinkAlreadyExists = "shared_link_already_exists" + CreateSharedLinkWithSettingsErrorSettingsError = "settings_error" + CreateSharedLinkWithSettingsErrorAccessDenied = "access_denied" +) + +// UnmarshalJSON deserializes into a CreateSharedLinkWithSettingsError instance +func (u *CreateSharedLinkWithSettingsError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Path : has no documentation (yet) + Path json.RawMessage `json:"path,omitempty"` + // SettingsError : There is an error with the given settings + SettingsError json.RawMessage `json:"settings_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 "path": + err = json.Unmarshal(w.Path, &u.Path) + + if err != nil { + return err + } + case "settings_error": + err = json.Unmarshal(w.SettingsError, &u.SettingsError) + + if err != nil { + return err + } + } + return nil +} + +// SharedContentLinkMetadataBase : has no documentation (yet) +type SharedContentLinkMetadataBase struct { + // AccessLevel : The access level on the link for this file. + AccessLevel *AccessLevel `json:"access_level,omitempty"` + // AudienceOptions : The audience options that are available for the + // content. Some audience options may be unavailable. For example, team_only + // may be unavailable if the content is not owned by a user on a team. The + // 'default' audience option is always available if the user can modify link + // settings. + AudienceOptions []*LinkAudience `json:"audience_options"` + // AudienceRestrictingSharedFolder : The shared folder that prevents the + // link audience for this link from being more restrictive. + AudienceRestrictingSharedFolder *AudienceRestrictingSharedFolder `json:"audience_restricting_shared_folder,omitempty"` + // CurrentAudience : The current audience of the link. + CurrentAudience *LinkAudience `json:"current_audience"` + // Expiry : Whether the link has an expiry set on it. A link with an expiry + // will have its audience changed to members when the expiry is reached. + Expiry time.Time `json:"expiry,omitempty"` + // LinkPermissions : A list of permissions for actions you can perform on + // the link. + LinkPermissions []*LinkPermission `json:"link_permissions"` + // PasswordProtected : Whether the link is protected by a password. + PasswordProtected bool `json:"password_protected"` +} + +// NewSharedContentLinkMetadataBase returns a new SharedContentLinkMetadataBase instance +func NewSharedContentLinkMetadataBase(AudienceOptions []*LinkAudience, CurrentAudience *LinkAudience, LinkPermissions []*LinkPermission, PasswordProtected bool) *SharedContentLinkMetadataBase { + s := new(SharedContentLinkMetadataBase) + s.AudienceOptions = AudienceOptions + s.CurrentAudience = CurrentAudience + s.LinkPermissions = LinkPermissions + s.PasswordProtected = PasswordProtected + return s +} + +// ExpectedSharedContentLinkMetadata : The expected metadata of a shared link +// for a file or folder when a link is first created for the content. Absent if +// the link already exists. +type ExpectedSharedContentLinkMetadata struct { + SharedContentLinkMetadataBase +} + +// NewExpectedSharedContentLinkMetadata returns a new ExpectedSharedContentLinkMetadata instance +func NewExpectedSharedContentLinkMetadata(AudienceOptions []*LinkAudience, CurrentAudience *LinkAudience, LinkPermissions []*LinkPermission, PasswordProtected bool) *ExpectedSharedContentLinkMetadata { + s := new(ExpectedSharedContentLinkMetadata) + s.AudienceOptions = AudienceOptions + s.CurrentAudience = CurrentAudience + s.LinkPermissions = LinkPermissions + s.PasswordProtected = PasswordProtected + return s +} + +// FileAction : Sharing actions that may be taken on files. +type FileAction struct { + dropbox.Tagged +} + +// Valid tag values for FileAction +const ( + FileActionDisableViewerInfo = "disable_viewer_info" + FileActionEditContents = "edit_contents" + FileActionEnableViewerInfo = "enable_viewer_info" + FileActionInviteViewer = "invite_viewer" + FileActionInviteViewerNoComment = "invite_viewer_no_comment" + FileActionUnshare = "unshare" + FileActionRelinquishMembership = "relinquish_membership" + FileActionShareLink = "share_link" + FileActionCreateLink = "create_link" + FileActionOther = "other" +) + +// FileErrorResult : has no documentation (yet) +type FileErrorResult struct { + dropbox.Tagged + // FileNotFoundError : File specified by id was not found. + FileNotFoundError string `json:"file_not_found_error,omitempty"` + // InvalidFileActionError : User does not have permission to take the + // specified action on the file. + InvalidFileActionError string `json:"invalid_file_action_error,omitempty"` + // PermissionDeniedError : User does not have permission to access file + // specified by file.Id. + PermissionDeniedError string `json:"permission_denied_error,omitempty"` +} + +// Valid tag values for FileErrorResult +const ( + FileErrorResultFileNotFoundError = "file_not_found_error" + FileErrorResultInvalidFileActionError = "invalid_file_action_error" + FileErrorResultPermissionDeniedError = "permission_denied_error" + FileErrorResultOther = "other" +) + +// UnmarshalJSON deserializes into a FileErrorResult instance +func (u *FileErrorResult) 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 "file_not_found_error": + err = json.Unmarshal(body, &u.FileNotFoundError) + + if err != nil { + return err + } + case "invalid_file_action_error": + err = json.Unmarshal(body, &u.InvalidFileActionError) + + if err != nil { + return err + } + case "permission_denied_error": + err = json.Unmarshal(body, &u.PermissionDeniedError) + + if err != nil { + return err + } + } + return nil +} + +// SharedLinkMetadata : The metadata of a shared link +type SharedLinkMetadata struct { + // Url : URL of the shared link. + Url string `json:"url"` + // Id : A unique identifier for the linked file. + Id string `json:"id,omitempty"` + // Name : The linked file name (including extension). This never contains a + // slash. + Name string `json:"name"` + // Expires : Expiration time, if set. By default the link won't expire. + Expires time.Time `json:"expires,omitempty"` + // PathLower : The lowercased full path in the user's Dropbox. This always + // starts with a slash. This field will only be present only if the linked + // file is in the authenticated user's dropbox. + PathLower string `json:"path_lower,omitempty"` + // LinkPermissions : The link's access permissions. + LinkPermissions *LinkPermissions `json:"link_permissions"` + // TeamMemberInfo : The team membership information of the link's owner. + // This field will only be present if the link's owner is a team member. + TeamMemberInfo *TeamMemberInfo `json:"team_member_info,omitempty"` + // ContentOwnerTeamInfo : The team information of the content's owner. This + // field will only be present if the content's owner is a team member and + // the content's owner team is different from the link's owner team. + ContentOwnerTeamInfo *users.Team `json:"content_owner_team_info,omitempty"` +} + +// NewSharedLinkMetadata returns a new SharedLinkMetadata instance +func NewSharedLinkMetadata(Url string, Name string, LinkPermissions *LinkPermissions) *SharedLinkMetadata { + s := new(SharedLinkMetadata) + s.Url = Url + s.Name = Name + s.LinkPermissions = LinkPermissions + return s +} + +// IsSharedLinkMetadata is the interface type for SharedLinkMetadata and its subtypes +type IsSharedLinkMetadata interface { + IsSharedLinkMetadata() +} + +// IsSharedLinkMetadata implements the IsSharedLinkMetadata interface +func (u *SharedLinkMetadata) IsSharedLinkMetadata() {} + +type sharedLinkMetadataUnion struct { + dropbox.Tagged + // File : has no documentation (yet) + File *FileLinkMetadata `json:"file,omitempty"` + // Folder : has no documentation (yet) + Folder *FolderLinkMetadata `json:"folder,omitempty"` +} + +// Valid tag values for SharedLinkMetadata +const ( + SharedLinkMetadataFile = "file" + SharedLinkMetadataFolder = "folder" +) + +// UnmarshalJSON deserializes into a sharedLinkMetadataUnion instance +func (u *sharedLinkMetadataUnion) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // File : has no documentation (yet) + File json.RawMessage `json:"file,omitempty"` + // Folder : has no documentation (yet) + Folder json.RawMessage `json:"folder,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 "file": + err = json.Unmarshal(body, &u.File) + + if err != nil { + return err + } + case "folder": + err = json.Unmarshal(body, &u.Folder) + + if err != nil { + return err + } + } + return nil +} + +// IsSharedLinkMetadataFromJSON converts JSON to a concrete IsSharedLinkMetadata instance +func IsSharedLinkMetadataFromJSON(data []byte) (IsSharedLinkMetadata, error) { + var t sharedLinkMetadataUnion + if err := json.Unmarshal(data, &t); err != nil { + return nil, err + } + switch t.Tag { + case "file": + return t.File, nil + + case "folder": + return t.Folder, nil + + } + return nil, nil +} + +// FileLinkMetadata : The metadata of a file shared link +type FileLinkMetadata struct { + SharedLinkMetadata + // ClientModified : The modification time set by the desktop client when the + // file was added to Dropbox. Since this time is not verified (the Dropbox + // server stores whatever the desktop client sends up), this should only be + // used for display purposes (such as sorting) and not, for example, to + // determine if a file has changed or not. + ClientModified time.Time `json:"client_modified"` + // ServerModified : The last time the file was modified on Dropbox. + ServerModified time.Time `json:"server_modified"` + // Rev : A unique identifier for the current revision of a file. This field + // is the same rev as elsewhere in the API and can be used to detect changes + // and avoid conflicts. + Rev string `json:"rev"` + // Size : The file size in bytes. + Size uint64 `json:"size"` +} + +// NewFileLinkMetadata returns a new FileLinkMetadata instance +func NewFileLinkMetadata(Url string, Name string, LinkPermissions *LinkPermissions, ClientModified time.Time, ServerModified time.Time, Rev string, Size uint64) *FileLinkMetadata { + s := new(FileLinkMetadata) + s.Url = Url + s.Name = Name + s.LinkPermissions = LinkPermissions + s.ClientModified = ClientModified + s.ServerModified = ServerModified + s.Rev = Rev + s.Size = Size + return s +} + +// FileMemberActionError : has no documentation (yet) +type FileMemberActionError struct { + dropbox.Tagged + // AccessError : Specified file was invalid or user does not have access. + AccessError *SharingFileAccessError `json:"access_error,omitempty"` + // NoExplicitAccess : The action cannot be completed because the target + // member does not have explicit access to the file. The return value is the + // access that the member has to the file from a parent folder. + NoExplicitAccess *MemberAccessLevelResult `json:"no_explicit_access,omitempty"` +} + +// Valid tag values for FileMemberActionError +const ( + FileMemberActionErrorInvalidMember = "invalid_member" + FileMemberActionErrorNoPermission = "no_permission" + FileMemberActionErrorAccessError = "access_error" + FileMemberActionErrorNoExplicitAccess = "no_explicit_access" + FileMemberActionErrorOther = "other" +) + +// UnmarshalJSON deserializes into a FileMemberActionError instance +func (u *FileMemberActionError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // AccessError : Specified file was invalid or user does not have + // access. + AccessError json.RawMessage `json:"access_error,omitempty"` + // NoExplicitAccess : The action cannot be completed because the target + // member does not have explicit access to the file. The return value is + // the access that the member has to the file from a parent folder. + NoExplicitAccess json.RawMessage `json:"no_explicit_access,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 "no_explicit_access": + err = json.Unmarshal(body, &u.NoExplicitAccess) + + if err != nil { + return err + } + } + return nil +} + +// FileMemberActionIndividualResult : has no documentation (yet) +type FileMemberActionIndividualResult struct { + dropbox.Tagged + // Success : Member was successfully removed from this file. If AccessLevel + // is given, the member still has access via a parent shared folder. + Success *AccessLevel `json:"success,omitempty"` + // MemberError : User was not able to perform this action. + MemberError *FileMemberActionError `json:"member_error,omitempty"` +} + +// Valid tag values for FileMemberActionIndividualResult +const ( + FileMemberActionIndividualResultSuccess = "success" + FileMemberActionIndividualResultMemberError = "member_error" +) + +// UnmarshalJSON deserializes into a FileMemberActionIndividualResult instance +func (u *FileMemberActionIndividualResult) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Success : Member was successfully removed from this file. If + // AccessLevel is given, the member still has access via a parent shared + // folder. + Success json.RawMessage `json:"success,omitempty"` + // MemberError : User was not able to perform this action. + MemberError json.RawMessage `json:"member_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 "success": + err = json.Unmarshal(body, &u.Success) + + if err != nil { + return err + } + case "member_error": + err = json.Unmarshal(w.MemberError, &u.MemberError) + + if err != nil { + return err + } + } + return nil +} + +// FileMemberActionResult : Per-member result for `addFileMember` or +// `changeFileMemberAccess`. +type FileMemberActionResult struct { + // Member : One of specified input members. + Member *MemberSelector `json:"member"` + // Result : The outcome of the action on this member. + Result *FileMemberActionIndividualResult `json:"result"` +} + +// NewFileMemberActionResult returns a new FileMemberActionResult instance +func NewFileMemberActionResult(Member *MemberSelector, Result *FileMemberActionIndividualResult) *FileMemberActionResult { + s := new(FileMemberActionResult) + s.Member = Member + s.Result = Result + return s +} + +// FileMemberRemoveActionResult : has no documentation (yet) +type FileMemberRemoveActionResult struct { + dropbox.Tagged + // Success : Member was successfully removed from this file. + Success *MemberAccessLevelResult `json:"success,omitempty"` + // MemberError : User was not able to remove this member. + MemberError *FileMemberActionError `json:"member_error,omitempty"` +} + +// Valid tag values for FileMemberRemoveActionResult +const ( + FileMemberRemoveActionResultSuccess = "success" + FileMemberRemoveActionResultMemberError = "member_error" + FileMemberRemoveActionResultOther = "other" +) + +// UnmarshalJSON deserializes into a FileMemberRemoveActionResult instance +func (u *FileMemberRemoveActionResult) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Success : Member was successfully removed from this file. + Success json.RawMessage `json:"success,omitempty"` + // MemberError : User was not able to remove this member. + MemberError json.RawMessage `json:"member_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 "success": + err = json.Unmarshal(body, &u.Success) + + if err != nil { + return err + } + case "member_error": + err = json.Unmarshal(w.MemberError, &u.MemberError) + + if err != nil { + return err + } + } + return nil +} + +// FilePermission : Whether the user is allowed to take the sharing action on +// the file. +type FilePermission struct { + // Action : The action that the user may wish to take on the file. + Action *FileAction `json:"action"` + // Allow : True if the user is allowed to take the action. + Allow bool `json:"allow"` + // Reason : The reason why the user is denied the permission. Not present if + // the action is allowed. + Reason *PermissionDeniedReason `json:"reason,omitempty"` +} + +// NewFilePermission returns a new FilePermission instance +func NewFilePermission(Action *FileAction, Allow bool) *FilePermission { + s := new(FilePermission) + s.Action = Action + s.Allow = Allow + return s +} + +// FolderAction : Actions that may be taken on shared folders. +type FolderAction struct { + dropbox.Tagged +} + +// Valid tag values for FolderAction +const ( + FolderActionChangeOptions = "change_options" + FolderActionDisableViewerInfo = "disable_viewer_info" + FolderActionEditContents = "edit_contents" + FolderActionEnableViewerInfo = "enable_viewer_info" + FolderActionInviteEditor = "invite_editor" + FolderActionInviteViewer = "invite_viewer" + FolderActionInviteViewerNoComment = "invite_viewer_no_comment" + FolderActionRelinquishMembership = "relinquish_membership" + FolderActionUnmount = "unmount" + FolderActionUnshare = "unshare" + FolderActionLeaveACopy = "leave_a_copy" + FolderActionShareLink = "share_link" + FolderActionCreateLink = "create_link" + FolderActionOther = "other" +) + +// FolderLinkMetadata : The metadata of a folder shared link +type FolderLinkMetadata struct { + SharedLinkMetadata +} + +// NewFolderLinkMetadata returns a new FolderLinkMetadata instance +func NewFolderLinkMetadata(Url string, Name string, LinkPermissions *LinkPermissions) *FolderLinkMetadata { + s := new(FolderLinkMetadata) + s.Url = Url + s.Name = Name + s.LinkPermissions = LinkPermissions + return s +} + +// FolderPermission : Whether the user is allowed to take the action on the +// shared folder. +type FolderPermission struct { + // Action : The action that the user may wish to take on the folder. + Action *FolderAction `json:"action"` + // Allow : True if the user is allowed to take the action. + Allow bool `json:"allow"` + // Reason : The reason why the user is denied the permission. Not present if + // the action is allowed, or if no reason is available. + Reason *PermissionDeniedReason `json:"reason,omitempty"` +} + +// NewFolderPermission returns a new FolderPermission instance +func NewFolderPermission(Action *FolderAction, Allow bool) *FolderPermission { + s := new(FolderPermission) + s.Action = Action + s.Allow = Allow + return s +} + +// FolderPolicy : A set of policies governing membership and privileges for a +// shared folder. +type FolderPolicy struct { + // MemberPolicy : Who can be a member of this shared folder, as set on the + // folder itself. The effective policy may differ from this value if the + // team-wide policy is more restrictive. Present only if the folder is owned + // by a team. + MemberPolicy *MemberPolicy `json:"member_policy,omitempty"` + // ResolvedMemberPolicy : Who can be a member of this shared folder, taking + // into account both the folder and the team-wide policy. This value may + // differ from that of member_policy if the team-wide policy is more + // restrictive than the folder policy. Present only if the folder is owned + // by a team. + ResolvedMemberPolicy *MemberPolicy `json:"resolved_member_policy,omitempty"` + // AclUpdatePolicy : Who can add and remove members from this shared folder. + AclUpdatePolicy *AclUpdatePolicy `json:"acl_update_policy"` + // SharedLinkPolicy : Who links can be shared with. + SharedLinkPolicy *SharedLinkPolicy `json:"shared_link_policy"` + // ViewerInfoPolicy : Who can enable/disable viewer info for this shared + // folder. + ViewerInfoPolicy *ViewerInfoPolicy `json:"viewer_info_policy,omitempty"` +} + +// NewFolderPolicy returns a new FolderPolicy instance +func NewFolderPolicy(AclUpdatePolicy *AclUpdatePolicy, SharedLinkPolicy *SharedLinkPolicy) *FolderPolicy { + s := new(FolderPolicy) + s.AclUpdatePolicy = AclUpdatePolicy + s.SharedLinkPolicy = SharedLinkPolicy + return s +} + +// GetFileMetadataArg : Arguments of `getFileMetadata`. +type GetFileMetadataArg struct { + // File : The file to query. + File string `json:"file"` + // Actions : A list of `FileAction`s corresponding to `FilePermission`s that + // should appear in the response's `SharedFileMetadata.permissions` field + // describing the actions the authenticated user can perform on the file. + Actions []*FileAction `json:"actions,omitempty"` +} + +// NewGetFileMetadataArg returns a new GetFileMetadataArg instance +func NewGetFileMetadataArg(File string) *GetFileMetadataArg { + s := new(GetFileMetadataArg) + s.File = File + return s +} + +// GetFileMetadataBatchArg : Arguments of `getFileMetadataBatch`. +type GetFileMetadataBatchArg struct { + // Files : The files to query. + Files []string `json:"files"` + // Actions : A list of `FileAction`s corresponding to `FilePermission`s that + // should appear in the response's `SharedFileMetadata.permissions` field + // describing the actions the authenticated user can perform on the file. + Actions []*FileAction `json:"actions,omitempty"` +} + +// NewGetFileMetadataBatchArg returns a new GetFileMetadataBatchArg instance +func NewGetFileMetadataBatchArg(Files []string) *GetFileMetadataBatchArg { + s := new(GetFileMetadataBatchArg) + s.Files = Files + return s +} + +// GetFileMetadataBatchResult : Per file results of `getFileMetadataBatch`. +type GetFileMetadataBatchResult struct { + // File : This is the input file identifier corresponding to one of + // `GetFileMetadataBatchArg.files`. + File string `json:"file"` + // Result : The result for this particular file. + Result *GetFileMetadataIndividualResult `json:"result"` +} + +// NewGetFileMetadataBatchResult returns a new GetFileMetadataBatchResult instance +func NewGetFileMetadataBatchResult(File string, Result *GetFileMetadataIndividualResult) *GetFileMetadataBatchResult { + s := new(GetFileMetadataBatchResult) + s.File = File + s.Result = Result + return s +} + +// GetFileMetadataError : Error result for `getFileMetadata`. +type GetFileMetadataError struct { + dropbox.Tagged + // UserError : has no documentation (yet) + UserError *SharingUserError `json:"user_error,omitempty"` + // AccessError : has no documentation (yet) + AccessError *SharingFileAccessError `json:"access_error,omitempty"` +} + +// Valid tag values for GetFileMetadataError +const ( + GetFileMetadataErrorUserError = "user_error" + GetFileMetadataErrorAccessError = "access_error" + GetFileMetadataErrorOther = "other" +) + +// UnmarshalJSON deserializes into a GetFileMetadataError instance +func (u *GetFileMetadataError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // UserError : has no documentation (yet) + UserError json.RawMessage `json:"user_error,omitempty"` + // AccessError : has no documentation (yet) + AccessError json.RawMessage `json:"access_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 "user_error": + err = json.Unmarshal(w.UserError, &u.UserError) + + if err != nil { + return err + } + case "access_error": + err = json.Unmarshal(w.AccessError, &u.AccessError) + + if err != nil { + return err + } + } + return nil +} + +// GetFileMetadataIndividualResult : has no documentation (yet) +type GetFileMetadataIndividualResult struct { + dropbox.Tagged + // Metadata : The result for this file if it was successful. + Metadata *SharedFileMetadata `json:"metadata,omitempty"` + // AccessError : The result for this file if it was an error. + AccessError *SharingFileAccessError `json:"access_error,omitempty"` +} + +// Valid tag values for GetFileMetadataIndividualResult +const ( + GetFileMetadataIndividualResultMetadata = "metadata" + GetFileMetadataIndividualResultAccessError = "access_error" + GetFileMetadataIndividualResultOther = "other" +) + +// UnmarshalJSON deserializes into a GetFileMetadataIndividualResult instance +func (u *GetFileMetadataIndividualResult) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Metadata : The result for this file if it was successful. + Metadata json.RawMessage `json:"metadata,omitempty"` + // AccessError : The result for this file if it was an error. + AccessError json.RawMessage `json:"access_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 "metadata": + err = json.Unmarshal(body, &u.Metadata) + + if err != nil { + return err + } + case "access_error": + err = json.Unmarshal(w.AccessError, &u.AccessError) + + if err != nil { + return err + } + } + return nil +} + +// GetMetadataArgs : has no documentation (yet) +type GetMetadataArgs struct { + // SharedFolderId : The ID for the shared folder. + SharedFolderId string `json:"shared_folder_id"` + // Actions : A list of `FolderAction`s corresponding to `FolderPermission`s + // that should appear in the response's `SharedFolderMetadata.permissions` + // field describing the actions the authenticated user can perform on the + // folder. + Actions []*FolderAction `json:"actions,omitempty"` +} + +// NewGetMetadataArgs returns a new GetMetadataArgs instance +func NewGetMetadataArgs(SharedFolderId string) *GetMetadataArgs { + s := new(GetMetadataArgs) + s.SharedFolderId = SharedFolderId + return s +} + +// SharedLinkError : has no documentation (yet) +type SharedLinkError struct { + dropbox.Tagged +} + +// Valid tag values for SharedLinkError +const ( + SharedLinkErrorSharedLinkNotFound = "shared_link_not_found" + SharedLinkErrorSharedLinkAccessDenied = "shared_link_access_denied" + SharedLinkErrorUnsupportedLinkType = "unsupported_link_type" + SharedLinkErrorOther = "other" +) + +// GetSharedLinkFileError : has no documentation (yet) +type GetSharedLinkFileError struct { + dropbox.Tagged +} + +// Valid tag values for GetSharedLinkFileError +const ( + GetSharedLinkFileErrorSharedLinkIsDirectory = "shared_link_is_directory" +) + +// GetSharedLinkMetadataArg : has no documentation (yet) +type GetSharedLinkMetadataArg struct { + // Url : URL of the shared link. + Url string `json:"url"` + // Path : If the shared link is to a folder, this parameter can be used to + // retrieve the metadata for a specific file or sub-folder in this folder. A + // relative path should be used. + Path string `json:"path,omitempty"` + // LinkPassword : If the shared link has a password, this parameter can be + // used. + LinkPassword string `json:"link_password,omitempty"` +} + +// NewGetSharedLinkMetadataArg returns a new GetSharedLinkMetadataArg instance +func NewGetSharedLinkMetadataArg(Url string) *GetSharedLinkMetadataArg { + s := new(GetSharedLinkMetadataArg) + s.Url = Url + return s +} + +// GetSharedLinksArg : has no documentation (yet) +type GetSharedLinksArg struct { + // Path : See `getSharedLinks` description. + Path string `json:"path,omitempty"` +} + +// NewGetSharedLinksArg returns a new GetSharedLinksArg instance +func NewGetSharedLinksArg() *GetSharedLinksArg { + s := new(GetSharedLinksArg) + return s +} + +// GetSharedLinksError : has no documentation (yet) +type GetSharedLinksError struct { + dropbox.Tagged + // Path : has no documentation (yet) + Path string `json:"path,omitempty"` +} + +// Valid tag values for GetSharedLinksError +const ( + GetSharedLinksErrorPath = "path" + GetSharedLinksErrorOther = "other" +) + +// UnmarshalJSON deserializes into a GetSharedLinksError instance +func (u *GetSharedLinksError) 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 "path": + err = json.Unmarshal(body, &u.Path) + + if err != nil { + return err + } + } + return nil +} + +// GetSharedLinksResult : has no documentation (yet) +type GetSharedLinksResult struct { + // Links : Shared links applicable to the path argument. + Links []IsLinkMetadata `json:"links"` +} + +// NewGetSharedLinksResult returns a new GetSharedLinksResult instance +func NewGetSharedLinksResult(Links []IsLinkMetadata) *GetSharedLinksResult { + s := new(GetSharedLinksResult) + s.Links = Links + return s +} + +// GroupInfo : The information about a group. Groups is a way to manage a list +// of users who need same access permission to the shared folder. +type GroupInfo struct { + team_common.GroupSummary + // GroupType : The type of group. + GroupType *team_common.GroupType `json:"group_type"` + // IsMember : If the current user is a member of the group. + IsMember bool `json:"is_member"` + // IsOwner : If the current user is an owner of the group. + IsOwner bool `json:"is_owner"` + // SameTeam : If the group is owned by the current user's team. + SameTeam bool `json:"same_team"` +} + +// NewGroupInfo returns a new GroupInfo instance +func NewGroupInfo(GroupName string, GroupId string, GroupManagementType *team_common.GroupManagementType, GroupType *team_common.GroupType, IsMember bool, IsOwner bool, SameTeam bool) *GroupInfo { + s := new(GroupInfo) + s.GroupName = GroupName + s.GroupId = GroupId + s.GroupManagementType = GroupManagementType + s.GroupType = GroupType + s.IsMember = IsMember + s.IsOwner = IsOwner + s.SameTeam = SameTeam + return s +} + +// MembershipInfo : The information about a member of the shared content. +type MembershipInfo struct { + // AccessType : The access type for this member. + AccessType *AccessLevel `json:"access_type"` + // Permissions : The permissions that requesting user has on this member. + // The set of permissions corresponds to the MemberActions in the request. + Permissions []*MemberPermission `json:"permissions,omitempty"` + // Initials : Suggested name initials for a member. + Initials string `json:"initials,omitempty"` + // IsInherited : True if the member has access from a parent folder. + IsInherited bool `json:"is_inherited"` +} + +// NewMembershipInfo returns a new MembershipInfo instance +func NewMembershipInfo(AccessType *AccessLevel) *MembershipInfo { + s := new(MembershipInfo) + s.AccessType = AccessType + s.IsInherited = false + return s +} + +// GroupMembershipInfo : The information about a group member of the shared +// content. +type GroupMembershipInfo struct { + MembershipInfo + // Group : The information about the membership group. + Group *GroupInfo `json:"group"` +} + +// NewGroupMembershipInfo returns a new GroupMembershipInfo instance +func NewGroupMembershipInfo(AccessType *AccessLevel, Group *GroupInfo) *GroupMembershipInfo { + s := new(GroupMembershipInfo) + s.AccessType = AccessType + s.Group = Group + s.IsInherited = false + return s +} + +// InsufficientPlan : has no documentation (yet) +type InsufficientPlan struct { + // Message : A message to tell the user to upgrade in order to support + // expected action. + Message string `json:"message"` + // UpsellUrl : A URL to send the user to in order to obtain the account type + // they need, e.g. upgrading. Absent if there is no action the user can take + // to upgrade. + UpsellUrl string `json:"upsell_url,omitempty"` +} + +// NewInsufficientPlan returns a new InsufficientPlan instance +func NewInsufficientPlan(Message string) *InsufficientPlan { + s := new(InsufficientPlan) + s.Message = Message + return s +} + +// InsufficientQuotaAmounts : has no documentation (yet) +type InsufficientQuotaAmounts struct { + // SpaceNeeded : The amount of space needed to add the item (the size of the + // item). + SpaceNeeded uint64 `json:"space_needed"` + // SpaceShortage : The amount of extra space needed to add the item. + SpaceShortage uint64 `json:"space_shortage"` + // SpaceLeft : The amount of space left in the user's Dropbox, less than + // space_needed. + SpaceLeft uint64 `json:"space_left"` +} + +// NewInsufficientQuotaAmounts returns a new InsufficientQuotaAmounts instance +func NewInsufficientQuotaAmounts(SpaceNeeded uint64, SpaceShortage uint64, SpaceLeft uint64) *InsufficientQuotaAmounts { + s := new(InsufficientQuotaAmounts) + s.SpaceNeeded = SpaceNeeded + s.SpaceShortage = SpaceShortage + s.SpaceLeft = SpaceLeft + return s +} + +// InviteeInfo : Information about the recipient of a shared content invitation. +type InviteeInfo struct { + dropbox.Tagged + // Email : E-mail address of invited user. + Email string `json:"email,omitempty"` +} + +// Valid tag values for InviteeInfo +const ( + InviteeInfoEmail = "email" + InviteeInfoOther = "other" +) + +// UnmarshalJSON deserializes into a InviteeInfo instance +func (u *InviteeInfo) 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 "email": + err = json.Unmarshal(body, &u.Email) + + if err != nil { + return err + } + } + return nil +} + +// InviteeMembershipInfo : Information about an invited member of a shared +// content. +type InviteeMembershipInfo struct { + MembershipInfo + // Invitee : Recipient of the invitation. + Invitee *InviteeInfo `json:"invitee"` + // User : The user this invitation is tied to, if available. + User *UserInfo `json:"user,omitempty"` +} + +// NewInviteeMembershipInfo returns a new InviteeMembershipInfo instance +func NewInviteeMembershipInfo(AccessType *AccessLevel, Invitee *InviteeInfo) *InviteeMembershipInfo { + s := new(InviteeMembershipInfo) + s.AccessType = AccessType + s.Invitee = Invitee + s.IsInherited = false + return s +} + +// JobError : Error occurred while performing an asynchronous job from +// `unshareFolder` or `removeFolderMember`. +type JobError struct { + dropbox.Tagged + // UnshareFolderError : Error occurred while performing `unshareFolder` + // action. + UnshareFolderError *UnshareFolderError `json:"unshare_folder_error,omitempty"` + // RemoveFolderMemberError : Error occurred while performing + // `removeFolderMember` action. + RemoveFolderMemberError *RemoveFolderMemberError `json:"remove_folder_member_error,omitempty"` + // RelinquishFolderMembershipError : Error occurred while performing + // `relinquishFolderMembership` action. + RelinquishFolderMembershipError *RelinquishFolderMembershipError `json:"relinquish_folder_membership_error,omitempty"` +} + +// Valid tag values for JobError +const ( + JobErrorUnshareFolderError = "unshare_folder_error" + JobErrorRemoveFolderMemberError = "remove_folder_member_error" + JobErrorRelinquishFolderMembershipError = "relinquish_folder_membership_error" + JobErrorOther = "other" +) + +// UnmarshalJSON deserializes into a JobError instance +func (u *JobError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // UnshareFolderError : Error occurred while performing `unshareFolder` + // action. + UnshareFolderError json.RawMessage `json:"unshare_folder_error,omitempty"` + // RemoveFolderMemberError : Error occurred while performing + // `removeFolderMember` action. + RemoveFolderMemberError json.RawMessage `json:"remove_folder_member_error,omitempty"` + // RelinquishFolderMembershipError : Error occurred while performing + // `relinquishFolderMembership` action. + RelinquishFolderMembershipError json.RawMessage `json:"relinquish_folder_membership_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 "unshare_folder_error": + err = json.Unmarshal(w.UnshareFolderError, &u.UnshareFolderError) + + if err != nil { + return err + } + case "remove_folder_member_error": + err = json.Unmarshal(w.RemoveFolderMemberError, &u.RemoveFolderMemberError) + + if err != nil { + return err + } + case "relinquish_folder_membership_error": + err = json.Unmarshal(w.RelinquishFolderMembershipError, &u.RelinquishFolderMembershipError) + + if err != nil { + return err + } + } + return nil +} + +// JobStatus : has no documentation (yet) +type JobStatus struct { + dropbox.Tagged + // Failed : The asynchronous job returned an error. + Failed *JobError `json:"failed,omitempty"` +} + +// Valid tag values for JobStatus +const ( + JobStatusComplete = "complete" + JobStatusFailed = "failed" +) + +// UnmarshalJSON deserializes into a JobStatus instance +func (u *JobStatus) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Failed : The asynchronous job returned an error. + Failed json.RawMessage `json:"failed,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 "failed": + err = json.Unmarshal(w.Failed, &u.Failed) + + if err != nil { + return err + } + } + return nil +} + +// LinkAction : Actions that can be performed on a link. +type LinkAction struct { + dropbox.Tagged +} + +// Valid tag values for LinkAction +const ( + LinkActionChangeAccessLevel = "change_access_level" + LinkActionChangeAudience = "change_audience" + LinkActionRemoveExpiry = "remove_expiry" + LinkActionRemovePassword = "remove_password" + LinkActionSetExpiry = "set_expiry" + LinkActionSetPassword = "set_password" + LinkActionOther = "other" +) + +// LinkAudience : has no documentation (yet) +type LinkAudience struct { + dropbox.Tagged +} + +// Valid tag values for LinkAudience +const ( + LinkAudiencePublic = "public" + LinkAudienceTeam = "team" + LinkAudienceMembers = "members" + LinkAudienceOther = "other" +) + +// LinkExpiry : has no documentation (yet) +type LinkExpiry struct { + dropbox.Tagged + // SetExpiry : Set a new expiry or change an existing expiry. + SetExpiry time.Time `json:"set_expiry,omitempty"` +} + +// Valid tag values for LinkExpiry +const ( + LinkExpiryRemoveExpiry = "remove_expiry" + LinkExpirySetExpiry = "set_expiry" + LinkExpiryOther = "other" +) + +// UnmarshalJSON deserializes into a LinkExpiry instance +func (u *LinkExpiry) 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 "set_expiry": + err = json.Unmarshal(body, &u.SetExpiry) + + if err != nil { + return err + } + } + return nil +} + +// LinkPassword : has no documentation (yet) +type LinkPassword struct { + dropbox.Tagged + // SetPassword : Set a new password or change an existing password. + SetPassword string `json:"set_password,omitempty"` +} + +// Valid tag values for LinkPassword +const ( + LinkPasswordRemovePassword = "remove_password" + LinkPasswordSetPassword = "set_password" + LinkPasswordOther = "other" +) + +// UnmarshalJSON deserializes into a LinkPassword instance +func (u *LinkPassword) 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 "set_password": + err = json.Unmarshal(body, &u.SetPassword) + + if err != nil { + return err + } + } + return nil +} + +// LinkPermission : Permissions for actions that can be performed on a link. +type LinkPermission struct { + // Action : has no documentation (yet) + Action *LinkAction `json:"action"` + // Allow : has no documentation (yet) + Allow bool `json:"allow"` + // Reason : has no documentation (yet) + Reason *PermissionDeniedReason `json:"reason,omitempty"` +} + +// NewLinkPermission returns a new LinkPermission instance +func NewLinkPermission(Action *LinkAction, Allow bool) *LinkPermission { + s := new(LinkPermission) + s.Action = Action + s.Allow = Allow + return s +} + +// LinkPermissions : has no documentation (yet) +type LinkPermissions struct { + // ResolvedVisibility : The current visibility of the link after considering + // the shared links policies of the the team (in case the link's owner is + // part of a team) and the shared folder (in case the linked file is part of + // a shared folder). This field is shown only if the caller has access to + // this info (the link's owner always has access to this data). + ResolvedVisibility *ResolvedVisibility `json:"resolved_visibility,omitempty"` + // RequestedVisibility : The shared link's requested visibility. This can be + // overridden by the team and shared folder policies. The final visibility, + // after considering these policies, can be found in `resolved_visibility`. + // This is shown only if the caller is the link's owner. + RequestedVisibility *RequestedVisibility `json:"requested_visibility,omitempty"` + // CanRevoke : Whether the caller can revoke the shared link + CanRevoke bool `json:"can_revoke"` + // RevokeFailureReason : The failure reason for revoking the link. This + // field will only be present if the `can_revoke` is false. + RevokeFailureReason *SharedLinkAccessFailureReason `json:"revoke_failure_reason,omitempty"` +} + +// NewLinkPermissions returns a new LinkPermissions instance +func NewLinkPermissions(CanRevoke bool) *LinkPermissions { + s := new(LinkPermissions) + s.CanRevoke = CanRevoke + return s +} + +// LinkSettings : Settings that apply to a link. +type LinkSettings struct { + // AccessLevel : The access level on the link for this file. Currently, it + // only accepts 'viewer' and 'viewer_no_comment'. + AccessLevel *AccessLevel `json:"access_level,omitempty"` + // Audience : The type of audience on the link for this file. + Audience *LinkAudience `json:"audience,omitempty"` + // Expiry : An expiry timestamp to set on a link. + Expiry *LinkExpiry `json:"expiry,omitempty"` + // Password : The password for the link. + Password *LinkPassword `json:"password,omitempty"` +} + +// NewLinkSettings returns a new LinkSettings instance +func NewLinkSettings() *LinkSettings { + s := new(LinkSettings) + return s +} + +// ListFileMembersArg : Arguments for `listFileMembers`. +type ListFileMembersArg struct { + // File : The file for which you want to see members. + File string `json:"file"` + // Actions : The actions for which to return permissions on a member. + Actions []*MemberAction `json:"actions,omitempty"` + // IncludeInherited : Whether to include members who only have access from a + // parent shared folder. + IncludeInherited bool `json:"include_inherited"` + // Limit : Number of members to return max per query. Defaults to 100 if no + // limit is specified. + Limit uint32 `json:"limit"` +} + +// NewListFileMembersArg returns a new ListFileMembersArg instance +func NewListFileMembersArg(File string) *ListFileMembersArg { + s := new(ListFileMembersArg) + s.File = File + s.IncludeInherited = true + s.Limit = 100 + return s +} + +// ListFileMembersBatchArg : Arguments for `listFileMembersBatch`. +type ListFileMembersBatchArg struct { + // Files : Files for which to return members. + Files []string `json:"files"` + // Limit : Number of members to return max per query. Defaults to 10 if no + // limit is specified. + Limit uint32 `json:"limit"` +} + +// NewListFileMembersBatchArg returns a new ListFileMembersBatchArg instance +func NewListFileMembersBatchArg(Files []string) *ListFileMembersBatchArg { + s := new(ListFileMembersBatchArg) + s.Files = Files + s.Limit = 10 + return s +} + +// ListFileMembersBatchResult : Per-file result for `listFileMembersBatch`. +type ListFileMembersBatchResult struct { + // File : This is the input file identifier, whether an ID or a path. + File string `json:"file"` + // Result : The result for this particular file. + Result *ListFileMembersIndividualResult `json:"result"` +} + +// NewListFileMembersBatchResult returns a new ListFileMembersBatchResult instance +func NewListFileMembersBatchResult(File string, Result *ListFileMembersIndividualResult) *ListFileMembersBatchResult { + s := new(ListFileMembersBatchResult) + s.File = File + s.Result = Result + return s +} + +// ListFileMembersContinueArg : Arguments for `listFileMembersContinue`. +type ListFileMembersContinueArg struct { + // Cursor : The cursor returned by your last call to `listFileMembers`, + // `listFileMembersContinue`, or `listFileMembersBatch`. + Cursor string `json:"cursor"` +} + +// NewListFileMembersContinueArg returns a new ListFileMembersContinueArg instance +func NewListFileMembersContinueArg(Cursor string) *ListFileMembersContinueArg { + s := new(ListFileMembersContinueArg) + s.Cursor = Cursor + return s +} + +// ListFileMembersContinueError : Error for `listFileMembersContinue`. +type ListFileMembersContinueError struct { + dropbox.Tagged + // UserError : has no documentation (yet) + UserError *SharingUserError `json:"user_error,omitempty"` + // AccessError : has no documentation (yet) + AccessError *SharingFileAccessError `json:"access_error,omitempty"` +} + +// Valid tag values for ListFileMembersContinueError +const ( + ListFileMembersContinueErrorUserError = "user_error" + ListFileMembersContinueErrorAccessError = "access_error" + ListFileMembersContinueErrorInvalidCursor = "invalid_cursor" + ListFileMembersContinueErrorOther = "other" +) + +// UnmarshalJSON deserializes into a ListFileMembersContinueError instance +func (u *ListFileMembersContinueError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // UserError : has no documentation (yet) + UserError json.RawMessage `json:"user_error,omitempty"` + // AccessError : has no documentation (yet) + AccessError json.RawMessage `json:"access_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 "user_error": + err = json.Unmarshal(w.UserError, &u.UserError) + + if err != nil { + return err + } + case "access_error": + err = json.Unmarshal(w.AccessError, &u.AccessError) + + if err != nil { + return err + } + } + return nil +} + +// ListFileMembersCountResult : has no documentation (yet) +type ListFileMembersCountResult struct { + // Members : A list of members on this file. + Members *SharedFileMembers `json:"members"` + // MemberCount : The number of members on this file. This does not include + // inherited members. + MemberCount uint32 `json:"member_count"` +} + +// NewListFileMembersCountResult returns a new ListFileMembersCountResult instance +func NewListFileMembersCountResult(Members *SharedFileMembers, MemberCount uint32) *ListFileMembersCountResult { + s := new(ListFileMembersCountResult) + s.Members = Members + s.MemberCount = MemberCount + return s +} + +// ListFileMembersError : Error for `listFileMembers`. +type ListFileMembersError struct { + dropbox.Tagged + // UserError : has no documentation (yet) + UserError *SharingUserError `json:"user_error,omitempty"` + // AccessError : has no documentation (yet) + AccessError *SharingFileAccessError `json:"access_error,omitempty"` +} + +// Valid tag values for ListFileMembersError +const ( + ListFileMembersErrorUserError = "user_error" + ListFileMembersErrorAccessError = "access_error" + ListFileMembersErrorOther = "other" +) + +// UnmarshalJSON deserializes into a ListFileMembersError instance +func (u *ListFileMembersError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // UserError : has no documentation (yet) + UserError json.RawMessage `json:"user_error,omitempty"` + // AccessError : has no documentation (yet) + AccessError json.RawMessage `json:"access_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 "user_error": + err = json.Unmarshal(w.UserError, &u.UserError) + + if err != nil { + return err + } + case "access_error": + err = json.Unmarshal(w.AccessError, &u.AccessError) + + if err != nil { + return err + } + } + return nil +} + +// ListFileMembersIndividualResult : has no documentation (yet) +type ListFileMembersIndividualResult struct { + dropbox.Tagged + // Result : The results of the query for this file if it was successful. + Result *ListFileMembersCountResult `json:"result,omitempty"` + // AccessError : The result of the query for this file if it was an error. + AccessError *SharingFileAccessError `json:"access_error,omitempty"` +} + +// Valid tag values for ListFileMembersIndividualResult +const ( + ListFileMembersIndividualResultResult = "result" + ListFileMembersIndividualResultAccessError = "access_error" + ListFileMembersIndividualResultOther = "other" +) + +// UnmarshalJSON deserializes into a ListFileMembersIndividualResult instance +func (u *ListFileMembersIndividualResult) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Result : The results of the query for this file if it was successful. + Result json.RawMessage `json:"result,omitempty"` + // AccessError : The result of the query for this file if it was an + // error. + AccessError json.RawMessage `json:"access_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 "result": + err = json.Unmarshal(body, &u.Result) + + if err != nil { + return err + } + case "access_error": + err = json.Unmarshal(w.AccessError, &u.AccessError) + + if err != nil { + return err + } + } + return nil +} + +// ListFilesArg : Arguments for `listReceivedFiles`. +type ListFilesArg struct { + // Limit : Number of files to return max per query. Defaults to 100 if no + // limit is specified. + Limit uint32 `json:"limit"` + // Actions : A list of `FileAction`s corresponding to `FilePermission`s that + // should appear in the response's `SharedFileMetadata.permissions` field + // describing the actions the authenticated user can perform on the file. + Actions []*FileAction `json:"actions,omitempty"` +} + +// NewListFilesArg returns a new ListFilesArg instance +func NewListFilesArg() *ListFilesArg { + s := new(ListFilesArg) + s.Limit = 100 + return s +} + +// ListFilesContinueArg : Arguments for `listReceivedFilesContinue`. +type ListFilesContinueArg struct { + // Cursor : Cursor in `ListFilesResult.cursor`. + Cursor string `json:"cursor"` +} + +// NewListFilesContinueArg returns a new ListFilesContinueArg instance +func NewListFilesContinueArg(Cursor string) *ListFilesContinueArg { + s := new(ListFilesContinueArg) + s.Cursor = Cursor + return s +} + +// ListFilesContinueError : Error results for `listReceivedFilesContinue`. +type ListFilesContinueError struct { + dropbox.Tagged + // UserError : User account had a problem. + UserError *SharingUserError `json:"user_error,omitempty"` +} + +// Valid tag values for ListFilesContinueError +const ( + ListFilesContinueErrorUserError = "user_error" + ListFilesContinueErrorInvalidCursor = "invalid_cursor" + ListFilesContinueErrorOther = "other" +) + +// UnmarshalJSON deserializes into a ListFilesContinueError instance +func (u *ListFilesContinueError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // UserError : User account had a problem. + UserError json.RawMessage `json:"user_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 "user_error": + err = json.Unmarshal(w.UserError, &u.UserError) + + if err != nil { + return err + } + } + return nil +} + +// ListFilesResult : Success results for `listReceivedFiles`. +type ListFilesResult struct { + // Entries : Information about the files shared with current user. + Entries []*SharedFileMetadata `json:"entries"` + // Cursor : Cursor used to obtain additional shared files. + Cursor string `json:"cursor,omitempty"` +} + +// NewListFilesResult returns a new ListFilesResult instance +func NewListFilesResult(Entries []*SharedFileMetadata) *ListFilesResult { + s := new(ListFilesResult) + s.Entries = Entries + return s +} + +// ListFolderMembersCursorArg : has no documentation (yet) +type ListFolderMembersCursorArg struct { + // Actions : This is a list indicating whether each returned member will + // include a boolean value `MemberPermission.allow` that describes whether + // the current user can perform the MemberAction on the member. + Actions []*MemberAction `json:"actions,omitempty"` + // Limit : The maximum number of results that include members, groups and + // invitees to return per request. + Limit uint32 `json:"limit"` +} + +// NewListFolderMembersCursorArg returns a new ListFolderMembersCursorArg instance +func NewListFolderMembersCursorArg() *ListFolderMembersCursorArg { + s := new(ListFolderMembersCursorArg) + s.Limit = 1000 + return s +} + +// ListFolderMembersArgs : has no documentation (yet) +type ListFolderMembersArgs struct { + ListFolderMembersCursorArg + // SharedFolderId : The ID for the shared folder. + SharedFolderId string `json:"shared_folder_id"` +} + +// NewListFolderMembersArgs returns a new ListFolderMembersArgs instance +func NewListFolderMembersArgs(SharedFolderId string) *ListFolderMembersArgs { + s := new(ListFolderMembersArgs) + s.SharedFolderId = SharedFolderId + s.Limit = 1000 + return s +} + +// ListFolderMembersContinueArg : has no documentation (yet) +type ListFolderMembersContinueArg struct { + // Cursor : The cursor returned by your last call to `listFolderMembers` or + // `listFolderMembersContinue`. + Cursor string `json:"cursor"` +} + +// NewListFolderMembersContinueArg returns a new ListFolderMembersContinueArg instance +func NewListFolderMembersContinueArg(Cursor string) *ListFolderMembersContinueArg { + s := new(ListFolderMembersContinueArg) + s.Cursor = Cursor + return s +} + +// ListFolderMembersContinueError : has no documentation (yet) +type ListFolderMembersContinueError struct { + dropbox.Tagged + // AccessError : has no documentation (yet) + AccessError *SharedFolderAccessError `json:"access_error,omitempty"` +} + +// Valid tag values for ListFolderMembersContinueError +const ( + ListFolderMembersContinueErrorAccessError = "access_error" + ListFolderMembersContinueErrorInvalidCursor = "invalid_cursor" + ListFolderMembersContinueErrorOther = "other" +) + +// UnmarshalJSON deserializes into a ListFolderMembersContinueError instance +func (u *ListFolderMembersContinueError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // AccessError : has no documentation (yet) + AccessError json.RawMessage `json:"access_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 + } + } + return nil +} + +// ListFoldersArgs : has no documentation (yet) +type ListFoldersArgs struct { + // Limit : The maximum number of results to return per request. + Limit uint32 `json:"limit"` + // Actions : A list of `FolderAction`s corresponding to `FolderPermission`s + // that should appear in the response's `SharedFolderMetadata.permissions` + // field describing the actions the authenticated user can perform on the + // folder. + Actions []*FolderAction `json:"actions,omitempty"` +} + +// NewListFoldersArgs returns a new ListFoldersArgs instance +func NewListFoldersArgs() *ListFoldersArgs { + s := new(ListFoldersArgs) + s.Limit = 1000 + return s +} + +// ListFoldersContinueArg : has no documentation (yet) +type ListFoldersContinueArg struct { + // Cursor : The cursor returned by the previous API call specified in the + // endpoint description. + Cursor string `json:"cursor"` +} + +// NewListFoldersContinueArg returns a new ListFoldersContinueArg instance +func NewListFoldersContinueArg(Cursor string) *ListFoldersContinueArg { + s := new(ListFoldersContinueArg) + s.Cursor = Cursor + return s +} + +// ListFoldersContinueError : has no documentation (yet) +type ListFoldersContinueError struct { + dropbox.Tagged +} + +// Valid tag values for ListFoldersContinueError +const ( + ListFoldersContinueErrorInvalidCursor = "invalid_cursor" + ListFoldersContinueErrorOther = "other" +) + +// ListFoldersResult : Result for `listFolders` or `listMountableFolders`, +// depending on which endpoint was requested. Unmounted shared folders can be +// identified by the absence of `SharedFolderMetadata.path_lower`. +type ListFoldersResult struct { + // Entries : List of all shared folders the authenticated user has access + // to. + Entries []*SharedFolderMetadata `json:"entries"` + // Cursor : Present if there are additional shared folders that have not + // been returned yet. Pass the cursor into the corresponding continue + // endpoint (either `listFoldersContinue` or `listMountableFoldersContinue`) + // to list additional folders. + Cursor string `json:"cursor,omitempty"` +} + +// NewListFoldersResult returns a new ListFoldersResult instance +func NewListFoldersResult(Entries []*SharedFolderMetadata) *ListFoldersResult { + s := new(ListFoldersResult) + s.Entries = Entries + return s +} + +// ListSharedLinksArg : has no documentation (yet) +type ListSharedLinksArg struct { + // Path : See `listSharedLinks` description. + Path string `json:"path,omitempty"` + // Cursor : The cursor returned by your last call to `listSharedLinks`. + Cursor string `json:"cursor,omitempty"` + // DirectOnly : See `listSharedLinks` description. + DirectOnly bool `json:"direct_only,omitempty"` +} + +// NewListSharedLinksArg returns a new ListSharedLinksArg instance +func NewListSharedLinksArg() *ListSharedLinksArg { + s := new(ListSharedLinksArg) + return s +} + +// ListSharedLinksError : has no documentation (yet) +type ListSharedLinksError struct { + dropbox.Tagged + // Path : has no documentation (yet) + Path *files.LookupError `json:"path,omitempty"` +} + +// Valid tag values for ListSharedLinksError +const ( + ListSharedLinksErrorPath = "path" + ListSharedLinksErrorReset = "reset" + ListSharedLinksErrorOther = "other" +) + +// UnmarshalJSON deserializes into a ListSharedLinksError instance +func (u *ListSharedLinksError) 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 "path": + err = json.Unmarshal(w.Path, &u.Path) + + if err != nil { + return err + } + } + return nil +} + +// ListSharedLinksResult : has no documentation (yet) +type ListSharedLinksResult struct { + // Links : Shared links applicable to the path argument. + Links []IsSharedLinkMetadata `json:"links"` + // HasMore : Is true if there are additional shared links that have not been + // returned yet. Pass the cursor into `listSharedLinks` to retrieve them. + HasMore bool `json:"has_more"` + // Cursor : Pass the cursor into `listSharedLinks` to obtain the additional + // links. Cursor is returned only if no path is given. + Cursor string `json:"cursor,omitempty"` +} + +// NewListSharedLinksResult returns a new ListSharedLinksResult instance +func NewListSharedLinksResult(Links []IsSharedLinkMetadata, HasMore bool) *ListSharedLinksResult { + s := new(ListSharedLinksResult) + s.Links = Links + s.HasMore = HasMore + return s +} + +// MemberAccessLevelResult : Contains information about a member's access level +// to content after an operation. +type MemberAccessLevelResult struct { + // AccessLevel : The member still has this level of access to the content + // through a parent folder. + AccessLevel *AccessLevel `json:"access_level,omitempty"` + // Warning : A localized string with additional information about why the + // user has this access level to the content. + Warning string `json:"warning,omitempty"` + // AccessDetails : The parent folders that a member has access to. The field + // is present if the user has access to the first parent folder where the + // member gains access. + AccessDetails []*ParentFolderAccessInfo `json:"access_details,omitempty"` +} + +// NewMemberAccessLevelResult returns a new MemberAccessLevelResult instance +func NewMemberAccessLevelResult() *MemberAccessLevelResult { + s := new(MemberAccessLevelResult) + return s +} + +// MemberAction : Actions that may be taken on members of a shared folder. +type MemberAction struct { + dropbox.Tagged +} + +// Valid tag values for MemberAction +const ( + MemberActionLeaveACopy = "leave_a_copy" + MemberActionMakeEditor = "make_editor" + MemberActionMakeOwner = "make_owner" + MemberActionMakeViewer = "make_viewer" + MemberActionMakeViewerNoComment = "make_viewer_no_comment" + MemberActionRemove = "remove" + MemberActionOther = "other" +) + +// MemberPermission : Whether the user is allowed to take the action on the +// associated member. +type MemberPermission struct { + // Action : The action that the user may wish to take on the member. + Action *MemberAction `json:"action"` + // Allow : True if the user is allowed to take the action. + Allow bool `json:"allow"` + // Reason : The reason why the user is denied the permission. Not present if + // the action is allowed. + Reason *PermissionDeniedReason `json:"reason,omitempty"` +} + +// NewMemberPermission returns a new MemberPermission instance +func NewMemberPermission(Action *MemberAction, Allow bool) *MemberPermission { + s := new(MemberPermission) + s.Action = Action + s.Allow = Allow + return s +} + +// MemberPolicy : Policy governing who can be a member of a shared folder. Only +// applicable to folders owned by a user on a team. +type MemberPolicy struct { + dropbox.Tagged +} + +// Valid tag values for MemberPolicy +const ( + MemberPolicyTeam = "team" + MemberPolicyAnyone = "anyone" + MemberPolicyOther = "other" +) + +// MemberSelector : Includes different ways to identify a member of a shared +// folder. +type MemberSelector struct { + dropbox.Tagged + // DropboxId : Dropbox account, team member, or group ID of member. + DropboxId string `json:"dropbox_id,omitempty"` + // Email : E-mail address of member. + Email string `json:"email,omitempty"` +} + +// Valid tag values for MemberSelector +const ( + MemberSelectorDropboxId = "dropbox_id" + MemberSelectorEmail = "email" + MemberSelectorOther = "other" +) + +// UnmarshalJSON deserializes into a MemberSelector instance +func (u *MemberSelector) 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 "dropbox_id": + err = json.Unmarshal(body, &u.DropboxId) + + if err != nil { + return err + } + case "email": + err = json.Unmarshal(body, &u.Email) + + if err != nil { + return err + } + } + return nil +} + +// ModifySharedLinkSettingsArgs : has no documentation (yet) +type ModifySharedLinkSettingsArgs struct { + // Url : URL of the shared link to change its settings + Url string `json:"url"` + // Settings : Set of settings for the shared link. + Settings *SharedLinkSettings `json:"settings"` + // RemoveExpiration : If set to true, removes the expiration of the shared + // link. + RemoveExpiration bool `json:"remove_expiration"` +} + +// NewModifySharedLinkSettingsArgs returns a new ModifySharedLinkSettingsArgs instance +func NewModifySharedLinkSettingsArgs(Url string, Settings *SharedLinkSettings) *ModifySharedLinkSettingsArgs { + s := new(ModifySharedLinkSettingsArgs) + s.Url = Url + s.Settings = Settings + s.RemoveExpiration = false + return s +} + +// ModifySharedLinkSettingsError : has no documentation (yet) +type ModifySharedLinkSettingsError struct { + dropbox.Tagged + // SettingsError : There is an error with the given settings + SettingsError *SharedLinkSettingsError `json:"settings_error,omitempty"` +} + +// Valid tag values for ModifySharedLinkSettingsError +const ( + ModifySharedLinkSettingsErrorSettingsError = "settings_error" + ModifySharedLinkSettingsErrorEmailNotVerified = "email_not_verified" +) + +// UnmarshalJSON deserializes into a ModifySharedLinkSettingsError instance +func (u *ModifySharedLinkSettingsError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // SettingsError : There is an error with the given settings + SettingsError json.RawMessage `json:"settings_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 "settings_error": + err = json.Unmarshal(w.SettingsError, &u.SettingsError) + + if err != nil { + return err + } + } + return nil +} + +// MountFolderArg : has no documentation (yet) +type MountFolderArg struct { + // SharedFolderId : The ID of the shared folder to mount. + SharedFolderId string `json:"shared_folder_id"` +} + +// NewMountFolderArg returns a new MountFolderArg instance +func NewMountFolderArg(SharedFolderId string) *MountFolderArg { + s := new(MountFolderArg) + s.SharedFolderId = SharedFolderId + return s +} + +// MountFolderError : has no documentation (yet) +type MountFolderError struct { + dropbox.Tagged + // AccessError : has no documentation (yet) + AccessError *SharedFolderAccessError `json:"access_error,omitempty"` + // InsufficientQuota : The current user does not have enough space to mount + // the shared folder. + InsufficientQuota *InsufficientQuotaAmounts `json:"insufficient_quota,omitempty"` +} + +// Valid tag values for MountFolderError +const ( + MountFolderErrorAccessError = "access_error" + MountFolderErrorInsideSharedFolder = "inside_shared_folder" + MountFolderErrorInsufficientQuota = "insufficient_quota" + MountFolderErrorAlreadyMounted = "already_mounted" + MountFolderErrorNoPermission = "no_permission" + MountFolderErrorNotMountable = "not_mountable" + MountFolderErrorOther = "other" +) + +// UnmarshalJSON deserializes into a MountFolderError instance +func (u *MountFolderError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // AccessError : has no documentation (yet) + AccessError json.RawMessage `json:"access_error,omitempty"` + // InsufficientQuota : The current user does not have enough space to + // mount the shared folder. + InsufficientQuota json.RawMessage `json:"insufficient_quota,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 "insufficient_quota": + err = json.Unmarshal(body, &u.InsufficientQuota) + + if err != nil { + return err + } + } + return nil +} + +// ParentFolderAccessInfo : Contains information about a parent folder that a +// member has access to. +type ParentFolderAccessInfo struct { + // FolderName : Display name for the folder. + FolderName string `json:"folder_name"` + // SharedFolderId : The identifier of the parent shared folder. + SharedFolderId string `json:"shared_folder_id"` + // Permissions : The user's permissions for the parent shared folder. + Permissions []*MemberPermission `json:"permissions"` + // Path : The full path to the parent shared folder relative to the acting + // user's root. + Path string `json:"path"` +} + +// NewParentFolderAccessInfo returns a new ParentFolderAccessInfo instance +func NewParentFolderAccessInfo(FolderName string, SharedFolderId string, Permissions []*MemberPermission, Path string) *ParentFolderAccessInfo { + s := new(ParentFolderAccessInfo) + s.FolderName = FolderName + s.SharedFolderId = SharedFolderId + s.Permissions = Permissions + s.Path = Path + return s +} + +// PathLinkMetadata : Metadata for a path-based shared link. +type PathLinkMetadata struct { + LinkMetadata + // Path : Path in user's Dropbox. + Path string `json:"path"` +} + +// NewPathLinkMetadata returns a new PathLinkMetadata instance +func NewPathLinkMetadata(Url string, Visibility *Visibility, Path string) *PathLinkMetadata { + s := new(PathLinkMetadata) + s.Url = Url + s.Visibility = Visibility + s.Path = Path + return s +} + +// PendingUploadMode : Flag to indicate pending upload default (for linking to +// not-yet-existing paths). +type PendingUploadMode struct { + dropbox.Tagged +} + +// Valid tag values for PendingUploadMode +const ( + PendingUploadModeFile = "file" + PendingUploadModeFolder = "folder" +) + +// PermissionDeniedReason : Possible reasons the user is denied a permission. +type PermissionDeniedReason struct { + dropbox.Tagged + // InsufficientPlan : has no documentation (yet) + InsufficientPlan *InsufficientPlan `json:"insufficient_plan,omitempty"` +} + +// Valid tag values for PermissionDeniedReason +const ( + PermissionDeniedReasonUserNotSameTeamAsOwner = "user_not_same_team_as_owner" + PermissionDeniedReasonUserNotAllowedByOwner = "user_not_allowed_by_owner" + PermissionDeniedReasonTargetIsIndirectMember = "target_is_indirect_member" + PermissionDeniedReasonTargetIsOwner = "target_is_owner" + PermissionDeniedReasonTargetIsSelf = "target_is_self" + PermissionDeniedReasonTargetNotActive = "target_not_active" + PermissionDeniedReasonFolderIsLimitedTeamFolder = "folder_is_limited_team_folder" + PermissionDeniedReasonOwnerNotOnTeam = "owner_not_on_team" + PermissionDeniedReasonPermissionDenied = "permission_denied" + PermissionDeniedReasonRestrictedByTeam = "restricted_by_team" + PermissionDeniedReasonUserAccountType = "user_account_type" + PermissionDeniedReasonUserNotOnTeam = "user_not_on_team" + PermissionDeniedReasonFolderIsInsideSharedFolder = "folder_is_inside_shared_folder" + PermissionDeniedReasonInsufficientPlan = "insufficient_plan" + PermissionDeniedReasonOther = "other" +) + +// UnmarshalJSON deserializes into a PermissionDeniedReason instance +func (u *PermissionDeniedReason) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // InsufficientPlan : has no documentation (yet) + InsufficientPlan json.RawMessage `json:"insufficient_plan,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 "insufficient_plan": + err = json.Unmarshal(body, &u.InsufficientPlan) + + if err != nil { + return err + } + } + return nil +} + +// RelinquishFileMembershipArg : has no documentation (yet) +type RelinquishFileMembershipArg struct { + // File : The path or id for the file. + File string `json:"file"` +} + +// NewRelinquishFileMembershipArg returns a new RelinquishFileMembershipArg instance +func NewRelinquishFileMembershipArg(File string) *RelinquishFileMembershipArg { + s := new(RelinquishFileMembershipArg) + s.File = File + return s +} + +// RelinquishFileMembershipError : has no documentation (yet) +type RelinquishFileMembershipError struct { + dropbox.Tagged + // AccessError : has no documentation (yet) + AccessError *SharingFileAccessError `json:"access_error,omitempty"` +} + +// Valid tag values for RelinquishFileMembershipError +const ( + RelinquishFileMembershipErrorAccessError = "access_error" + RelinquishFileMembershipErrorGroupAccess = "group_access" + RelinquishFileMembershipErrorNoPermission = "no_permission" + RelinquishFileMembershipErrorOther = "other" +) + +// UnmarshalJSON deserializes into a RelinquishFileMembershipError instance +func (u *RelinquishFileMembershipError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // AccessError : has no documentation (yet) + AccessError json.RawMessage `json:"access_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 + } + } + return nil +} + +// RelinquishFolderMembershipArg : has no documentation (yet) +type RelinquishFolderMembershipArg struct { + // SharedFolderId : The ID for the shared folder. + SharedFolderId string `json:"shared_folder_id"` + // LeaveACopy : Keep a copy of the folder's contents upon relinquishing + // membership. + LeaveACopy bool `json:"leave_a_copy"` +} + +// NewRelinquishFolderMembershipArg returns a new RelinquishFolderMembershipArg instance +func NewRelinquishFolderMembershipArg(SharedFolderId string) *RelinquishFolderMembershipArg { + s := new(RelinquishFolderMembershipArg) + s.SharedFolderId = SharedFolderId + s.LeaveACopy = false + return s +} + +// RelinquishFolderMembershipError : has no documentation (yet) +type RelinquishFolderMembershipError struct { + dropbox.Tagged + // AccessError : has no documentation (yet) + AccessError *SharedFolderAccessError `json:"access_error,omitempty"` +} + +// Valid tag values for RelinquishFolderMembershipError +const ( + RelinquishFolderMembershipErrorAccessError = "access_error" + RelinquishFolderMembershipErrorFolderOwner = "folder_owner" + RelinquishFolderMembershipErrorMounted = "mounted" + RelinquishFolderMembershipErrorGroupAccess = "group_access" + RelinquishFolderMembershipErrorTeamFolder = "team_folder" + RelinquishFolderMembershipErrorNoPermission = "no_permission" + RelinquishFolderMembershipErrorNoExplicitAccess = "no_explicit_access" + RelinquishFolderMembershipErrorOther = "other" +) + +// UnmarshalJSON deserializes into a RelinquishFolderMembershipError instance +func (u *RelinquishFolderMembershipError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // AccessError : has no documentation (yet) + AccessError json.RawMessage `json:"access_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 + } + } + return nil +} + +// RemoveFileMemberArg : Arguments for `removeFileMember2`. +type RemoveFileMemberArg struct { + // File : File from which to remove members. + File string `json:"file"` + // Member : Member to remove from this file. Note that even if an email is + // specified, it may result in the removal of a user (not an invitee) if the + // user's main account corresponds to that email address. + Member *MemberSelector `json:"member"` +} + +// NewRemoveFileMemberArg returns a new RemoveFileMemberArg instance +func NewRemoveFileMemberArg(File string, Member *MemberSelector) *RemoveFileMemberArg { + s := new(RemoveFileMemberArg) + s.File = File + s.Member = Member + return s +} + +// RemoveFileMemberError : Errors for `removeFileMember2`. +type RemoveFileMemberError struct { + dropbox.Tagged + // UserError : has no documentation (yet) + UserError *SharingUserError `json:"user_error,omitempty"` + // AccessError : has no documentation (yet) + AccessError *SharingFileAccessError `json:"access_error,omitempty"` + // NoExplicitAccess : This member does not have explicit access to the file + // and therefore cannot be removed. The return value is the access that a + // user might have to the file from a parent folder. + NoExplicitAccess *MemberAccessLevelResult `json:"no_explicit_access,omitempty"` +} + +// Valid tag values for RemoveFileMemberError +const ( + RemoveFileMemberErrorUserError = "user_error" + RemoveFileMemberErrorAccessError = "access_error" + RemoveFileMemberErrorNoExplicitAccess = "no_explicit_access" + RemoveFileMemberErrorOther = "other" +) + +// UnmarshalJSON deserializes into a RemoveFileMemberError instance +func (u *RemoveFileMemberError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // UserError : has no documentation (yet) + UserError json.RawMessage `json:"user_error,omitempty"` + // AccessError : has no documentation (yet) + AccessError json.RawMessage `json:"access_error,omitempty"` + // NoExplicitAccess : This member does not have explicit access to the + // file and therefore cannot be removed. The return value is the access + // that a user might have to the file from a parent folder. + NoExplicitAccess json.RawMessage `json:"no_explicit_access,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 "user_error": + err = json.Unmarshal(w.UserError, &u.UserError) + + if err != nil { + return err + } + case "access_error": + err = json.Unmarshal(w.AccessError, &u.AccessError) + + if err != nil { + return err + } + case "no_explicit_access": + err = json.Unmarshal(body, &u.NoExplicitAccess) + + if err != nil { + return err + } + } + return nil +} + +// RemoveFolderMemberArg : has no documentation (yet) +type RemoveFolderMemberArg struct { + // SharedFolderId : The ID for the shared folder. + SharedFolderId string `json:"shared_folder_id"` + // Member : The member to remove from the folder. + Member *MemberSelector `json:"member"` + // LeaveACopy : If true, the removed user will keep their copy of the folder + // after it's unshared, assuming it was mounted. Otherwise, it will be + // removed from their Dropbox. Also, this must be set to false when kicking + // a group. + LeaveACopy bool `json:"leave_a_copy"` +} + +// NewRemoveFolderMemberArg returns a new RemoveFolderMemberArg instance +func NewRemoveFolderMemberArg(SharedFolderId string, Member *MemberSelector, LeaveACopy bool) *RemoveFolderMemberArg { + s := new(RemoveFolderMemberArg) + s.SharedFolderId = SharedFolderId + s.Member = Member + s.LeaveACopy = LeaveACopy + return s +} + +// RemoveFolderMemberError : has no documentation (yet) +type RemoveFolderMemberError struct { + dropbox.Tagged + // AccessError : has no documentation (yet) + AccessError *SharedFolderAccessError `json:"access_error,omitempty"` + // MemberError : has no documentation (yet) + MemberError *SharedFolderMemberError `json:"member_error,omitempty"` +} + +// Valid tag values for RemoveFolderMemberError +const ( + RemoveFolderMemberErrorAccessError = "access_error" + RemoveFolderMemberErrorMemberError = "member_error" + RemoveFolderMemberErrorFolderOwner = "folder_owner" + RemoveFolderMemberErrorGroupAccess = "group_access" + RemoveFolderMemberErrorTeamFolder = "team_folder" + RemoveFolderMemberErrorNoPermission = "no_permission" + RemoveFolderMemberErrorOther = "other" +) + +// UnmarshalJSON deserializes into a RemoveFolderMemberError instance +func (u *RemoveFolderMemberError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // AccessError : has no documentation (yet) + AccessError json.RawMessage `json:"access_error,omitempty"` + // MemberError : has no documentation (yet) + MemberError json.RawMessage `json:"member_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 "member_error": + err = json.Unmarshal(w.MemberError, &u.MemberError) + + if err != nil { + return err + } + } + return nil +} + +// RemoveMemberJobStatus : has no documentation (yet) +type RemoveMemberJobStatus struct { + dropbox.Tagged + // Complete : Removing the folder member has finished. The value is + // information about whether the member has another form of access. + Complete *MemberAccessLevelResult `json:"complete,omitempty"` + // Failed : has no documentation (yet) + Failed *RemoveFolderMemberError `json:"failed,omitempty"` +} + +// Valid tag values for RemoveMemberJobStatus +const ( + RemoveMemberJobStatusComplete = "complete" + RemoveMemberJobStatusFailed = "failed" +) + +// UnmarshalJSON deserializes into a RemoveMemberJobStatus instance +func (u *RemoveMemberJobStatus) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Complete : Removing the folder member has finished. The value is + // information about whether the member has another form of access. + Complete json.RawMessage `json:"complete,omitempty"` + // Failed : has no documentation (yet) + Failed json.RawMessage `json:"failed,omitempty"` + } + var w wrap + var err error + if err = json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "complete": + err = json.Unmarshal(body, &u.Complete) + + if err != nil { + return err + } + case "failed": + err = json.Unmarshal(w.Failed, &u.Failed) + + if err != nil { + return err + } + } + return nil +} + +// RequestedVisibility : The access permission that can be requested by the +// caller for the shared link. Note that the final resolved visibility of the +// shared link takes into account other aspects, such as team and shared folder +// settings. Check the `ResolvedVisibility` for more info on the possible +// resolved visibility values of shared links. +type RequestedVisibility struct { + dropbox.Tagged +} + +// Valid tag values for RequestedVisibility +const ( + RequestedVisibilityPublic = "public" + RequestedVisibilityTeamOnly = "team_only" + RequestedVisibilityPassword = "password" +) + +// ResolvedVisibility : The actual access permissions values of shared links +// after taking into account user preferences and the team and shared folder +// settings. Check the `RequestedVisibility` for more info on the possible +// visibility values that can be set by the shared link's owner. +type ResolvedVisibility struct { + dropbox.Tagged +} + +// Valid tag values for ResolvedVisibility +const ( + ResolvedVisibilityTeamAndPassword = "team_and_password" + ResolvedVisibilitySharedFolderOnly = "shared_folder_only" + ResolvedVisibilityOther = "other" +) + +// RevokeSharedLinkArg : has no documentation (yet) +type RevokeSharedLinkArg struct { + // Url : URL of the shared link. + Url string `json:"url"` +} + +// NewRevokeSharedLinkArg returns a new RevokeSharedLinkArg instance +func NewRevokeSharedLinkArg(Url string) *RevokeSharedLinkArg { + s := new(RevokeSharedLinkArg) + s.Url = Url + return s +} + +// RevokeSharedLinkError : has no documentation (yet) +type RevokeSharedLinkError struct { + dropbox.Tagged +} + +// Valid tag values for RevokeSharedLinkError +const ( + RevokeSharedLinkErrorSharedLinkMalformed = "shared_link_malformed" +) + +// ShareFolderArgBase : has no documentation (yet) +type ShareFolderArgBase struct { + // AclUpdatePolicy : Who can add and remove members of this shared folder. + AclUpdatePolicy *AclUpdatePolicy `json:"acl_update_policy,omitempty"` + // ForceAsync : Whether to force the share to happen asynchronously. + ForceAsync bool `json:"force_async"` + // MemberPolicy : Who can be a member of this shared folder. Only applicable + // if the current user is on a team. + MemberPolicy *MemberPolicy `json:"member_policy,omitempty"` + // Path : The path to the folder to share. If it does not exist, then a new + // one is created. + Path string `json:"path"` + // SharedLinkPolicy : The policy to apply to shared links created for + // content inside this shared folder. The current user must be on a team to + // set this policy to `SharedLinkPolicy.members`. + SharedLinkPolicy *SharedLinkPolicy `json:"shared_link_policy,omitempty"` + // ViewerInfoPolicy : Who can enable/disable viewer info for this shared + // folder. + ViewerInfoPolicy *ViewerInfoPolicy `json:"viewer_info_policy,omitempty"` +} + +// NewShareFolderArgBase returns a new ShareFolderArgBase instance +func NewShareFolderArgBase(Path string) *ShareFolderArgBase { + s := new(ShareFolderArgBase) + s.Path = Path + s.ForceAsync = false + return s +} + +// ShareFolderArg : has no documentation (yet) +type ShareFolderArg struct { + ShareFolderArgBase + // Actions : A list of `FolderAction`s corresponding to `FolderPermission`s + // that should appear in the response's `SharedFolderMetadata.permissions` + // field describing the actions the authenticated user can perform on the + // folder. + Actions []*FolderAction `json:"actions,omitempty"` + // LinkSettings : Settings on the link for this folder. + LinkSettings *LinkSettings `json:"link_settings,omitempty"` +} + +// NewShareFolderArg returns a new ShareFolderArg instance +func NewShareFolderArg(Path string) *ShareFolderArg { + s := new(ShareFolderArg) + s.Path = Path + s.ForceAsync = false + return s +} + +// ShareFolderErrorBase : has no documentation (yet) +type ShareFolderErrorBase struct { + dropbox.Tagged + // BadPath : `ShareFolderArg.path` is invalid. + BadPath *SharePathError `json:"bad_path,omitempty"` +} + +// Valid tag values for ShareFolderErrorBase +const ( + ShareFolderErrorBaseEmailUnverified = "email_unverified" + ShareFolderErrorBaseBadPath = "bad_path" + ShareFolderErrorBaseTeamPolicyDisallowsMemberPolicy = "team_policy_disallows_member_policy" + ShareFolderErrorBaseDisallowedSharedLinkPolicy = "disallowed_shared_link_policy" + ShareFolderErrorBaseOther = "other" +) + +// UnmarshalJSON deserializes into a ShareFolderErrorBase instance +func (u *ShareFolderErrorBase) 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 +} + +// ShareFolderError : has no documentation (yet) +type ShareFolderError struct { + dropbox.Tagged +} + +// Valid tag values for ShareFolderError +const ( + ShareFolderErrorNoPermission = "no_permission" +) + +// ShareFolderJobStatus : has no documentation (yet) +type ShareFolderJobStatus struct { + dropbox.Tagged + // Complete : The share job has finished. The value is the metadata for the + // folder. + Complete *SharedFolderMetadata `json:"complete,omitempty"` + // Failed : has no documentation (yet) + Failed *ShareFolderError `json:"failed,omitempty"` +} + +// Valid tag values for ShareFolderJobStatus +const ( + ShareFolderJobStatusComplete = "complete" + ShareFolderJobStatusFailed = "failed" +) + +// UnmarshalJSON deserializes into a ShareFolderJobStatus instance +func (u *ShareFolderJobStatus) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Complete : The share job has finished. The value is the metadata for + // the folder. + Complete json.RawMessage `json:"complete,omitempty"` + // Failed : has no documentation (yet) + Failed json.RawMessage `json:"failed,omitempty"` + } + var w wrap + var err error + if err = json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "complete": + err = json.Unmarshal(body, &u.Complete) + + if err != nil { + return err + } + case "failed": + err = json.Unmarshal(w.Failed, &u.Failed) + + if err != nil { + return err + } + } + return nil +} + +// ShareFolderLaunch : has no documentation (yet) +type ShareFolderLaunch struct { + dropbox.Tagged + // Complete : has no documentation (yet) + Complete *SharedFolderMetadata `json:"complete,omitempty"` +} + +// Valid tag values for ShareFolderLaunch +const ( + ShareFolderLaunchComplete = "complete" +) + +// UnmarshalJSON deserializes into a ShareFolderLaunch instance +func (u *ShareFolderLaunch) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Complete : has no documentation (yet) + Complete json.RawMessage `json:"complete,omitempty"` + } + var w wrap + var err error + if err = json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "complete": + err = json.Unmarshal(body, &u.Complete) + + if err != nil { + return err + } + } + return nil +} + +// SharePathError : has no documentation (yet) +type SharePathError struct { + dropbox.Tagged + // AlreadyShared : Folder is already shared. Contains metadata about the + // existing shared folder. + AlreadyShared *SharedFolderMetadata `json:"already_shared,omitempty"` +} + +// Valid tag values for SharePathError +const ( + SharePathErrorIsFile = "is_file" + SharePathErrorInsideSharedFolder = "inside_shared_folder" + SharePathErrorContainsSharedFolder = "contains_shared_folder" + SharePathErrorContainsAppFolder = "contains_app_folder" + SharePathErrorContainsTeamFolder = "contains_team_folder" + SharePathErrorIsAppFolder = "is_app_folder" + SharePathErrorInsideAppFolder = "inside_app_folder" + SharePathErrorIsPublicFolder = "is_public_folder" + SharePathErrorInsidePublicFolder = "inside_public_folder" + SharePathErrorAlreadyShared = "already_shared" + SharePathErrorInvalidPath = "invalid_path" + SharePathErrorIsOsxPackage = "is_osx_package" + SharePathErrorInsideOsxPackage = "inside_osx_package" + SharePathErrorOther = "other" +) + +// UnmarshalJSON deserializes into a SharePathError instance +func (u *SharePathError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // AlreadyShared : Folder is already shared. Contains metadata about the + // existing shared folder. + AlreadyShared json.RawMessage `json:"already_shared,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 "already_shared": + err = json.Unmarshal(body, &u.AlreadyShared) + + if err != nil { + return err + } + } + return nil +} + +// SharedContentLinkMetadata : Metadata of a shared link for a file or folder. +type SharedContentLinkMetadata struct { + SharedContentLinkMetadataBase + // AudienceExceptions : The content inside this folder with link audience + // different than this folder's. This is only returned when an endpoint that + // returns metadata for a single shared folder is called, e.g. + // /get_folder_metadata. + AudienceExceptions *AudienceExceptions `json:"audience_exceptions,omitempty"` + // Url : The URL of the link. + Url string `json:"url"` +} + +// NewSharedContentLinkMetadata returns a new SharedContentLinkMetadata instance +func NewSharedContentLinkMetadata(AudienceOptions []*LinkAudience, CurrentAudience *LinkAudience, LinkPermissions []*LinkPermission, PasswordProtected bool, Url string) *SharedContentLinkMetadata { + s := new(SharedContentLinkMetadata) + s.AudienceOptions = AudienceOptions + s.CurrentAudience = CurrentAudience + s.LinkPermissions = LinkPermissions + s.PasswordProtected = PasswordProtected + s.Url = Url + return s +} + +// SharedFileMembers : Shared file user, group, and invitee membership. Used for +// the results of `listFileMembers` and `listFileMembersContinue`, and used as +// part of the results for `listFileMembersBatch`. +type SharedFileMembers struct { + // Users : The list of user members of the shared file. + Users []*UserMembershipInfo `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 + // and claimed this. + Invitees []*InviteeMembershipInfo `json:"invitees"` + // Cursor : Present if there are additional shared file members that have + // not been returned yet. Pass the cursor into `listFileMembersContinue` to + // list additional members. + Cursor string `json:"cursor,omitempty"` +} + +// NewSharedFileMembers returns a new SharedFileMembers instance +func NewSharedFileMembers(Users []*UserMembershipInfo, Groups []*GroupMembershipInfo, Invitees []*InviteeMembershipInfo) *SharedFileMembers { + s := new(SharedFileMembers) + s.Users = Users + s.Groups = Groups + s.Invitees = Invitees + return s +} + +// SharedFileMetadata : Properties of the shared file. +type SharedFileMetadata struct { + // AccessType : The current user's access level for this shared file. + AccessType *AccessLevel `json:"access_type,omitempty"` + // Id : The ID of the file. + Id string `json:"id"` + // ExpectedLinkMetadata : The expected metadata of the link associated for + // the file when it is first shared. Absent if the link already exists. This + // is for an unreleased feature so it may not be returned yet. + ExpectedLinkMetadata *ExpectedSharedContentLinkMetadata `json:"expected_link_metadata,omitempty"` + // LinkMetadata : The metadata of the link associated for the file. This is + // for an unreleased feature so it may not be returned yet. + LinkMetadata *SharedContentLinkMetadata `json:"link_metadata,omitempty"` + // Name : The name of this file. + Name string `json:"name"` + // OwnerDisplayNames : The display names of the users that own the file. If + // the file is part of a team folder, the display names of the team admins + // are also included. Absent if the owner display names cannot be fetched. + OwnerDisplayNames []string `json:"owner_display_names,omitempty"` + // OwnerTeam : The team that owns the file. This field is not present if the + // file is not owned by a team. + OwnerTeam *users.Team `json:"owner_team,omitempty"` + // ParentSharedFolderId : The ID of the parent shared folder. This field is + // present only if the file is contained within a shared folder. + ParentSharedFolderId string `json:"parent_shared_folder_id,omitempty"` + // PathDisplay : The cased path to be used for display purposes only. In + // rare instances the casing will not correctly match the user's filesystem, + // but this behavior will match the path provided in the Core API v1. Absent + // for unmounted files. + PathDisplay string `json:"path_display,omitempty"` + // PathLower : The lower-case full path of this file. Absent for unmounted + // files. + PathLower string `json:"path_lower,omitempty"` + // Permissions : The sharing permissions that requesting user has on this + // file. This corresponds to the entries given in + // `GetFileMetadataBatchArg.actions` or `GetFileMetadataArg.actions`. + Permissions []*FilePermission `json:"permissions,omitempty"` + // Policy : Policies governing this shared file. + Policy *FolderPolicy `json:"policy"` + // PreviewUrl : URL for displaying a web preview of the shared file. + PreviewUrl string `json:"preview_url"` + // TimeInvited : Timestamp indicating when the current user was invited to + // this shared file. If the user was not invited to the shared file, the + // timestamp will indicate when the user was invited to the parent shared + // folder. This value may be absent. + TimeInvited time.Time `json:"time_invited,omitempty"` +} + +// NewSharedFileMetadata returns a new SharedFileMetadata instance +func NewSharedFileMetadata(Id string, Name string, Policy *FolderPolicy, PreviewUrl string) *SharedFileMetadata { + s := new(SharedFileMetadata) + s.Id = Id + s.Name = Name + s.Policy = Policy + s.PreviewUrl = PreviewUrl + return s +} + +// SharedFolderAccessError : There is an error accessing the shared folder. +type SharedFolderAccessError struct { + dropbox.Tagged +} + +// Valid tag values for SharedFolderAccessError +const ( + SharedFolderAccessErrorInvalidId = "invalid_id" + SharedFolderAccessErrorNotAMember = "not_a_member" + SharedFolderAccessErrorEmailUnverified = "email_unverified" + SharedFolderAccessErrorUnmounted = "unmounted" + SharedFolderAccessErrorOther = "other" +) + +// SharedFolderMemberError : has no documentation (yet) +type SharedFolderMemberError struct { + dropbox.Tagged + // NoExplicitAccess : The target member only has inherited access to the + // shared folder. + NoExplicitAccess *MemberAccessLevelResult `json:"no_explicit_access,omitempty"` +} + +// Valid tag values for SharedFolderMemberError +const ( + SharedFolderMemberErrorInvalidDropboxId = "invalid_dropbox_id" + SharedFolderMemberErrorNotAMember = "not_a_member" + SharedFolderMemberErrorNoExplicitAccess = "no_explicit_access" + SharedFolderMemberErrorOther = "other" +) + +// UnmarshalJSON deserializes into a SharedFolderMemberError instance +func (u *SharedFolderMemberError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // NoExplicitAccess : The target member only has inherited access to the + // shared folder. + NoExplicitAccess json.RawMessage `json:"no_explicit_access,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 "no_explicit_access": + err = json.Unmarshal(body, &u.NoExplicitAccess) + + if err != nil { + return err + } + } + return nil +} + +// SharedFolderMembers : Shared folder user and group membership. +type SharedFolderMembers struct { + // Users : The list of user members of the shared folder. + Users []*UserMembershipInfo `json:"users"` + // Groups : The list of group members of the shared folder. + Groups []*GroupMembershipInfo `json:"groups"` + // Invitees : The list of invitees to the shared folder. + Invitees []*InviteeMembershipInfo `json:"invitees"` + // Cursor : Present if there are additional shared folder members that have + // not been returned yet. Pass the cursor into `listFolderMembersContinue` + // to list additional members. + Cursor string `json:"cursor,omitempty"` +} + +// NewSharedFolderMembers returns a new SharedFolderMembers instance +func NewSharedFolderMembers(Users []*UserMembershipInfo, Groups []*GroupMembershipInfo, Invitees []*InviteeMembershipInfo) *SharedFolderMembers { + s := new(SharedFolderMembers) + s.Users = Users + s.Groups = Groups + s.Invitees = Invitees + return s +} + +// SharedFolderMetadataBase : Properties of the shared folder. +type SharedFolderMetadataBase struct { + // AccessType : The current user's access level for this shared folder. + AccessType *AccessLevel `json:"access_type"` + // IsInsideTeamFolder : Whether this folder is inside of a team folder. + IsInsideTeamFolder bool `json:"is_inside_team_folder"` + // IsTeamFolder : Whether this folder is a `team folder` + // . + IsTeamFolder bool `json:"is_team_folder"` + // OwnerDisplayNames : The display names of the users that own the folder. + // If the folder is part of a team folder, the display names of the team + // admins are also included. Absent if the owner display names cannot be + // fetched. + OwnerDisplayNames []string `json:"owner_display_names,omitempty"` + // OwnerTeam : The team that owns the folder. This field is not present if + // the folder is not owned by a team. + OwnerTeam *users.Team `json:"owner_team,omitempty"` + // ParentSharedFolderId : The ID of the parent shared folder. This field is + // present only if the folder is contained within another shared folder. + ParentSharedFolderId string `json:"parent_shared_folder_id,omitempty"` + // PathLower : The lower-cased full path of this shared folder. Absent for + // unmounted folders. + PathLower string `json:"path_lower,omitempty"` +} + +// NewSharedFolderMetadataBase returns a new SharedFolderMetadataBase instance +func NewSharedFolderMetadataBase(AccessType *AccessLevel, IsInsideTeamFolder bool, IsTeamFolder bool) *SharedFolderMetadataBase { + s := new(SharedFolderMetadataBase) + s.AccessType = AccessType + s.IsInsideTeamFolder = IsInsideTeamFolder + s.IsTeamFolder = IsTeamFolder + return s +} + +// SharedFolderMetadata : The metadata which includes basic information about +// the shared folder. +type SharedFolderMetadata struct { + SharedFolderMetadataBase + // LinkMetadata : The metadata of the shared content link to this shared + // folder. Absent if there is no link on the folder. This is for an + // unreleased feature so it may not be returned yet. + LinkMetadata *SharedContentLinkMetadata `json:"link_metadata,omitempty"` + // Name : The name of the this shared folder. + Name string `json:"name"` + // Permissions : Actions the current user may perform on the folder and its + // contents. The set of permissions corresponds to the FolderActions in the + // request. + Permissions []*FolderPermission `json:"permissions,omitempty"` + // Policy : Policies governing this shared folder. + Policy *FolderPolicy `json:"policy"` + // PreviewUrl : URL for displaying a web preview of the shared folder. + PreviewUrl string `json:"preview_url"` + // SharedFolderId : The ID of the shared folder. + SharedFolderId string `json:"shared_folder_id"` + // TimeInvited : Timestamp indicating when the current user was invited to + // this shared folder. + TimeInvited time.Time `json:"time_invited"` +} + +// NewSharedFolderMetadata returns a new SharedFolderMetadata instance +func NewSharedFolderMetadata(AccessType *AccessLevel, IsInsideTeamFolder bool, IsTeamFolder bool, Name string, Policy *FolderPolicy, PreviewUrl string, SharedFolderId string, TimeInvited time.Time) *SharedFolderMetadata { + s := new(SharedFolderMetadata) + s.AccessType = AccessType + s.IsInsideTeamFolder = IsInsideTeamFolder + s.IsTeamFolder = IsTeamFolder + s.Name = Name + s.Policy = Policy + s.PreviewUrl = PreviewUrl + s.SharedFolderId = SharedFolderId + s.TimeInvited = TimeInvited + return s +} + +// SharedLinkAccessFailureReason : has no documentation (yet) +type SharedLinkAccessFailureReason struct { + dropbox.Tagged +} + +// Valid tag values for SharedLinkAccessFailureReason +const ( + SharedLinkAccessFailureReasonLoginRequired = "login_required" + SharedLinkAccessFailureReasonEmailVerifyRequired = "email_verify_required" + SharedLinkAccessFailureReasonPasswordRequired = "password_required" + SharedLinkAccessFailureReasonTeamOnly = "team_only" + SharedLinkAccessFailureReasonOwnerOnly = "owner_only" + SharedLinkAccessFailureReasonOther = "other" +) + +// SharedLinkPolicy : Who can view shared links in this folder. +type SharedLinkPolicy struct { + dropbox.Tagged +} + +// Valid tag values for SharedLinkPolicy +const ( + SharedLinkPolicyAnyone = "anyone" + SharedLinkPolicyTeam = "team" + SharedLinkPolicyMembers = "members" + SharedLinkPolicyOther = "other" +) + +// SharedLinkSettings : has no documentation (yet) +type SharedLinkSettings struct { + // RequestedVisibility : The requested access for this shared link. + RequestedVisibility *RequestedVisibility `json:"requested_visibility,omitempty"` + // LinkPassword : If `requested_visibility` is + // `RequestedVisibility.password` this is needed to specify the password to + // access the link. + LinkPassword string `json:"link_password,omitempty"` + // Expires : Expiration time of the shared link. By default the link won't + // expire. + Expires time.Time `json:"expires,omitempty"` +} + +// NewSharedLinkSettings returns a new SharedLinkSettings instance +func NewSharedLinkSettings() *SharedLinkSettings { + s := new(SharedLinkSettings) + return s +} + +// SharedLinkSettingsError : has no documentation (yet) +type SharedLinkSettingsError struct { + dropbox.Tagged +} + +// Valid tag values for SharedLinkSettingsError +const ( + SharedLinkSettingsErrorInvalidSettings = "invalid_settings" + SharedLinkSettingsErrorNotAuthorized = "not_authorized" +) + +// SharingFileAccessError : User could not access this file. +type SharingFileAccessError struct { + dropbox.Tagged +} + +// Valid tag values for SharingFileAccessError +const ( + SharingFileAccessErrorNoPermission = "no_permission" + SharingFileAccessErrorInvalidFile = "invalid_file" + SharingFileAccessErrorIsFolder = "is_folder" + SharingFileAccessErrorInsidePublicFolder = "inside_public_folder" + SharingFileAccessErrorInsideOsxPackage = "inside_osx_package" + SharingFileAccessErrorOther = "other" +) + +// SharingUserError : User account had a problem preventing this action. +type SharingUserError struct { + dropbox.Tagged +} + +// Valid tag values for SharingUserError +const ( + SharingUserErrorEmailUnverified = "email_unverified" + SharingUserErrorOther = "other" +) + +// TeamMemberInfo : Information about a team member. +type TeamMemberInfo struct { + // TeamInfo : Information about the member's team + TeamInfo *users.Team `json:"team_info"` + // DisplayName : The display name of the user. + DisplayName string `json:"display_name"` + // MemberId : ID of user as a member of a team. This field will only be + // present if the member is in the same team as current user. + MemberId string `json:"member_id,omitempty"` +} + +// NewTeamMemberInfo returns a new TeamMemberInfo instance +func NewTeamMemberInfo(TeamInfo *users.Team, DisplayName string) *TeamMemberInfo { + s := new(TeamMemberInfo) + s.TeamInfo = TeamInfo + s.DisplayName = DisplayName + return s +} + +// TransferFolderArg : has no documentation (yet) +type TransferFolderArg struct { + // SharedFolderId : The ID for the shared folder. + SharedFolderId string `json:"shared_folder_id"` + // ToDropboxId : A account or team member ID to transfer ownership to. + ToDropboxId string `json:"to_dropbox_id"` +} + +// NewTransferFolderArg returns a new TransferFolderArg instance +func NewTransferFolderArg(SharedFolderId string, ToDropboxId string) *TransferFolderArg { + s := new(TransferFolderArg) + s.SharedFolderId = SharedFolderId + s.ToDropboxId = ToDropboxId + return s +} + +// TransferFolderError : has no documentation (yet) +type TransferFolderError struct { + dropbox.Tagged + // AccessError : has no documentation (yet) + AccessError *SharedFolderAccessError `json:"access_error,omitempty"` +} + +// Valid tag values for TransferFolderError +const ( + TransferFolderErrorAccessError = "access_error" + TransferFolderErrorInvalidDropboxId = "invalid_dropbox_id" + TransferFolderErrorNewOwnerNotAMember = "new_owner_not_a_member" + TransferFolderErrorNewOwnerUnmounted = "new_owner_unmounted" + TransferFolderErrorNewOwnerEmailUnverified = "new_owner_email_unverified" + TransferFolderErrorTeamFolder = "team_folder" + TransferFolderErrorNoPermission = "no_permission" + TransferFolderErrorOther = "other" +) + +// UnmarshalJSON deserializes into a TransferFolderError instance +func (u *TransferFolderError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // AccessError : has no documentation (yet) + AccessError json.RawMessage `json:"access_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 + } + } + return nil +} + +// UnmountFolderArg : has no documentation (yet) +type UnmountFolderArg struct { + // SharedFolderId : The ID for the shared folder. + SharedFolderId string `json:"shared_folder_id"` +} + +// NewUnmountFolderArg returns a new UnmountFolderArg instance +func NewUnmountFolderArg(SharedFolderId string) *UnmountFolderArg { + s := new(UnmountFolderArg) + s.SharedFolderId = SharedFolderId + return s +} + +// UnmountFolderError : has no documentation (yet) +type UnmountFolderError struct { + dropbox.Tagged + // AccessError : has no documentation (yet) + AccessError *SharedFolderAccessError `json:"access_error,omitempty"` +} + +// Valid tag values for UnmountFolderError +const ( + UnmountFolderErrorAccessError = "access_error" + UnmountFolderErrorNoPermission = "no_permission" + UnmountFolderErrorNotUnmountable = "not_unmountable" + UnmountFolderErrorOther = "other" +) + +// UnmarshalJSON deserializes into a UnmountFolderError instance +func (u *UnmountFolderError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // AccessError : has no documentation (yet) + AccessError json.RawMessage `json:"access_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 + } + } + return nil +} + +// UnshareFileArg : Arguments for `unshareFile`. +type UnshareFileArg struct { + // File : The file to unshare. + File string `json:"file"` +} + +// NewUnshareFileArg returns a new UnshareFileArg instance +func NewUnshareFileArg(File string) *UnshareFileArg { + s := new(UnshareFileArg) + s.File = File + return s +} + +// UnshareFileError : Error result for `unshareFile`. +type UnshareFileError struct { + dropbox.Tagged + // UserError : has no documentation (yet) + UserError *SharingUserError `json:"user_error,omitempty"` + // AccessError : has no documentation (yet) + AccessError *SharingFileAccessError `json:"access_error,omitempty"` +} + +// Valid tag values for UnshareFileError +const ( + UnshareFileErrorUserError = "user_error" + UnshareFileErrorAccessError = "access_error" + UnshareFileErrorOther = "other" +) + +// UnmarshalJSON deserializes into a UnshareFileError instance +func (u *UnshareFileError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // UserError : has no documentation (yet) + UserError json.RawMessage `json:"user_error,omitempty"` + // AccessError : has no documentation (yet) + AccessError json.RawMessage `json:"access_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 "user_error": + err = json.Unmarshal(w.UserError, &u.UserError) + + if err != nil { + return err + } + case "access_error": + err = json.Unmarshal(w.AccessError, &u.AccessError) + + if err != nil { + return err + } + } + return nil +} + +// UnshareFolderArg : has no documentation (yet) +type UnshareFolderArg struct { + // SharedFolderId : The ID for the shared folder. + SharedFolderId string `json:"shared_folder_id"` + // LeaveACopy : If true, members of this shared folder will get a copy of + // this folder after it's unshared. Otherwise, it will be removed from their + // Dropbox. The current user, who is an owner, will always retain their + // copy. + LeaveACopy bool `json:"leave_a_copy"` +} + +// NewUnshareFolderArg returns a new UnshareFolderArg instance +func NewUnshareFolderArg(SharedFolderId string) *UnshareFolderArg { + s := new(UnshareFolderArg) + s.SharedFolderId = SharedFolderId + s.LeaveACopy = false + return s +} + +// UnshareFolderError : has no documentation (yet) +type UnshareFolderError struct { + dropbox.Tagged + // AccessError : has no documentation (yet) + AccessError *SharedFolderAccessError `json:"access_error,omitempty"` +} + +// Valid tag values for UnshareFolderError +const ( + UnshareFolderErrorAccessError = "access_error" + UnshareFolderErrorTeamFolder = "team_folder" + UnshareFolderErrorNoPermission = "no_permission" + UnshareFolderErrorTooManyFiles = "too_many_files" + UnshareFolderErrorOther = "other" +) + +// UnmarshalJSON deserializes into a UnshareFolderError instance +func (u *UnshareFolderError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // AccessError : has no documentation (yet) + AccessError json.RawMessage `json:"access_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 + } + } + return nil +} + +// UpdateFileMemberArgs : Arguments for `updateFileMember`. +type UpdateFileMemberArgs struct { + ChangeFileMemberAccessArgs +} + +// NewUpdateFileMemberArgs returns a new UpdateFileMemberArgs instance +func NewUpdateFileMemberArgs(File string, Member *MemberSelector, AccessLevel *AccessLevel) *UpdateFileMemberArgs { + s := new(UpdateFileMemberArgs) + s.File = File + s.Member = Member + s.AccessLevel = AccessLevel + return s +} + +// UpdateFolderMemberArg : has no documentation (yet) +type UpdateFolderMemberArg struct { + // SharedFolderId : The ID for the shared folder. + SharedFolderId string `json:"shared_folder_id"` + // Member : The member of the shared folder to update. Only the + // `MemberSelector.dropbox_id` may be set at this time. + Member *MemberSelector `json:"member"` + // AccessLevel : The new access level for `member`. `AccessLevel.owner` is + // disallowed. + AccessLevel *AccessLevel `json:"access_level"` +} + +// NewUpdateFolderMemberArg returns a new UpdateFolderMemberArg instance +func NewUpdateFolderMemberArg(SharedFolderId string, Member *MemberSelector, AccessLevel *AccessLevel) *UpdateFolderMemberArg { + s := new(UpdateFolderMemberArg) + s.SharedFolderId = SharedFolderId + s.Member = Member + s.AccessLevel = AccessLevel + return s +} + +// UpdateFolderMemberError : has no documentation (yet) +type UpdateFolderMemberError struct { + dropbox.Tagged + // AccessError : has no documentation (yet) + AccessError *SharedFolderAccessError `json:"access_error,omitempty"` + // MemberError : has no documentation (yet) + MemberError *SharedFolderMemberError `json:"member_error,omitempty"` + // NoExplicitAccess : If updating the access type required the member to be + // added to the shared folder and there was an error when adding the member. + NoExplicitAccess *AddFolderMemberError `json:"no_explicit_access,omitempty"` +} + +// Valid tag values for UpdateFolderMemberError +const ( + UpdateFolderMemberErrorAccessError = "access_error" + UpdateFolderMemberErrorMemberError = "member_error" + UpdateFolderMemberErrorNoExplicitAccess = "no_explicit_access" + UpdateFolderMemberErrorInsufficientPlan = "insufficient_plan" + UpdateFolderMemberErrorNoPermission = "no_permission" + UpdateFolderMemberErrorOther = "other" +) + +// UnmarshalJSON deserializes into a UpdateFolderMemberError instance +func (u *UpdateFolderMemberError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // AccessError : has no documentation (yet) + AccessError json.RawMessage `json:"access_error,omitempty"` + // MemberError : has no documentation (yet) + MemberError json.RawMessage `json:"member_error,omitempty"` + // NoExplicitAccess : If updating the access type required the member to + // be added to the shared folder and there was an error when adding the + // member. + NoExplicitAccess json.RawMessage `json:"no_explicit_access,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 "member_error": + err = json.Unmarshal(w.MemberError, &u.MemberError) + + if err != nil { + return err + } + case "no_explicit_access": + err = json.Unmarshal(w.NoExplicitAccess, &u.NoExplicitAccess) + + if err != nil { + return err + } + } + return nil +} + +// UpdateFolderPolicyArg : If any of the policies are unset, then they retain +// their current setting. +type UpdateFolderPolicyArg struct { + // SharedFolderId : The ID for the shared folder. + SharedFolderId string `json:"shared_folder_id"` + // MemberPolicy : Who can be a member of this shared folder. Only applicable + // if the current user is on a team. + MemberPolicy *MemberPolicy `json:"member_policy,omitempty"` + // AclUpdatePolicy : Who can add and remove members of this shared folder. + AclUpdatePolicy *AclUpdatePolicy `json:"acl_update_policy,omitempty"` + // ViewerInfoPolicy : Who can enable/disable viewer info for this shared + // folder. + ViewerInfoPolicy *ViewerInfoPolicy `json:"viewer_info_policy,omitempty"` + // SharedLinkPolicy : The policy to apply to shared links created for + // content inside this shared folder. The current user must be on a team to + // set this policy to `SharedLinkPolicy.members`. + SharedLinkPolicy *SharedLinkPolicy `json:"shared_link_policy,omitempty"` + // LinkSettings : Settings on the link for this folder. + LinkSettings *LinkSettings `json:"link_settings,omitempty"` + // Actions : A list of `FolderAction`s corresponding to `FolderPermission`s + // that should appear in the response's `SharedFolderMetadata.permissions` + // field describing the actions the authenticated user can perform on the + // folder. + Actions []*FolderAction `json:"actions,omitempty"` +} + +// NewUpdateFolderPolicyArg returns a new UpdateFolderPolicyArg instance +func NewUpdateFolderPolicyArg(SharedFolderId string) *UpdateFolderPolicyArg { + s := new(UpdateFolderPolicyArg) + s.SharedFolderId = SharedFolderId + return s +} + +// UpdateFolderPolicyError : has no documentation (yet) +type UpdateFolderPolicyError struct { + dropbox.Tagged + // AccessError : has no documentation (yet) + AccessError *SharedFolderAccessError `json:"access_error,omitempty"` +} + +// Valid tag values for UpdateFolderPolicyError +const ( + UpdateFolderPolicyErrorAccessError = "access_error" + UpdateFolderPolicyErrorNotOnTeam = "not_on_team" + UpdateFolderPolicyErrorTeamPolicyDisallowsMemberPolicy = "team_policy_disallows_member_policy" + UpdateFolderPolicyErrorDisallowedSharedLinkPolicy = "disallowed_shared_link_policy" + UpdateFolderPolicyErrorNoPermission = "no_permission" + UpdateFolderPolicyErrorTeamFolder = "team_folder" + UpdateFolderPolicyErrorOther = "other" +) + +// UnmarshalJSON deserializes into a UpdateFolderPolicyError instance +func (u *UpdateFolderPolicyError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // AccessError : has no documentation (yet) + AccessError json.RawMessage `json:"access_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 + } + } + return nil +} + +// UserInfo : Basic information about a user. Use `usersAccount` and +// `usersAccountBatch` to obtain more detailed information. +type UserInfo struct { + // AccountId : The account ID of the user. + AccountId string `json:"account_id"` + // SameTeam : If the user is in the same team as current user. + SameTeam bool `json:"same_team"` + // TeamMemberId : The team member ID of the shared folder member. Only + // present if `same_team` is true. + TeamMemberId string `json:"team_member_id,omitempty"` +} + +// NewUserInfo returns a new UserInfo instance +func NewUserInfo(AccountId string, SameTeam bool) *UserInfo { + s := new(UserInfo) + s.AccountId = AccountId + s.SameTeam = SameTeam + 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 +} + +// Valid tag values for ViewerInfoPolicy +const ( + ViewerInfoPolicyEnabled = "enabled" + ViewerInfoPolicyDisabled = "disabled" + ViewerInfoPolicyOther = "other" +) + +// Visibility : Who can access a shared link. The most open visibility is +// `public`. The default depends on many aspects, such as team and user +// preferences and shared folder settings. +type Visibility struct { + dropbox.Tagged +} + +// Valid tag values for Visibility +const ( + VisibilityPublic = "public" + VisibilityTeamOnly = "team_only" + VisibilityPassword = "password" + VisibilityTeamAndPassword = "team_and_password" + VisibilitySharedFolderOnly = "shared_folder_only" + VisibilityOther = "other" +) diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team/client.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team/client.go new file mode 100644 index 000000000..771bbfcbf --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team/client.go @@ -0,0 +1,4140 @@ +// Copyright (c) Dropbox, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package team + +import ( + "bytes" + "encoding/json" + "io/ioutil" + "log" + "net/http" + + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/async" + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/properties" +) + +// Client interface describes all routes in this namespace +type Client interface { + // DevicesListMemberDevices : List all device sessions of a team's member. + DevicesListMemberDevices(arg *ListMemberDevicesArg) (res *ListMemberDevicesResult, err error) + // DevicesListMembersDevices : List all device sessions of a team. + DevicesListMembersDevices(arg *ListMembersDevicesArg) (res *ListMembersDevicesResult, err error) + // DevicesListTeamDevices : List all device sessions of a team. + // Deprecated: Use `DevicesListMembersDevices` instead + DevicesListTeamDevices(arg *ListTeamDevicesArg) (res *ListTeamDevicesResult, err error) + // DevicesRevokeDeviceSession : Revoke a device session of a team's member + DevicesRevokeDeviceSession(arg *RevokeDeviceSessionArg) (err error) + // DevicesRevokeDeviceSessionBatch : Revoke a list of device sessions of + // team members + DevicesRevokeDeviceSessionBatch(arg *RevokeDeviceSessionBatchArg) (res *RevokeDeviceSessionBatchResult, err error) + // FeaturesGetValues : Get the values for one or more featues. This route + // allows you to check your account's capability for what feature you can + // access or what value you have for certain features. Permission : Team + // information. + FeaturesGetValues(arg *FeaturesGetValuesBatchArg) (res *FeaturesGetValuesBatchResult, err error) + // GetInfo : Retrieves information about a team. + GetInfo() (res *TeamGetInfoResult, err error) + // GroupsCreate : Creates a new, empty group, with a requested name. + // Permission : Team member management. + GroupsCreate(arg *GroupCreateArg) (res *GroupFullInfo, err error) + // GroupsDelete : Deletes a group. The group is deleted immediately. However + // the revoking of group-owned resources may take additional time. Use the + // `groupsJobStatusGet` to determine whether this process has completed. + // Permission : Team member management. + GroupsDelete(arg *GroupSelector) (res *async.LaunchEmptyResult, err error) + // GroupsGetInfo : Retrieves information about one or more groups. Note that + // the optional field `GroupFullInfo.members` is not returned for + // system-managed groups. Permission : Team Information. + GroupsGetInfo(arg *GroupsSelector) (res []*GroupsGetInfoItem, err error) + // GroupsJobStatusGet : Once an async_job_id is returned from + // `groupsDelete`, `groupsMembersAdd` , or `groupsMembersRemove` use this + // method to poll the status of granting/revoking group members' access to + // group-owned resources. Permission : Team member management. + GroupsJobStatusGet(arg *async.PollArg) (res *async.PollEmptyResult, err error) + // GroupsList : Lists groups on a team. Permission : Team Information. + GroupsList(arg *GroupsListArg) (res *GroupsListResult, err error) + // GroupsListContinue : Once a cursor has been retrieved from `groupsList`, + // use this to paginate through all groups. Permission : Team Information. + GroupsListContinue(arg *GroupsListContinueArg) (res *GroupsListResult, err error) + // GroupsMembersAdd : Adds members to a group. The members are added + // immediately. However the granting of group-owned resources may take + // additional time. Use the `groupsJobStatusGet` to determine whether this + // process has completed. Permission : Team member management. + GroupsMembersAdd(arg *GroupMembersAddArg) (res *GroupMembersChangeResult, err error) + // GroupsMembersList : Lists members of a group. Permission : Team + // Information. + GroupsMembersList(arg *GroupsMembersListArg) (res *GroupsMembersListResult, err error) + // GroupsMembersListContinue : Once a cursor has been retrieved from + // `groupsMembersList`, use this to paginate through all members of the + // group. Permission : Team information. + GroupsMembersListContinue(arg *GroupsMembersListContinueArg) (res *GroupsMembersListResult, err error) + // GroupsMembersRemove : Removes members from a group. The members are + // removed immediately. However the revoking of group-owned resources may + // take additional time. Use the `groupsJobStatusGet` to determine whether + // this process has completed. This method permits removing the only owner + // of a group, even in cases where this is not possible via the web client. + // Permission : Team member management. + GroupsMembersRemove(arg *GroupMembersRemoveArg) (res *GroupMembersChangeResult, err error) + // GroupsMembersSetAccessType : Sets a member's access type in a group. + // Permission : Team member management. + GroupsMembersSetAccessType(arg *GroupMembersSetAccessTypeArg) (res []*GroupsGetInfoItem, err error) + // GroupsUpdate : Updates a group's name and/or external ID. Permission : + // Team member management. + GroupsUpdate(arg *GroupUpdateArgs) (res *GroupFullInfo, err error) + // LinkedAppsListMemberLinkedApps : List all linked applications of the team + // member. Note, this endpoint does not list any team-linked applications. + LinkedAppsListMemberLinkedApps(arg *ListMemberAppsArg) (res *ListMemberAppsResult, err error) + // LinkedAppsListMembersLinkedApps : List all applications linked to the + // team members' accounts. Note, this endpoint does not list any team-linked + // applications. + LinkedAppsListMembersLinkedApps(arg *ListMembersAppsArg) (res *ListMembersAppsResult, err error) + // LinkedAppsListTeamLinkedApps : List all applications linked to the team + // members' accounts. Note, this endpoint doesn't list any team-linked + // applications. + // Deprecated: Use `LinkedAppsListMembersLinkedApps` instead + LinkedAppsListTeamLinkedApps(arg *ListTeamAppsArg) (res *ListTeamAppsResult, err error) + // LinkedAppsRevokeLinkedApp : Revoke a linked application of the team + // member + LinkedAppsRevokeLinkedApp(arg *RevokeLinkedApiAppArg) (err error) + // LinkedAppsRevokeLinkedAppBatch : Revoke a list of linked applications of + // the team members + LinkedAppsRevokeLinkedAppBatch(arg *RevokeLinkedApiAppBatchArg) (res *RevokeLinkedAppBatchResult, err error) + // MembersAdd : Adds members to a team. Permission : Team member management + // A maximum of 20 members can be specified in a single call. If no Dropbox + // account exists with the email address specified, a new Dropbox account + // will be created with the given email address, and that account will be + // invited to the team. If a personal Dropbox account exists with the email + // address specified in the call, this call will create a placeholder + // Dropbox account for the user on the team and send an email inviting the + // user to migrate their existing personal account onto the team. Team + // member management apps are required to set an initial given_name and + // surname for a user to use in the team invitation and for 'Perform as team + // member' actions taken on the user before they become 'active'. + MembersAdd(arg *MembersAddArg) (res *MembersAddLaunch, err error) + // MembersAddJobStatusGet : Once an async_job_id is returned from + // `membersAdd` , use this to poll the status of the asynchronous request. + // Permission : Team member management + MembersAddJobStatusGet(arg *async.PollArg) (res *MembersAddJobStatus, err error) + // MembersGetInfo : Returns information about multiple team members. + // Permission : Team information This endpoint will return + // `MembersGetInfoItem.id_not_found`, for IDs (or emails) that cannot be + // matched to a valid team member. + MembersGetInfo(arg *MembersGetInfoArgs) (res []*MembersGetInfoItem, err error) + // MembersList : Lists members of a team. Permission : Team information + MembersList(arg *MembersListArg) (res *MembersListResult, err error) + // MembersListContinue : Once a cursor has been retrieved from + // `membersList`, use this to paginate through all team members. Permission + // : Team information + MembersListContinue(arg *MembersListContinueArg) (res *MembersListResult, err error) + // MembersRecover : Recover a deleted member. Permission : Team member + // management Exactly one of team_member_id, email, or external_id must be + // provided to identify the user account. + MembersRecover(arg *MembersRecoverArg) (err error) + // MembersRemove : Removes a member from a team. Permission : Team member + // management Exactly one of team_member_id, email, or external_id must be + // provided to identify the user account. Accounts can be recovered via + // `membersRecover` for a 7 day period or until the account has been + // permanently deleted or transferred to another account (whichever comes + // first). Calling `membersAdd` while a user is still recoverable on your + // team will return with `MemberAddResult.user_already_on_team`. This + // endpoint may initiate an asynchronous job. To obtain the final result of + // the job, the client should periodically poll `membersRemoveJobStatusGet`. + MembersRemove(arg *MembersRemoveArg) (res *async.LaunchEmptyResult, err error) + // MembersRemoveJobStatusGet : Once an async_job_id is returned from + // `membersRemove` , use this to poll the status of the asynchronous + // request. Permission : Team member management + MembersRemoveJobStatusGet(arg *async.PollArg) (res *async.PollEmptyResult, err error) + // MembersSendWelcomeEmail : Sends welcome email to pending team member. + // Permission : Team member management Exactly one of team_member_id, email, + // or external_id must be provided to identify the user account. No-op if + // team member is not pending. + MembersSendWelcomeEmail(arg *UserSelectorArg) (err error) + // MembersSetAdminPermissions : Updates a team member's permissions. + // Permission : Team member management + MembersSetAdminPermissions(arg *MembersSetPermissionsArg) (res *MembersSetPermissionsResult, err error) + // MembersSetProfile : Updates a team member's profile. Permission : Team + // member management + MembersSetProfile(arg *MembersSetProfileArg) (res *TeamMemberInfo, err error) + // MembersSuspend : Suspend a member from a team. Permission : Team member + // management Exactly one of team_member_id, email, or external_id must be + // provided to identify the user account. + MembersSuspend(arg *MembersDeactivateArg) (err error) + // MembersUnsuspend : Unsuspend a member from a team. Permission : Team + // member management Exactly one of team_member_id, email, or external_id + // must be provided to identify the user account. + MembersUnsuspend(arg *MembersUnsuspendArg) (err error) + // NamespacesList : Returns a list of all team-accessible namespaces. This + // list includes team folders, shared folders containing team members, team + // members' home namespaces, and team members' app folders. Home namespaces + // and app folders are always owned by this team or members of the team, but + // shared folders may be owned by other users or other teams. Duplicates may + // occur in the list. + NamespacesList(arg *TeamNamespacesListArg) (res *TeamNamespacesListResult, err error) + // NamespacesListContinue : Once a cursor has been retrieved from + // `namespacesList`, use this to paginate through all team-accessible + // namespaces. Duplicates may occur in the list. + NamespacesListContinue(arg *TeamNamespacesListContinueArg) (res *TeamNamespacesListResult, err error) + // PropertiesTemplateAdd : Add a property template. See route + // files/properties/add to add properties to a file. + PropertiesTemplateAdd(arg *AddPropertyTemplateArg) (res *AddPropertyTemplateResult, err error) + // PropertiesTemplateGet : Get the schema for a specified template. + PropertiesTemplateGet(arg *properties.GetPropertyTemplateArg) (res *properties.GetPropertyTemplateResult, err error) + // PropertiesTemplateList : Get the property template identifiers for a + // team. To get the schema of each template use `propertiesTemplateGet`. + PropertiesTemplateList() (res *properties.ListPropertyTemplateIds, err error) + // PropertiesTemplateUpdate : Update a property template. This route can + // update the template name, the template description and add optional + // properties to templates. + PropertiesTemplateUpdate(arg *UpdatePropertyTemplateArg) (res *UpdatePropertyTemplateResult, err error) + // ReportsGetActivity : Retrieves reporting data about a team's user + // activity. + ReportsGetActivity(arg *DateRange) (res *GetActivityReport, err error) + // ReportsGetDevices : Retrieves reporting data about a team's linked + // devices. + ReportsGetDevices(arg *DateRange) (res *GetDevicesReport, err error) + // ReportsGetMembership : Retrieves reporting data about a team's + // membership. + ReportsGetMembership(arg *DateRange) (res *GetMembershipReport, err error) + // ReportsGetStorage : Retrieves reporting data about a team's storage + // usage. + ReportsGetStorage(arg *DateRange) (res *GetStorageReport, err error) + // TeamFolderActivate : Sets an archived team folder's status to active. + // Permission : Team member file access. + TeamFolderActivate(arg *TeamFolderIdArg) (res *TeamFolderMetadata, err error) + // TeamFolderArchive : Sets an active team folder's status to archived and + // removes all folder and file members. Permission : Team member file + // access. + TeamFolderArchive(arg *TeamFolderArchiveArg) (res *TeamFolderArchiveLaunch, err error) + // TeamFolderArchiveCheck : Returns the status of an asynchronous job for + // archiving a team folder. Permission : Team member file access. + TeamFolderArchiveCheck(arg *async.PollArg) (res *TeamFolderArchiveJobStatus, err error) + // TeamFolderCreate : Creates a new, active, team folder. Permission : Team + // member file access. + TeamFolderCreate(arg *TeamFolderCreateArg) (res *TeamFolderMetadata, err error) + // TeamFolderGetInfo : Retrieves metadata for team folders. Permission : + // Team member file access. + TeamFolderGetInfo(arg *TeamFolderIdListArg) (res []*TeamFolderGetInfoItem, err error) + // TeamFolderList : Lists all team folders. Permission : Team member file + // access. + TeamFolderList(arg *TeamFolderListArg) (res *TeamFolderListResult, err error) + // TeamFolderListContinue : Once a cursor has been retrieved from + // `teamFolderList`, use this to paginate through all team folders. + // Permission : Team member file access. + TeamFolderListContinue(arg *TeamFolderListContinueArg) (res *TeamFolderListResult, err error) + // TeamFolderPermanentlyDelete : Permanently deletes an archived team + // folder. Permission : Team member file access. + TeamFolderPermanentlyDelete(arg *TeamFolderIdArg) (err error) + // TeamFolderRename : Changes an active team folder's name. Permission : + // Team member file access. + TeamFolderRename(arg *TeamFolderRenameArg) (res *TeamFolderMetadata, err error) + // TokenGetAuthenticatedAdmin : Returns the member profile of the admin who + // generated the team access token used to make the call. + TokenGetAuthenticatedAdmin() (res *TokenGetAuthenticatedAdminResult, err error) +} + +type apiImpl dropbox.Context + +//DevicesListMemberDevicesAPIError is an error-wrapper for the devices/list_member_devices route +type DevicesListMemberDevicesAPIError struct { + dropbox.APIError + EndpointError *ListMemberDevicesError `json:"error"` +} + +func (dbx *apiImpl) DevicesListMemberDevices(arg *ListMemberDevicesArg) (res *ListMemberDevicesResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "devices/list_member_devices", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError DevicesListMemberDevicesAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//DevicesListMembersDevicesAPIError is an error-wrapper for the devices/list_members_devices route +type DevicesListMembersDevicesAPIError struct { + dropbox.APIError + EndpointError *ListMembersDevicesError `json:"error"` +} + +func (dbx *apiImpl) DevicesListMembersDevices(arg *ListMembersDevicesArg) (res *ListMembersDevicesResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "devices/list_members_devices", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError DevicesListMembersDevicesAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//DevicesListTeamDevicesAPIError is an error-wrapper for the devices/list_team_devices route +type DevicesListTeamDevicesAPIError struct { + dropbox.APIError + EndpointError *ListTeamDevicesError `json:"error"` +} + +func (dbx *apiImpl) DevicesListTeamDevices(arg *ListTeamDevicesArg) (res *ListTeamDevicesResult, err error) { + log.Printf("WARNING: API `DevicesListTeamDevices` is deprecated") + log.Printf("Use API `DevicesListMembersDevices` instead") + + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "devices/list_team_devices", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError DevicesListTeamDevicesAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//DevicesRevokeDeviceSessionAPIError is an error-wrapper for the devices/revoke_device_session route +type DevicesRevokeDeviceSessionAPIError struct { + dropbox.APIError + EndpointError *RevokeDeviceSessionError `json:"error"` +} + +func (dbx *apiImpl) DevicesRevokeDeviceSession(arg *RevokeDeviceSessionArg) (err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "devices/revoke_device_session", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + return + } + if resp.StatusCode == http.StatusConflict { + var apiError DevicesRevokeDeviceSessionAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//DevicesRevokeDeviceSessionBatchAPIError is an error-wrapper for the devices/revoke_device_session_batch route +type DevicesRevokeDeviceSessionBatchAPIError struct { + dropbox.APIError + EndpointError *RevokeDeviceSessionBatchError `json:"error"` +} + +func (dbx *apiImpl) DevicesRevokeDeviceSessionBatch(arg *RevokeDeviceSessionBatchArg) (res *RevokeDeviceSessionBatchResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "devices/revoke_device_session_batch", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError DevicesRevokeDeviceSessionBatchAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//FeaturesGetValuesAPIError is an error-wrapper for the features/get_values route +type FeaturesGetValuesAPIError struct { + dropbox.APIError + EndpointError *FeaturesGetValuesBatchError `json:"error"` +} + +func (dbx *apiImpl) FeaturesGetValues(arg *FeaturesGetValuesBatchArg) (res *FeaturesGetValuesBatchResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "features/get_values", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError FeaturesGetValuesAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//GetInfoAPIError is an error-wrapper for the get_info route +type GetInfoAPIError struct { + dropbox.APIError + EndpointError struct{} `json:"error"` +} + +func (dbx *apiImpl) GetInfo() (res *TeamGetInfoResult, err error) { + cli := dbx.Client + + headers := map[string]string{} + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "get_info", headers, nil) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GetInfoAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//GroupsCreateAPIError is an error-wrapper for the groups/create route +type GroupsCreateAPIError struct { + dropbox.APIError + EndpointError *GroupCreateError `json:"error"` +} + +func (dbx *apiImpl) GroupsCreate(arg *GroupCreateArg) (res *GroupFullInfo, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "groups/create", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GroupsCreateAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//GroupsDeleteAPIError is an error-wrapper for the groups/delete route +type GroupsDeleteAPIError struct { + dropbox.APIError + EndpointError *GroupDeleteError `json:"error"` +} + +func (dbx *apiImpl) GroupsDelete(arg *GroupSelector) (res *async.LaunchEmptyResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "groups/delete", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GroupsDeleteAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//GroupsGetInfoAPIError is an error-wrapper for the groups/get_info route +type GroupsGetInfoAPIError struct { + dropbox.APIError + EndpointError *GroupsGetInfoError `json:"error"` +} + +func (dbx *apiImpl) GroupsGetInfo(arg *GroupsSelector) (res []*GroupsGetInfoItem, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "groups/get_info", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GroupsGetInfoAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//GroupsJobStatusGetAPIError is an error-wrapper for the groups/job_status/get route +type GroupsJobStatusGetAPIError struct { + dropbox.APIError + EndpointError *GroupsPollError `json:"error"` +} + +func (dbx *apiImpl) GroupsJobStatusGet(arg *async.PollArg) (res *async.PollEmptyResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "groups/job_status/get", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GroupsJobStatusGetAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//GroupsListAPIError is an error-wrapper for the groups/list route +type GroupsListAPIError struct { + dropbox.APIError + EndpointError struct{} `json:"error"` +} + +func (dbx *apiImpl) GroupsList(arg *GroupsListArg) (res *GroupsListResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "groups/list", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GroupsListAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//GroupsListContinueAPIError is an error-wrapper for the groups/list/continue route +type GroupsListContinueAPIError struct { + dropbox.APIError + EndpointError *GroupsListContinueError `json:"error"` +} + +func (dbx *apiImpl) GroupsListContinue(arg *GroupsListContinueArg) (res *GroupsListResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "groups/list/continue", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GroupsListContinueAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//GroupsMembersAddAPIError is an error-wrapper for the groups/members/add route +type GroupsMembersAddAPIError struct { + dropbox.APIError + EndpointError *GroupMembersAddError `json:"error"` +} + +func (dbx *apiImpl) GroupsMembersAdd(arg *GroupMembersAddArg) (res *GroupMembersChangeResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "groups/members/add", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GroupsMembersAddAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//GroupsMembersListAPIError is an error-wrapper for the groups/members/list route +type GroupsMembersListAPIError struct { + dropbox.APIError + EndpointError *GroupSelectorError `json:"error"` +} + +func (dbx *apiImpl) GroupsMembersList(arg *GroupsMembersListArg) (res *GroupsMembersListResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "groups/members/list", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GroupsMembersListAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//GroupsMembersListContinueAPIError is an error-wrapper for the groups/members/list/continue route +type GroupsMembersListContinueAPIError struct { + dropbox.APIError + EndpointError *GroupsMembersListContinueError `json:"error"` +} + +func (dbx *apiImpl) GroupsMembersListContinue(arg *GroupsMembersListContinueArg) (res *GroupsMembersListResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "groups/members/list/continue", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GroupsMembersListContinueAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//GroupsMembersRemoveAPIError is an error-wrapper for the groups/members/remove route +type GroupsMembersRemoveAPIError struct { + dropbox.APIError + EndpointError *GroupMembersRemoveError `json:"error"` +} + +func (dbx *apiImpl) GroupsMembersRemove(arg *GroupMembersRemoveArg) (res *GroupMembersChangeResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "groups/members/remove", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GroupsMembersRemoveAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//GroupsMembersSetAccessTypeAPIError is an error-wrapper for the groups/members/set_access_type route +type GroupsMembersSetAccessTypeAPIError struct { + dropbox.APIError + EndpointError *GroupMemberSetAccessTypeError `json:"error"` +} + +func (dbx *apiImpl) GroupsMembersSetAccessType(arg *GroupMembersSetAccessTypeArg) (res []*GroupsGetInfoItem, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "groups/members/set_access_type", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GroupsMembersSetAccessTypeAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//GroupsUpdateAPIError is an error-wrapper for the groups/update route +type GroupsUpdateAPIError struct { + dropbox.APIError + EndpointError *GroupUpdateError `json:"error"` +} + +func (dbx *apiImpl) GroupsUpdate(arg *GroupUpdateArgs) (res *GroupFullInfo, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "groups/update", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GroupsUpdateAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//LinkedAppsListMemberLinkedAppsAPIError is an error-wrapper for the linked_apps/list_member_linked_apps route +type LinkedAppsListMemberLinkedAppsAPIError struct { + dropbox.APIError + EndpointError *ListMemberAppsError `json:"error"` +} + +func (dbx *apiImpl) LinkedAppsListMemberLinkedApps(arg *ListMemberAppsArg) (res *ListMemberAppsResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "linked_apps/list_member_linked_apps", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError LinkedAppsListMemberLinkedAppsAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//LinkedAppsListMembersLinkedAppsAPIError is an error-wrapper for the linked_apps/list_members_linked_apps route +type LinkedAppsListMembersLinkedAppsAPIError struct { + dropbox.APIError + EndpointError *ListMembersAppsError `json:"error"` +} + +func (dbx *apiImpl) LinkedAppsListMembersLinkedApps(arg *ListMembersAppsArg) (res *ListMembersAppsResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "linked_apps/list_members_linked_apps", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError LinkedAppsListMembersLinkedAppsAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//LinkedAppsListTeamLinkedAppsAPIError is an error-wrapper for the linked_apps/list_team_linked_apps route +type LinkedAppsListTeamLinkedAppsAPIError struct { + dropbox.APIError + EndpointError *ListTeamAppsError `json:"error"` +} + +func (dbx *apiImpl) LinkedAppsListTeamLinkedApps(arg *ListTeamAppsArg) (res *ListTeamAppsResult, err error) { + log.Printf("WARNING: API `LinkedAppsListTeamLinkedApps` is deprecated") + log.Printf("Use API `LinkedAppsListMembersLinkedApps` instead") + + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "linked_apps/list_team_linked_apps", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError LinkedAppsListTeamLinkedAppsAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//LinkedAppsRevokeLinkedAppAPIError is an error-wrapper for the linked_apps/revoke_linked_app route +type LinkedAppsRevokeLinkedAppAPIError struct { + dropbox.APIError + EndpointError *RevokeLinkedAppError `json:"error"` +} + +func (dbx *apiImpl) LinkedAppsRevokeLinkedApp(arg *RevokeLinkedApiAppArg) (err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "linked_apps/revoke_linked_app", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + return + } + if resp.StatusCode == http.StatusConflict { + var apiError LinkedAppsRevokeLinkedAppAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//LinkedAppsRevokeLinkedAppBatchAPIError is an error-wrapper for the linked_apps/revoke_linked_app_batch route +type LinkedAppsRevokeLinkedAppBatchAPIError struct { + dropbox.APIError + EndpointError *RevokeLinkedAppBatchError `json:"error"` +} + +func (dbx *apiImpl) LinkedAppsRevokeLinkedAppBatch(arg *RevokeLinkedApiAppBatchArg) (res *RevokeLinkedAppBatchResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "linked_apps/revoke_linked_app_batch", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError LinkedAppsRevokeLinkedAppBatchAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//MembersAddAPIError is an error-wrapper for the members/add route +type MembersAddAPIError struct { + dropbox.APIError + EndpointError struct{} `json:"error"` +} + +func (dbx *apiImpl) MembersAdd(arg *MembersAddArg) (res *MembersAddLaunch, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/add", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError MembersAddAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//MembersAddJobStatusGetAPIError is an error-wrapper for the members/add/job_status/get route +type MembersAddJobStatusGetAPIError struct { + dropbox.APIError + EndpointError *async.PollError `json:"error"` +} + +func (dbx *apiImpl) MembersAddJobStatusGet(arg *async.PollArg) (res *MembersAddJobStatus, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/add/job_status/get", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError MembersAddJobStatusGetAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//MembersGetInfoAPIError is an error-wrapper for the members/get_info route +type MembersGetInfoAPIError struct { + dropbox.APIError + EndpointError *MembersGetInfoError `json:"error"` +} + +func (dbx *apiImpl) MembersGetInfo(arg *MembersGetInfoArgs) (res []*MembersGetInfoItem, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/get_info", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError MembersGetInfoAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//MembersListAPIError is an error-wrapper for the members/list route +type MembersListAPIError struct { + dropbox.APIError + EndpointError *MembersListError `json:"error"` +} + +func (dbx *apiImpl) MembersList(arg *MembersListArg) (res *MembersListResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/list", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError MembersListAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//MembersListContinueAPIError is an error-wrapper for the members/list/continue route +type MembersListContinueAPIError struct { + dropbox.APIError + EndpointError *MembersListContinueError `json:"error"` +} + +func (dbx *apiImpl) MembersListContinue(arg *MembersListContinueArg) (res *MembersListResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/list/continue", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError MembersListContinueAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//MembersRecoverAPIError is an error-wrapper for the members/recover route +type MembersRecoverAPIError struct { + dropbox.APIError + EndpointError *MembersRecoverError `json:"error"` +} + +func (dbx *apiImpl) MembersRecover(arg *MembersRecoverArg) (err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/recover", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + return + } + if resp.StatusCode == http.StatusConflict { + var apiError MembersRecoverAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//MembersRemoveAPIError is an error-wrapper for the members/remove route +type MembersRemoveAPIError struct { + dropbox.APIError + EndpointError *MembersRemoveError `json:"error"` +} + +func (dbx *apiImpl) MembersRemove(arg *MembersRemoveArg) (res *async.LaunchEmptyResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/remove", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError MembersRemoveAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//MembersRemoveJobStatusGetAPIError is an error-wrapper for the members/remove/job_status/get route +type MembersRemoveJobStatusGetAPIError struct { + dropbox.APIError + EndpointError *async.PollError `json:"error"` +} + +func (dbx *apiImpl) MembersRemoveJobStatusGet(arg *async.PollArg) (res *async.PollEmptyResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/remove/job_status/get", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError MembersRemoveJobStatusGetAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//MembersSendWelcomeEmailAPIError is an error-wrapper for the members/send_welcome_email route +type MembersSendWelcomeEmailAPIError struct { + dropbox.APIError + EndpointError *MembersSendWelcomeError `json:"error"` +} + +func (dbx *apiImpl) MembersSendWelcomeEmail(arg *UserSelectorArg) (err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/send_welcome_email", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + return + } + if resp.StatusCode == http.StatusConflict { + var apiError MembersSendWelcomeEmailAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//MembersSetAdminPermissionsAPIError is an error-wrapper for the members/set_admin_permissions route +type MembersSetAdminPermissionsAPIError struct { + dropbox.APIError + EndpointError *MembersSetPermissionsError `json:"error"` +} + +func (dbx *apiImpl) MembersSetAdminPermissions(arg *MembersSetPermissionsArg) (res *MembersSetPermissionsResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/set_admin_permissions", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError MembersSetAdminPermissionsAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//MembersSetProfileAPIError is an error-wrapper for the members/set_profile route +type MembersSetProfileAPIError struct { + dropbox.APIError + EndpointError *MembersSetProfileError `json:"error"` +} + +func (dbx *apiImpl) MembersSetProfile(arg *MembersSetProfileArg) (res *TeamMemberInfo, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/set_profile", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError MembersSetProfileAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//MembersSuspendAPIError is an error-wrapper for the members/suspend route +type MembersSuspendAPIError struct { + dropbox.APIError + EndpointError *MembersSuspendError `json:"error"` +} + +func (dbx *apiImpl) MembersSuspend(arg *MembersDeactivateArg) (err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/suspend", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + return + } + if resp.StatusCode == http.StatusConflict { + var apiError MembersSuspendAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//MembersUnsuspendAPIError is an error-wrapper for the members/unsuspend route +type MembersUnsuspendAPIError struct { + dropbox.APIError + EndpointError *MembersUnsuspendError `json:"error"` +} + +func (dbx *apiImpl) MembersUnsuspend(arg *MembersUnsuspendArg) (err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/unsuspend", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + return + } + if resp.StatusCode == http.StatusConflict { + var apiError MembersUnsuspendAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//NamespacesListAPIError is an error-wrapper for the namespaces/list route +type NamespacesListAPIError struct { + dropbox.APIError + EndpointError struct{} `json:"error"` +} + +func (dbx *apiImpl) NamespacesList(arg *TeamNamespacesListArg) (res *TeamNamespacesListResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "namespaces/list", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError NamespacesListAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//NamespacesListContinueAPIError is an error-wrapper for the namespaces/list/continue route +type NamespacesListContinueAPIError struct { + dropbox.APIError + EndpointError *TeamNamespacesListContinueError `json:"error"` +} + +func (dbx *apiImpl) NamespacesListContinue(arg *TeamNamespacesListContinueArg) (res *TeamNamespacesListResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "namespaces/list/continue", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError NamespacesListContinueAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//PropertiesTemplateAddAPIError is an error-wrapper for the properties/template/add route +type PropertiesTemplateAddAPIError struct { + dropbox.APIError + EndpointError *properties.ModifyPropertyTemplateError `json:"error"` +} + +func (dbx *apiImpl) PropertiesTemplateAdd(arg *AddPropertyTemplateArg) (res *AddPropertyTemplateResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "properties/template/add", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError PropertiesTemplateAddAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//PropertiesTemplateGetAPIError is an error-wrapper for the properties/template/get route +type PropertiesTemplateGetAPIError struct { + dropbox.APIError + EndpointError *properties.PropertyTemplateError `json:"error"` +} + +func (dbx *apiImpl) PropertiesTemplateGet(arg *properties.GetPropertyTemplateArg) (res *properties.GetPropertyTemplateResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "properties/template/get", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError PropertiesTemplateGetAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//PropertiesTemplateListAPIError is an error-wrapper for the properties/template/list route +type PropertiesTemplateListAPIError struct { + dropbox.APIError + EndpointError *properties.PropertyTemplateError `json:"error"` +} + +func (dbx *apiImpl) PropertiesTemplateList() (res *properties.ListPropertyTemplateIds, err error) { + cli := dbx.Client + + headers := map[string]string{} + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "properties/template/list", headers, nil) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError PropertiesTemplateListAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//PropertiesTemplateUpdateAPIError is an error-wrapper for the properties/template/update route +type PropertiesTemplateUpdateAPIError struct { + dropbox.APIError + EndpointError *properties.ModifyPropertyTemplateError `json:"error"` +} + +func (dbx *apiImpl) PropertiesTemplateUpdate(arg *UpdatePropertyTemplateArg) (res *UpdatePropertyTemplateResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "properties/template/update", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError PropertiesTemplateUpdateAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//ReportsGetActivityAPIError is an error-wrapper for the reports/get_activity route +type ReportsGetActivityAPIError struct { + dropbox.APIError + EndpointError *DateRangeError `json:"error"` +} + +func (dbx *apiImpl) ReportsGetActivity(arg *DateRange) (res *GetActivityReport, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "reports/get_activity", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError ReportsGetActivityAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//ReportsGetDevicesAPIError is an error-wrapper for the reports/get_devices route +type ReportsGetDevicesAPIError struct { + dropbox.APIError + EndpointError *DateRangeError `json:"error"` +} + +func (dbx *apiImpl) ReportsGetDevices(arg *DateRange) (res *GetDevicesReport, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "reports/get_devices", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError ReportsGetDevicesAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//ReportsGetMembershipAPIError is an error-wrapper for the reports/get_membership route +type ReportsGetMembershipAPIError struct { + dropbox.APIError + EndpointError *DateRangeError `json:"error"` +} + +func (dbx *apiImpl) ReportsGetMembership(arg *DateRange) (res *GetMembershipReport, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "reports/get_membership", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError ReportsGetMembershipAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//ReportsGetStorageAPIError is an error-wrapper for the reports/get_storage route +type ReportsGetStorageAPIError struct { + dropbox.APIError + EndpointError *DateRangeError `json:"error"` +} + +func (dbx *apiImpl) ReportsGetStorage(arg *DateRange) (res *GetStorageReport, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "reports/get_storage", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError ReportsGetStorageAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//TeamFolderActivateAPIError is an error-wrapper for the team_folder/activate route +type TeamFolderActivateAPIError struct { + dropbox.APIError + EndpointError *TeamFolderActivateError `json:"error"` +} + +func (dbx *apiImpl) TeamFolderActivate(arg *TeamFolderIdArg) (res *TeamFolderMetadata, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "team_folder/activate", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError TeamFolderActivateAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//TeamFolderArchiveAPIError is an error-wrapper for the team_folder/archive route +type TeamFolderArchiveAPIError struct { + dropbox.APIError + EndpointError *TeamFolderArchiveError `json:"error"` +} + +func (dbx *apiImpl) TeamFolderArchive(arg *TeamFolderArchiveArg) (res *TeamFolderArchiveLaunch, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "team_folder/archive", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError TeamFolderArchiveAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//TeamFolderArchiveCheckAPIError is an error-wrapper for the team_folder/archive/check route +type TeamFolderArchiveCheckAPIError struct { + dropbox.APIError + EndpointError *async.PollError `json:"error"` +} + +func (dbx *apiImpl) TeamFolderArchiveCheck(arg *async.PollArg) (res *TeamFolderArchiveJobStatus, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "team_folder/archive/check", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError TeamFolderArchiveCheckAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//TeamFolderCreateAPIError is an error-wrapper for the team_folder/create route +type TeamFolderCreateAPIError struct { + dropbox.APIError + EndpointError *TeamFolderCreateError `json:"error"` +} + +func (dbx *apiImpl) TeamFolderCreate(arg *TeamFolderCreateArg) (res *TeamFolderMetadata, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "team_folder/create", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError TeamFolderCreateAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//TeamFolderGetInfoAPIError is an error-wrapper for the team_folder/get_info route +type TeamFolderGetInfoAPIError struct { + dropbox.APIError + EndpointError struct{} `json:"error"` +} + +func (dbx *apiImpl) TeamFolderGetInfo(arg *TeamFolderIdListArg) (res []*TeamFolderGetInfoItem, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "team_folder/get_info", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError TeamFolderGetInfoAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//TeamFolderListAPIError is an error-wrapper for the team_folder/list route +type TeamFolderListAPIError struct { + dropbox.APIError + EndpointError *TeamFolderListError `json:"error"` +} + +func (dbx *apiImpl) TeamFolderList(arg *TeamFolderListArg) (res *TeamFolderListResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "team_folder/list", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError TeamFolderListAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//TeamFolderListContinueAPIError is an error-wrapper for the team_folder/list/continue route +type TeamFolderListContinueAPIError struct { + dropbox.APIError + EndpointError *TeamFolderListContinueError `json:"error"` +} + +func (dbx *apiImpl) TeamFolderListContinue(arg *TeamFolderListContinueArg) (res *TeamFolderListResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "team_folder/list/continue", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError TeamFolderListContinueAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//TeamFolderPermanentlyDeleteAPIError is an error-wrapper for the team_folder/permanently_delete route +type TeamFolderPermanentlyDeleteAPIError struct { + dropbox.APIError + EndpointError *TeamFolderPermanentlyDeleteError `json:"error"` +} + +func (dbx *apiImpl) TeamFolderPermanentlyDelete(arg *TeamFolderIdArg) (err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "team_folder/permanently_delete", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + return + } + if resp.StatusCode == http.StatusConflict { + var apiError TeamFolderPermanentlyDeleteAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//TeamFolderRenameAPIError is an error-wrapper for the team_folder/rename route +type TeamFolderRenameAPIError struct { + dropbox.APIError + EndpointError *TeamFolderRenameError `json:"error"` +} + +func (dbx *apiImpl) TeamFolderRename(arg *TeamFolderRenameArg) (res *TeamFolderMetadata, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "team_folder/rename", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError TeamFolderRenameAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//TokenGetAuthenticatedAdminAPIError is an error-wrapper for the token/get_authenticated_admin route +type TokenGetAuthenticatedAdminAPIError struct { + dropbox.APIError + EndpointError *TokenGetAuthenticatedAdminError `json:"error"` +} + +func (dbx *apiImpl) TokenGetAuthenticatedAdmin() (res *TokenGetAuthenticatedAdminResult, err error) { + cli := dbx.Client + + headers := map[string]string{} + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "token/get_authenticated_admin", headers, nil) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError TokenGetAuthenticatedAdminAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +// New returns a Client implementation for this namespace +func New(c dropbox.Config) *apiImpl { + ctx := apiImpl(dropbox.NewContext(c)) + return &ctx +} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team/types.go new file mode 100644 index 000000000..f2a177367 --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team/types.go @@ -0,0 +1,3508 @@ +// Copyright (c) Dropbox, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package team : has no documentation (yet) +package team + +import ( + "encoding/json" + "time" + + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/properties" + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_common" + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_policies" + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users" +) + +// DeviceSession : has no documentation (yet) +type DeviceSession struct { + // SessionId : The session id + SessionId string `json:"session_id"` + // IpAddress : The IP address of the last activity from this session + IpAddress string `json:"ip_address,omitempty"` + // Country : The country from which the last activity from this session was + // made + Country string `json:"country,omitempty"` + // Created : The time this session was created + Created time.Time `json:"created,omitempty"` + // Updated : The time of the last activity from this session + Updated time.Time `json:"updated,omitempty"` +} + +// NewDeviceSession returns a new DeviceSession instance +func NewDeviceSession(SessionId string) *DeviceSession { + s := new(DeviceSession) + s.SessionId = SessionId + return s +} + +// ActiveWebSession : Information on active web sessions +type ActiveWebSession struct { + DeviceSession + // UserAgent : Information on the hosting device + UserAgent string `json:"user_agent"` + // Os : Information on the hosting operating system + Os string `json:"os"` + // Browser : Information on the browser used for this web session + Browser string `json:"browser"` + // Expires : The time this session expires + Expires time.Time `json:"expires,omitempty"` +} + +// NewActiveWebSession returns a new ActiveWebSession instance +func NewActiveWebSession(SessionId string, UserAgent string, Os string, Browser string) *ActiveWebSession { + s := new(ActiveWebSession) + s.SessionId = SessionId + s.UserAgent = UserAgent + s.Os = Os + s.Browser = Browser + return s +} + +// AddPropertyTemplateArg : Arguments for adding property templates. +type AddPropertyTemplateArg struct { + properties.PropertyGroupTemplate +} + +// NewAddPropertyTemplateArg returns a new AddPropertyTemplateArg instance +func NewAddPropertyTemplateArg(Name string, Description string, Fields []*properties.PropertyFieldTemplate) *AddPropertyTemplateArg { + s := new(AddPropertyTemplateArg) + s.Name = Name + s.Description = Description + s.Fields = Fields + return s +} + +// AddPropertyTemplateResult : has no documentation (yet) +type AddPropertyTemplateResult struct { + // TemplateId : An identifier for property template added by + // `propertiesTemplateAdd`. + TemplateId string `json:"template_id"` +} + +// NewAddPropertyTemplateResult returns a new AddPropertyTemplateResult instance +func NewAddPropertyTemplateResult(TemplateId string) *AddPropertyTemplateResult { + s := new(AddPropertyTemplateResult) + s.TemplateId = TemplateId + return s +} + +// AdminTier : Describes which team-related admin permissions a user has. +type AdminTier struct { + dropbox.Tagged +} + +// Valid tag values for AdminTier +const ( + AdminTierTeamAdmin = "team_admin" + AdminTierUserManagementAdmin = "user_management_admin" + AdminTierSupportAdmin = "support_admin" + AdminTierMemberOnly = "member_only" +) + +// ApiApp : Information on linked third party applications +type ApiApp struct { + // AppId : The application unique id + AppId string `json:"app_id"` + // AppName : The application name + AppName string `json:"app_name"` + // Publisher : The application publisher name + Publisher string `json:"publisher,omitempty"` + // PublisherUrl : The publisher's URL + PublisherUrl string `json:"publisher_url,omitempty"` + // Linked : The time this application was linked + Linked time.Time `json:"linked,omitempty"` + // IsAppFolder : Whether the linked application uses a dedicated folder + IsAppFolder bool `json:"is_app_folder"` +} + +// NewApiApp returns a new ApiApp instance +func NewApiApp(AppId string, AppName string, IsAppFolder bool) *ApiApp { + s := new(ApiApp) + s.AppId = AppId + s.AppName = AppName + s.IsAppFolder = IsAppFolder + return s +} + +// BaseDfbReport : Base report structure. +type BaseDfbReport struct { + // StartDate : First date present in the results as 'YYYY-MM-DD' or None. + StartDate string `json:"start_date"` +} + +// NewBaseDfbReport returns a new BaseDfbReport instance +func NewBaseDfbReport(StartDate string) *BaseDfbReport { + s := new(BaseDfbReport) + s.StartDate = StartDate + return s +} + +// BaseTeamFolderError : Base error that all errors for existing team folders +// should extend. +type BaseTeamFolderError 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 BaseTeamFolderError +const ( + BaseTeamFolderErrorAccessError = "access_error" + BaseTeamFolderErrorStatusError = "status_error" + BaseTeamFolderErrorTeamSharedDropboxError = "team_shared_dropbox_error" + BaseTeamFolderErrorOther = "other" +) + +// UnmarshalJSON deserializes into a BaseTeamFolderError instance +func (u *BaseTeamFolderError) 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 +} + +// DateRange : Input arguments that can be provided for most reports. +type DateRange struct { + // StartDate : Optional starting date (inclusive) + StartDate time.Time `json:"start_date,omitempty"` + // EndDate : Optional ending date (exclusive) + EndDate time.Time `json:"end_date,omitempty"` +} + +// NewDateRange returns a new DateRange instance +func NewDateRange() *DateRange { + s := new(DateRange) + return s +} + +// DateRangeError : Errors that can originate from problems in input arguments +// to reports. +type DateRangeError struct { + dropbox.Tagged +} + +// Valid tag values for DateRangeError +const ( + DateRangeErrorOther = "other" +) + +// DesktopClientSession : Information about linked Dropbox desktop client +// sessions +type DesktopClientSession struct { + DeviceSession + // HostName : Name of the hosting desktop + HostName string `json:"host_name"` + // ClientType : The Dropbox desktop client type + ClientType *DesktopPlatform `json:"client_type"` + // ClientVersion : The Dropbox client version + ClientVersion string `json:"client_version"` + // Platform : Information on the hosting platform + Platform string `json:"platform"` + // IsDeleteOnUnlinkSupported : Whether it's possible to delete all of the + // account files upon unlinking + IsDeleteOnUnlinkSupported bool `json:"is_delete_on_unlink_supported"` +} + +// NewDesktopClientSession returns a new DesktopClientSession instance +func NewDesktopClientSession(SessionId string, HostName string, ClientType *DesktopPlatform, ClientVersion string, Platform string, IsDeleteOnUnlinkSupported bool) *DesktopClientSession { + s := new(DesktopClientSession) + s.SessionId = SessionId + s.HostName = HostName + s.ClientType = ClientType + s.ClientVersion = ClientVersion + s.Platform = Platform + s.IsDeleteOnUnlinkSupported = IsDeleteOnUnlinkSupported + return s +} + +// DesktopPlatform : has no documentation (yet) +type DesktopPlatform struct { + dropbox.Tagged +} + +// Valid tag values for DesktopPlatform +const ( + DesktopPlatformWindows = "windows" + DesktopPlatformMac = "mac" + DesktopPlatformLinux = "linux" + DesktopPlatformOther = "other" +) + +// DeviceSessionArg : has no documentation (yet) +type DeviceSessionArg struct { + // SessionId : The session id + SessionId string `json:"session_id"` + // TeamMemberId : The unique id of the member owning the device + TeamMemberId string `json:"team_member_id"` +} + +// NewDeviceSessionArg returns a new DeviceSessionArg instance +func NewDeviceSessionArg(SessionId string, TeamMemberId string) *DeviceSessionArg { + s := new(DeviceSessionArg) + s.SessionId = SessionId + s.TeamMemberId = TeamMemberId + return s +} + +// DevicesActive : Each of the items is an array of values, one value per day. +// The value is the number of devices active within a time window, ending with +// that day. If there is no data for a day, then the value will be None. +type DevicesActive struct { + // Windows : Array of number of linked windows (desktop) clients with + // activity. + Windows []uint64 `json:"windows"` + // Macos : Array of number of linked mac (desktop) clients with activity. + Macos []uint64 `json:"macos"` + // Linux : Array of number of linked linus (desktop) clients with activity. + Linux []uint64 `json:"linux"` + // Ios : Array of number of linked ios devices with activity. + Ios []uint64 `json:"ios"` + // Android : Array of number of linked android devices with activity. + Android []uint64 `json:"android"` + // Other : Array of number of other linked devices (blackberry, windows + // phone, etc) with activity. + Other []uint64 `json:"other"` + // Total : Array of total number of linked clients with activity. + Total []uint64 `json:"total"` +} + +// NewDevicesActive returns a new DevicesActive instance +func NewDevicesActive(Windows []uint64, Macos []uint64, Linux []uint64, Ios []uint64, Android []uint64, Other []uint64, Total []uint64) *DevicesActive { + s := new(DevicesActive) + s.Windows = Windows + s.Macos = Macos + s.Linux = Linux + s.Ios = Ios + s.Android = Android + s.Other = Other + s.Total = Total + return s +} + +// Feature : A set of features that Dropbox for Business account support. +type Feature struct { + dropbox.Tagged +} + +// Valid tag values for Feature +const ( + FeatureUploadApiRateLimit = "upload_api_rate_limit" + FeatureHasTeamSharedDropbox = "has_team_shared_dropbox" + FeatureOther = "other" +) + +// FeatureValue : The values correspond to entries in `Feature`. You may get +// different value according to your Dropbox for Business plan. +type FeatureValue struct { + dropbox.Tagged + // UploadApiRateLimit : has no documentation (yet) + UploadApiRateLimit *UploadApiRateLimitValue `json:"upload_api_rate_limit,omitempty"` + // HasTeamSharedDropbox : has no documentation (yet) + HasTeamSharedDropbox *HasTeamSharedDropboxValue `json:"has_team_shared_dropbox,omitempty"` +} + +// Valid tag values for FeatureValue +const ( + FeatureValueUploadApiRateLimit = "upload_api_rate_limit" + FeatureValueHasTeamSharedDropbox = "has_team_shared_dropbox" + FeatureValueOther = "other" +) + +// UnmarshalJSON deserializes into a FeatureValue instance +func (u *FeatureValue) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // UploadApiRateLimit : has no documentation (yet) + UploadApiRateLimit json.RawMessage `json:"upload_api_rate_limit,omitempty"` + // HasTeamSharedDropbox : has no documentation (yet) + HasTeamSharedDropbox json.RawMessage `json:"has_team_shared_dropbox,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 "upload_api_rate_limit": + err = json.Unmarshal(w.UploadApiRateLimit, &u.UploadApiRateLimit) + + if err != nil { + return err + } + case "has_team_shared_dropbox": + err = json.Unmarshal(w.HasTeamSharedDropbox, &u.HasTeamSharedDropbox) + + if err != nil { + return err + } + } + return nil +} + +// FeaturesGetValuesBatchArg : has no documentation (yet) +type FeaturesGetValuesBatchArg struct { + // Features : A list of features in `Feature`. If the list is empty, this + // route will return `FeaturesGetValuesBatchError`. + Features []*Feature `json:"features"` +} + +// NewFeaturesGetValuesBatchArg returns a new FeaturesGetValuesBatchArg instance +func NewFeaturesGetValuesBatchArg(Features []*Feature) *FeaturesGetValuesBatchArg { + s := new(FeaturesGetValuesBatchArg) + s.Features = Features + return s +} + +// FeaturesGetValuesBatchError : has no documentation (yet) +type FeaturesGetValuesBatchError struct { + dropbox.Tagged +} + +// Valid tag values for FeaturesGetValuesBatchError +const ( + FeaturesGetValuesBatchErrorEmptyFeaturesList = "empty_features_list" + FeaturesGetValuesBatchErrorOther = "other" +) + +// FeaturesGetValuesBatchResult : has no documentation (yet) +type FeaturesGetValuesBatchResult struct { + // Values : has no documentation (yet) + Values []*FeatureValue `json:"values"` +} + +// NewFeaturesGetValuesBatchResult returns a new FeaturesGetValuesBatchResult instance +func NewFeaturesGetValuesBatchResult(Values []*FeatureValue) *FeaturesGetValuesBatchResult { + s := new(FeaturesGetValuesBatchResult) + s.Values = Values + return s +} + +// GetActivityReport : Activity Report Result. Each of the items in the storage +// report is an array of values, one value per day. If there is no data for a +// day, then the value will be None. +type GetActivityReport struct { + BaseDfbReport + // Adds : Array of total number of adds by team members. + Adds []uint64 `json:"adds"` + // Edits : Array of number of edits by team members. If the same user edits + // the same file multiple times this is counted as a single edit. + Edits []uint64 `json:"edits"` + // Deletes : Array of total number of deletes by team members. + Deletes []uint64 `json:"deletes"` + // ActiveUsers28Day : Array of the number of users who have been active in + // the last 28 days. + ActiveUsers28Day []uint64 `json:"active_users_28_day"` + // ActiveUsers7Day : Array of the number of users who have been active in + // the last week. + ActiveUsers7Day []uint64 `json:"active_users_7_day"` + // ActiveUsers1Day : Array of the number of users who have been active in + // the last day. + ActiveUsers1Day []uint64 `json:"active_users_1_day"` + // ActiveSharedFolders28Day : Array of the number of shared folders with + // some activity in the last 28 days. + ActiveSharedFolders28Day []uint64 `json:"active_shared_folders_28_day"` + // ActiveSharedFolders7Day : Array of the number of shared folders with some + // activity in the last week. + ActiveSharedFolders7Day []uint64 `json:"active_shared_folders_7_day"` + // ActiveSharedFolders1Day : Array of the number of shared folders with some + // activity in the last day. + ActiveSharedFolders1Day []uint64 `json:"active_shared_folders_1_day"` + // SharedLinksCreated : Array of the number of shared links created. + SharedLinksCreated []uint64 `json:"shared_links_created"` + // SharedLinksViewedByTeam : Array of the number of views by team users to + // shared links created by the team. + SharedLinksViewedByTeam []uint64 `json:"shared_links_viewed_by_team"` + // SharedLinksViewedByOutsideUser : Array of the number of views by users + // outside of the team to shared links created by the team. + SharedLinksViewedByOutsideUser []uint64 `json:"shared_links_viewed_by_outside_user"` + // SharedLinksViewedByNotLoggedIn : Array of the number of views by + // non-logged-in users to shared links created by the team. + SharedLinksViewedByNotLoggedIn []uint64 `json:"shared_links_viewed_by_not_logged_in"` + // SharedLinksViewedTotal : Array of the total number of views to shared + // links created by the team. + SharedLinksViewedTotal []uint64 `json:"shared_links_viewed_total"` +} + +// NewGetActivityReport returns a new GetActivityReport instance +func NewGetActivityReport(StartDate string, Adds []uint64, Edits []uint64, Deletes []uint64, ActiveUsers28Day []uint64, ActiveUsers7Day []uint64, ActiveUsers1Day []uint64, ActiveSharedFolders28Day []uint64, ActiveSharedFolders7Day []uint64, ActiveSharedFolders1Day []uint64, SharedLinksCreated []uint64, SharedLinksViewedByTeam []uint64, SharedLinksViewedByOutsideUser []uint64, SharedLinksViewedByNotLoggedIn []uint64, SharedLinksViewedTotal []uint64) *GetActivityReport { + s := new(GetActivityReport) + s.StartDate = StartDate + s.Adds = Adds + s.Edits = Edits + s.Deletes = Deletes + s.ActiveUsers28Day = ActiveUsers28Day + s.ActiveUsers7Day = ActiveUsers7Day + s.ActiveUsers1Day = ActiveUsers1Day + s.ActiveSharedFolders28Day = ActiveSharedFolders28Day + s.ActiveSharedFolders7Day = ActiveSharedFolders7Day + s.ActiveSharedFolders1Day = ActiveSharedFolders1Day + s.SharedLinksCreated = SharedLinksCreated + s.SharedLinksViewedByTeam = SharedLinksViewedByTeam + s.SharedLinksViewedByOutsideUser = SharedLinksViewedByOutsideUser + s.SharedLinksViewedByNotLoggedIn = SharedLinksViewedByNotLoggedIn + s.SharedLinksViewedTotal = SharedLinksViewedTotal + return s +} + +// GetDevicesReport : Devices Report Result. Contains subsections for different +// time ranges of activity. Each of the items in each subsection of the storage +// report is an array of values, one value per day. If there is no data for a +// day, then the value will be None. +type GetDevicesReport struct { + BaseDfbReport + // Active1Day : Report of the number of devices active in the last day. + Active1Day *DevicesActive `json:"active_1_day"` + // Active7Day : Report of the number of devices active in the last 7 days. + Active7Day *DevicesActive `json:"active_7_day"` + // Active28Day : Report of the number of devices active in the last 28 days. + Active28Day *DevicesActive `json:"active_28_day"` +} + +// NewGetDevicesReport returns a new GetDevicesReport instance +func NewGetDevicesReport(StartDate string, Active1Day *DevicesActive, Active7Day *DevicesActive, Active28Day *DevicesActive) *GetDevicesReport { + s := new(GetDevicesReport) + s.StartDate = StartDate + s.Active1Day = Active1Day + s.Active7Day = Active7Day + s.Active28Day = Active28Day + return s +} + +// GetMembershipReport : Membership Report Result. Each of the items in the +// storage report is an array of values, one value per day. If there is no data +// for a day, then the value will be None. +type GetMembershipReport struct { + BaseDfbReport + // TeamSize : Team size, for each day. + TeamSize []uint64 `json:"team_size"` + // PendingInvites : The number of pending invites to the team, for each day. + PendingInvites []uint64 `json:"pending_invites"` + // MembersJoined : The number of members that joined the team, for each day. + MembersJoined []uint64 `json:"members_joined"` + // SuspendedMembers : The number of suspended team members, for each day. + SuspendedMembers []uint64 `json:"suspended_members"` + // Licenses : The total number of licenses the team has, for each day. + Licenses []uint64 `json:"licenses"` +} + +// NewGetMembershipReport returns a new GetMembershipReport instance +func NewGetMembershipReport(StartDate string, TeamSize []uint64, PendingInvites []uint64, MembersJoined []uint64, SuspendedMembers []uint64, Licenses []uint64) *GetMembershipReport { + s := new(GetMembershipReport) + s.StartDate = StartDate + s.TeamSize = TeamSize + s.PendingInvites = PendingInvites + s.MembersJoined = MembersJoined + s.SuspendedMembers = SuspendedMembers + s.Licenses = Licenses + return s +} + +// GetStorageReport : Storage Report Result. Each of the items in the storage +// report is an array of values, one value per day. If there is no data for a +// day, then the value will be None. +type GetStorageReport struct { + BaseDfbReport + // TotalUsage : Sum of the shared, unshared, and datastore usages, for each + // day. + TotalUsage []uint64 `json:"total_usage"` + // SharedUsage : Array of the combined size (bytes) of team members' shared + // folders, for each day. + SharedUsage []uint64 `json:"shared_usage"` + // UnsharedUsage : Array of the combined size (bytes) of team members' root + // namespaces, for each day. + UnsharedUsage []uint64 `json:"unshared_usage"` + // SharedFolders : Array of the number of shared folders owned by team + // members, for each day. + SharedFolders []uint64 `json:"shared_folders"` + // MemberStorageMap : Array of storage summaries of team members' account + // sizes. Each storage summary is an array of key, value pairs, where each + // pair describes a storage bucket. The key indicates the upper bound of the + // bucket and the value is the number of users in that bucket. There is one + // such summary per day. If there is no data for a day, the storage summary + // will be empty. + MemberStorageMap [][]*StorageBucket `json:"member_storage_map"` +} + +// NewGetStorageReport returns a new GetStorageReport instance +func NewGetStorageReport(StartDate string, TotalUsage []uint64, SharedUsage []uint64, UnsharedUsage []uint64, SharedFolders []uint64, MemberStorageMap [][]*StorageBucket) *GetStorageReport { + s := new(GetStorageReport) + s.StartDate = StartDate + s.TotalUsage = TotalUsage + s.SharedUsage = SharedUsage + s.UnsharedUsage = UnsharedUsage + s.SharedFolders = SharedFolders + s.MemberStorageMap = MemberStorageMap + return s +} + +// GroupAccessType : Role of a user in group. +type GroupAccessType struct { + dropbox.Tagged +} + +// Valid tag values for GroupAccessType +const ( + GroupAccessTypeMember = "member" + GroupAccessTypeOwner = "owner" +) + +// GroupCreateArg : has no documentation (yet) +type GroupCreateArg struct { + // GroupName : Group name. + GroupName string `json:"group_name"` + // GroupExternalId : The creator of a team can associate an arbitrary + // external ID to the group. + GroupExternalId string `json:"group_external_id,omitempty"` + // GroupManagementType : Whether the team can be managed by selected users, + // or only by team admins. + GroupManagementType *team_common.GroupManagementType `json:"group_management_type,omitempty"` +} + +// NewGroupCreateArg returns a new GroupCreateArg instance +func NewGroupCreateArg(GroupName string) *GroupCreateArg { + s := new(GroupCreateArg) + s.GroupName = GroupName + return s +} + +// GroupCreateError : has no documentation (yet) +type GroupCreateError struct { + dropbox.Tagged +} + +// Valid tag values for GroupCreateError +const ( + GroupCreateErrorGroupNameAlreadyUsed = "group_name_already_used" + GroupCreateErrorGroupNameInvalid = "group_name_invalid" + GroupCreateErrorExternalIdAlreadyInUse = "external_id_already_in_use" + GroupCreateErrorSystemManagedGroupDisallowed = "system_managed_group_disallowed" + GroupCreateErrorOther = "other" +) + +// GroupSelectorError : Error that can be raised when `GroupSelector` is used. +type GroupSelectorError struct { + dropbox.Tagged +} + +// Valid tag values for GroupSelectorError +const ( + GroupSelectorErrorGroupNotFound = "group_not_found" + GroupSelectorErrorOther = "other" +) + +// GroupSelectorWithTeamGroupError : Error that can be raised when +// `GroupSelector` is used and team groups are disallowed from being used. +type GroupSelectorWithTeamGroupError struct { + dropbox.Tagged +} + +// Valid tag values for GroupSelectorWithTeamGroupError +const ( + GroupSelectorWithTeamGroupErrorSystemManagedGroupDisallowed = "system_managed_group_disallowed" +) + +// GroupDeleteError : has no documentation (yet) +type GroupDeleteError struct { + dropbox.Tagged +} + +// Valid tag values for GroupDeleteError +const ( + GroupDeleteErrorGroupAlreadyDeleted = "group_already_deleted" +) + +// GroupFullInfo : Full description of a group. +type GroupFullInfo struct { + team_common.GroupSummary + // Members : List of group members. + Members []*GroupMemberInfo `json:"members,omitempty"` + // Created : The group creation time as a UTC timestamp in milliseconds + // since the Unix epoch. + Created uint64 `json:"created"` +} + +// NewGroupFullInfo returns a new GroupFullInfo instance +func NewGroupFullInfo(GroupName string, GroupId string, GroupManagementType *team_common.GroupManagementType, Created uint64) *GroupFullInfo { + s := new(GroupFullInfo) + s.GroupName = GroupName + s.GroupId = GroupId + s.GroupManagementType = GroupManagementType + s.Created = Created + return s +} + +// GroupMemberInfo : Profile of group member, and role in group. +type GroupMemberInfo struct { + // Profile : Profile of group member. + Profile *MemberProfile `json:"profile"` + // AccessType : The role that the user has in the group. + AccessType *GroupAccessType `json:"access_type"` +} + +// NewGroupMemberInfo returns a new GroupMemberInfo instance +func NewGroupMemberInfo(Profile *MemberProfile, AccessType *GroupAccessType) *GroupMemberInfo { + s := new(GroupMemberInfo) + s.Profile = Profile + s.AccessType = AccessType + return s +} + +// GroupMemberSelector : Argument for selecting a group and a single user. +type GroupMemberSelector struct { + // Group : Specify a group. + Group *GroupSelector `json:"group"` + // User : Identity of a user that is a member of `group`. + User *UserSelectorArg `json:"user"` +} + +// NewGroupMemberSelector returns a new GroupMemberSelector instance +func NewGroupMemberSelector(Group *GroupSelector, User *UserSelectorArg) *GroupMemberSelector { + s := new(GroupMemberSelector) + s.Group = Group + s.User = User + return s +} + +// GroupMemberSelectorError : Error that can be raised when +// `GroupMemberSelector` is used, and the user is required to be a member of the +// specified group. +type GroupMemberSelectorError struct { + dropbox.Tagged +} + +// Valid tag values for GroupMemberSelectorError +const ( + GroupMemberSelectorErrorMemberNotInGroup = "member_not_in_group" +) + +// GroupMemberSetAccessTypeError : has no documentation (yet) +type GroupMemberSetAccessTypeError struct { + dropbox.Tagged +} + +// Valid tag values for GroupMemberSetAccessTypeError +const ( + GroupMemberSetAccessTypeErrorUserCannotBeManagerOfCompanyManagedGroup = "user_cannot_be_manager_of_company_managed_group" +) + +// IncludeMembersArg : has no documentation (yet) +type IncludeMembersArg struct { + // ReturnMembers : Whether to return the list of members in the group. Note + // that the default value will cause all the group members to be returned + // in the response. This may take a long time for large groups. + ReturnMembers bool `json:"return_members"` +} + +// NewIncludeMembersArg returns a new IncludeMembersArg instance +func NewIncludeMembersArg() *IncludeMembersArg { + s := new(IncludeMembersArg) + s.ReturnMembers = true + return s +} + +// GroupMembersAddArg : has no documentation (yet) +type GroupMembersAddArg struct { + IncludeMembersArg + // Group : Group to which users will be added. + Group *GroupSelector `json:"group"` + // Members : List of users to be added to the group. + Members []*MemberAccess `json:"members"` +} + +// NewGroupMembersAddArg returns a new GroupMembersAddArg instance +func NewGroupMembersAddArg(Group *GroupSelector, Members []*MemberAccess) *GroupMembersAddArg { + s := new(GroupMembersAddArg) + s.Group = Group + s.Members = Members + s.ReturnMembers = true + return s +} + +// GroupMembersAddError : has no documentation (yet) +type GroupMembersAddError struct { + dropbox.Tagged + // MembersNotInTeam : These members are not part of your team. Currently, + // you cannot add members to a group if they are not part of your team, + // though this may change in a subsequent version. To add new members to + // your Dropbox Business team, use the `membersAdd` endpoint. + MembersNotInTeam []string `json:"members_not_in_team,omitempty"` + // UsersNotFound : These users were not found in Dropbox. + UsersNotFound []string `json:"users_not_found,omitempty"` + // UserCannotBeManagerOfCompanyManagedGroup : A company-managed group cannot + // be managed by a user. + UserCannotBeManagerOfCompanyManagedGroup []string `json:"user_cannot_be_manager_of_company_managed_group,omitempty"` +} + +// Valid tag values for GroupMembersAddError +const ( + GroupMembersAddErrorDuplicateUser = "duplicate_user" + GroupMembersAddErrorGroupNotInTeam = "group_not_in_team" + GroupMembersAddErrorMembersNotInTeam = "members_not_in_team" + GroupMembersAddErrorUsersNotFound = "users_not_found" + GroupMembersAddErrorUserMustBeActiveToBeOwner = "user_must_be_active_to_be_owner" + GroupMembersAddErrorUserCannotBeManagerOfCompanyManagedGroup = "user_cannot_be_manager_of_company_managed_group" +) + +// UnmarshalJSON deserializes into a GroupMembersAddError instance +func (u *GroupMembersAddError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // MembersNotInTeam : These members are not part of your team. + // Currently, you cannot add members to a group if they are not part of + // your team, though this may change in a subsequent version. To add new + // members to your Dropbox Business team, use the `membersAdd` endpoint. + MembersNotInTeam json.RawMessage `json:"members_not_in_team,omitempty"` + // UsersNotFound : These users were not found in Dropbox. + UsersNotFound json.RawMessage `json:"users_not_found,omitempty"` + // UserCannotBeManagerOfCompanyManagedGroup : A company-managed group + // cannot be managed by a user. + UserCannotBeManagerOfCompanyManagedGroup json.RawMessage `json:"user_cannot_be_manager_of_company_managed_group,omitempty"` + } + var w wrap + var err error + if err = json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "members_not_in_team": + err = json.Unmarshal(body, &u.MembersNotInTeam) + + if err != nil { + return err + } + case "users_not_found": + err = json.Unmarshal(body, &u.UsersNotFound) + + if err != nil { + return err + } + case "user_cannot_be_manager_of_company_managed_group": + err = json.Unmarshal(body, &u.UserCannotBeManagerOfCompanyManagedGroup) + + if err != nil { + return err + } + } + return nil +} + +// GroupMembersChangeResult : Result returned by `groupsMembersAdd` and +// `groupsMembersRemove`. +type GroupMembersChangeResult struct { + // GroupInfo : The group info after member change operation has been + // performed. + GroupInfo *GroupFullInfo `json:"group_info"` + // AsyncJobId : An ID that can be used to obtain the status of + // granting/revoking group-owned resources. + AsyncJobId string `json:"async_job_id"` +} + +// NewGroupMembersChangeResult returns a new GroupMembersChangeResult instance +func NewGroupMembersChangeResult(GroupInfo *GroupFullInfo, AsyncJobId string) *GroupMembersChangeResult { + s := new(GroupMembersChangeResult) + s.GroupInfo = GroupInfo + s.AsyncJobId = AsyncJobId + return s +} + +// GroupMembersRemoveArg : has no documentation (yet) +type GroupMembersRemoveArg struct { + IncludeMembersArg + // Group : Group from which users will be removed. + Group *GroupSelector `json:"group"` + // Users : List of users to be removed from the group. + Users []*UserSelectorArg `json:"users"` +} + +// NewGroupMembersRemoveArg returns a new GroupMembersRemoveArg instance +func NewGroupMembersRemoveArg(Group *GroupSelector, Users []*UserSelectorArg) *GroupMembersRemoveArg { + s := new(GroupMembersRemoveArg) + s.Group = Group + s.Users = Users + s.ReturnMembers = true + return s +} + +// GroupMembersSelectorError : Error that can be raised when +// `GroupMembersSelector` is used, and the users are required to be members of +// the specified group. +type GroupMembersSelectorError struct { + dropbox.Tagged +} + +// Valid tag values for GroupMembersSelectorError +const ( + GroupMembersSelectorErrorMemberNotInGroup = "member_not_in_group" +) + +// GroupMembersRemoveError : has no documentation (yet) +type GroupMembersRemoveError struct { + dropbox.Tagged + // MembersNotInTeam : These members are not part of your team. + MembersNotInTeam []string `json:"members_not_in_team,omitempty"` + // UsersNotFound : These users were not found in Dropbox. + UsersNotFound []string `json:"users_not_found,omitempty"` +} + +// Valid tag values for GroupMembersRemoveError +const ( + GroupMembersRemoveErrorGroupNotInTeam = "group_not_in_team" + GroupMembersRemoveErrorMembersNotInTeam = "members_not_in_team" + GroupMembersRemoveErrorUsersNotFound = "users_not_found" +) + +// UnmarshalJSON deserializes into a GroupMembersRemoveError instance +func (u *GroupMembersRemoveError) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // MembersNotInTeam : These members are not part of your team. + MembersNotInTeam json.RawMessage `json:"members_not_in_team,omitempty"` + // UsersNotFound : These users were not found in Dropbox. + UsersNotFound json.RawMessage `json:"users_not_found,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 "members_not_in_team": + err = json.Unmarshal(body, &u.MembersNotInTeam) + + if err != nil { + return err + } + case "users_not_found": + err = json.Unmarshal(body, &u.UsersNotFound) + + if err != nil { + return err + } + } + return nil +} + +// GroupMembersSelector : Argument for selecting a group and a list of users. +type GroupMembersSelector struct { + // Group : Specify a group. + Group *GroupSelector `json:"group"` + // Users : A list of users that are members of `group`. + Users *UsersSelectorArg `json:"users"` +} + +// NewGroupMembersSelector returns a new GroupMembersSelector instance +func NewGroupMembersSelector(Group *GroupSelector, Users *UsersSelectorArg) *GroupMembersSelector { + s := new(GroupMembersSelector) + s.Group = Group + s.Users = Users + return s +} + +// GroupMembersSetAccessTypeArg : has no documentation (yet) +type GroupMembersSetAccessTypeArg struct { + GroupMemberSelector + // AccessType : New group access type the user will have. + AccessType *GroupAccessType `json:"access_type"` + // ReturnMembers : Whether to return the list of members in the group. Note + // that the default value will cause all the group members to be returned + // in the response. This may take a long time for large groups. + ReturnMembers bool `json:"return_members"` +} + +// NewGroupMembersSetAccessTypeArg returns a new GroupMembersSetAccessTypeArg instance +func NewGroupMembersSetAccessTypeArg(Group *GroupSelector, User *UserSelectorArg, AccessType *GroupAccessType) *GroupMembersSetAccessTypeArg { + s := new(GroupMembersSetAccessTypeArg) + s.Group = Group + s.User = User + s.AccessType = AccessType + s.ReturnMembers = true + return s +} + +// GroupSelector : Argument for selecting a single group, either by group_id or +// by external group ID. +type GroupSelector struct { + dropbox.Tagged + // GroupId : Group ID. + GroupId string `json:"group_id,omitempty"` + // GroupExternalId : External ID of the group. + GroupExternalId string `json:"group_external_id,omitempty"` +} + +// Valid tag values for GroupSelector +const ( + GroupSelectorGroupId = "group_id" + GroupSelectorGroupExternalId = "group_external_id" +) + +// UnmarshalJSON deserializes into a GroupSelector instance +func (u *GroupSelector) 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 "group_id": + err = json.Unmarshal(body, &u.GroupId) + + if err != nil { + return err + } + case "group_external_id": + err = json.Unmarshal(body, &u.GroupExternalId) + + if err != nil { + return err + } + } + return nil +} + +// GroupUpdateArgs : has no documentation (yet) +type GroupUpdateArgs struct { + IncludeMembersArg + // Group : Specify a group. + Group *GroupSelector `json:"group"` + // NewGroupName : Optional argument. Set group name to this if provided. + NewGroupName string `json:"new_group_name,omitempty"` + // NewGroupExternalId : Optional argument. New group external ID. If the + // argument is None, the group's external_id won't be updated. If the + // argument is empty string, the group's external id will be cleared. + NewGroupExternalId string `json:"new_group_external_id,omitempty"` + // NewGroupManagementType : Set new group management type, if provided. + NewGroupManagementType *team_common.GroupManagementType `json:"new_group_management_type,omitempty"` +} + +// NewGroupUpdateArgs returns a new GroupUpdateArgs instance +func NewGroupUpdateArgs(Group *GroupSelector) *GroupUpdateArgs { + s := new(GroupUpdateArgs) + s.Group = Group + s.ReturnMembers = true + return s +} + +// GroupUpdateError : has no documentation (yet) +type GroupUpdateError struct { + dropbox.Tagged +} + +// Valid tag values for GroupUpdateError +const ( + GroupUpdateErrorGroupNameAlreadyUsed = "group_name_already_used" + GroupUpdateErrorGroupNameInvalid = "group_name_invalid" + GroupUpdateErrorExternalIdAlreadyInUse = "external_id_already_in_use" +) + +// GroupsGetInfoError : has no documentation (yet) +type GroupsGetInfoError struct { + dropbox.Tagged +} + +// Valid tag values for GroupsGetInfoError +const ( + GroupsGetInfoErrorGroupNotOnTeam = "group_not_on_team" + GroupsGetInfoErrorOther = "other" +) + +// GroupsGetInfoItem : has no documentation (yet) +type GroupsGetInfoItem struct { + dropbox.Tagged + // IdNotFound : An ID that was provided as a parameter to `groupsGetInfo`, + // and did not match a corresponding group. The ID can be a group ID, or an + // external ID, depending on how the method was called. + IdNotFound string `json:"id_not_found,omitempty"` + // GroupInfo : Info about a group. + GroupInfo *GroupFullInfo `json:"group_info,omitempty"` +} + +// Valid tag values for GroupsGetInfoItem +const ( + GroupsGetInfoItemIdNotFound = "id_not_found" + GroupsGetInfoItemGroupInfo = "group_info" +) + +// UnmarshalJSON deserializes into a GroupsGetInfoItem instance +func (u *GroupsGetInfoItem) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // GroupInfo : Info about a group. + GroupInfo json.RawMessage `json:"group_info,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 "id_not_found": + err = json.Unmarshal(body, &u.IdNotFound) + + if err != nil { + return err + } + case "group_info": + err = json.Unmarshal(body, &u.GroupInfo) + + if err != nil { + return err + } + } + return nil +} + +// GroupsListArg : has no documentation (yet) +type GroupsListArg struct { + // Limit : Number of results to return per call. + Limit uint32 `json:"limit"` +} + +// NewGroupsListArg returns a new GroupsListArg instance +func NewGroupsListArg() *GroupsListArg { + s := new(GroupsListArg) + s.Limit = 1000 + return s +} + +// GroupsListContinueArg : has no documentation (yet) +type GroupsListContinueArg struct { + // Cursor : Indicates from what point to get the next set of groups. + Cursor string `json:"cursor"` +} + +// NewGroupsListContinueArg returns a new GroupsListContinueArg instance +func NewGroupsListContinueArg(Cursor string) *GroupsListContinueArg { + s := new(GroupsListContinueArg) + s.Cursor = Cursor + return s +} + +// GroupsListContinueError : has no documentation (yet) +type GroupsListContinueError struct { + dropbox.Tagged +} + +// Valid tag values for GroupsListContinueError +const ( + GroupsListContinueErrorInvalidCursor = "invalid_cursor" + GroupsListContinueErrorOther = "other" +) + +// GroupsListResult : has no documentation (yet) +type GroupsListResult struct { + // Groups : has no documentation (yet) + Groups []*team_common.GroupSummary `json:"groups"` + // Cursor : Pass the cursor into `groupsListContinue` to obtain the + // additional groups. + Cursor string `json:"cursor"` + // HasMore : Is true if there are additional groups that have not been + // returned yet. An additional call to `groupsListContinue` can retrieve + // them. + HasMore bool `json:"has_more"` +} + +// NewGroupsListResult returns a new GroupsListResult instance +func NewGroupsListResult(Groups []*team_common.GroupSummary, Cursor string, HasMore bool) *GroupsListResult { + s := new(GroupsListResult) + s.Groups = Groups + s.Cursor = Cursor + s.HasMore = HasMore + return s +} + +// GroupsMembersListArg : has no documentation (yet) +type GroupsMembersListArg struct { + // Group : The group whose members are to be listed. + Group *GroupSelector `json:"group"` + // Limit : Number of results to return per call. + Limit uint32 `json:"limit"` +} + +// NewGroupsMembersListArg returns a new GroupsMembersListArg instance +func NewGroupsMembersListArg(Group *GroupSelector) *GroupsMembersListArg { + s := new(GroupsMembersListArg) + s.Group = Group + s.Limit = 1000 + return s +} + +// GroupsMembersListContinueArg : has no documentation (yet) +type GroupsMembersListContinueArg struct { + // Cursor : Indicates from what point to get the next set of groups. + Cursor string `json:"cursor"` +} + +// NewGroupsMembersListContinueArg returns a new GroupsMembersListContinueArg instance +func NewGroupsMembersListContinueArg(Cursor string) *GroupsMembersListContinueArg { + s := new(GroupsMembersListContinueArg) + s.Cursor = Cursor + return s +} + +// GroupsMembersListContinueError : has no documentation (yet) +type GroupsMembersListContinueError struct { + dropbox.Tagged +} + +// Valid tag values for GroupsMembersListContinueError +const ( + GroupsMembersListContinueErrorInvalidCursor = "invalid_cursor" + GroupsMembersListContinueErrorOther = "other" +) + +// GroupsMembersListResult : has no documentation (yet) +type GroupsMembersListResult struct { + // Members : has no documentation (yet) + Members []*GroupMemberInfo `json:"members"` + // Cursor : Pass the cursor into `groupsMembersListContinue` to obtain + // additional group members. + Cursor string `json:"cursor"` + // HasMore : Is true if there are additional group members that have not + // been returned yet. An additional call to `groupsMembersListContinue` can + // retrieve them. + HasMore bool `json:"has_more"` +} + +// NewGroupsMembersListResult returns a new GroupsMembersListResult instance +func NewGroupsMembersListResult(Members []*GroupMemberInfo, Cursor string, HasMore bool) *GroupsMembersListResult { + s := new(GroupsMembersListResult) + s.Members = Members + s.Cursor = Cursor + s.HasMore = HasMore + return s +} + +// GroupsPollError : has no documentation (yet) +type GroupsPollError struct { + dropbox.Tagged +} + +// Valid tag values for GroupsPollError +const ( + GroupsPollErrorAccessDenied = "access_denied" +) + +// GroupsSelector : Argument for selecting a list of groups, either by +// group_ids, or external group IDs. +type GroupsSelector struct { + dropbox.Tagged + // GroupIds : List of group IDs. + GroupIds []string `json:"group_ids,omitempty"` + // GroupExternalIds : List of external IDs of groups. + GroupExternalIds []string `json:"group_external_ids,omitempty"` +} + +// Valid tag values for GroupsSelector +const ( + GroupsSelectorGroupIds = "group_ids" + GroupsSelectorGroupExternalIds = "group_external_ids" +) + +// UnmarshalJSON deserializes into a GroupsSelector instance +func (u *GroupsSelector) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // GroupIds : List of group IDs. + GroupIds json.RawMessage `json:"group_ids,omitempty"` + // GroupExternalIds : List of external IDs of groups. + GroupExternalIds json.RawMessage `json:"group_external_ids,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 "group_ids": + err = json.Unmarshal(body, &u.GroupIds) + + if err != nil { + return err + } + case "group_external_ids": + err = json.Unmarshal(body, &u.GroupExternalIds) + + if err != nil { + return err + } + } + return nil +} + +// HasTeamSharedDropboxValue : The value for `Feature.has_team_shared_dropbox`. +type HasTeamSharedDropboxValue struct { + dropbox.Tagged + // HasTeamSharedDropbox : Does this team have a team shared dropbox. + HasTeamSharedDropbox bool `json:"has_team_shared_dropbox,omitempty"` +} + +// Valid tag values for HasTeamSharedDropboxValue +const ( + HasTeamSharedDropboxValueHasTeamSharedDropbox = "has_team_shared_dropbox" + HasTeamSharedDropboxValueOther = "other" +) + +// UnmarshalJSON deserializes into a HasTeamSharedDropboxValue instance +func (u *HasTeamSharedDropboxValue) 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 "has_team_shared_dropbox": + err = json.Unmarshal(body, &u.HasTeamSharedDropbox) + + if err != nil { + return err + } + } + return nil +} + +// ListMemberAppsArg : has no documentation (yet) +type ListMemberAppsArg struct { + // TeamMemberId : The team member id + TeamMemberId string `json:"team_member_id"` +} + +// NewListMemberAppsArg returns a new ListMemberAppsArg instance +func NewListMemberAppsArg(TeamMemberId string) *ListMemberAppsArg { + s := new(ListMemberAppsArg) + s.TeamMemberId = TeamMemberId + return s +} + +// ListMemberAppsError : Error returned by `linkedAppsListMemberLinkedApps`. +type ListMemberAppsError struct { + dropbox.Tagged +} + +// Valid tag values for ListMemberAppsError +const ( + ListMemberAppsErrorMemberNotFound = "member_not_found" + ListMemberAppsErrorOther = "other" +) + +// ListMemberAppsResult : has no documentation (yet) +type ListMemberAppsResult struct { + // LinkedApiApps : List of third party applications linked by this team + // member + LinkedApiApps []*ApiApp `json:"linked_api_apps"` +} + +// NewListMemberAppsResult returns a new ListMemberAppsResult instance +func NewListMemberAppsResult(LinkedApiApps []*ApiApp) *ListMemberAppsResult { + s := new(ListMemberAppsResult) + s.LinkedApiApps = LinkedApiApps + return s +} + +// ListMemberDevicesArg : has no documentation (yet) +type ListMemberDevicesArg struct { + // TeamMemberId : The team's member id + TeamMemberId string `json:"team_member_id"` + // IncludeWebSessions : Whether to list web sessions of the team's member + IncludeWebSessions bool `json:"include_web_sessions"` + // IncludeDesktopClients : Whether to list linked desktop devices of the + // team's member + IncludeDesktopClients bool `json:"include_desktop_clients"` + // IncludeMobileClients : Whether to list linked mobile devices of the + // team's member + IncludeMobileClients bool `json:"include_mobile_clients"` +} + +// NewListMemberDevicesArg returns a new ListMemberDevicesArg instance +func NewListMemberDevicesArg(TeamMemberId string) *ListMemberDevicesArg { + s := new(ListMemberDevicesArg) + s.TeamMemberId = TeamMemberId + s.IncludeWebSessions = true + s.IncludeDesktopClients = true + s.IncludeMobileClients = true + return s +} + +// ListMemberDevicesError : has no documentation (yet) +type ListMemberDevicesError struct { + dropbox.Tagged +} + +// Valid tag values for ListMemberDevicesError +const ( + ListMemberDevicesErrorMemberNotFound = "member_not_found" + ListMemberDevicesErrorOther = "other" +) + +// ListMemberDevicesResult : has no documentation (yet) +type ListMemberDevicesResult struct { + // ActiveWebSessions : List of web sessions made by this team member + ActiveWebSessions []*ActiveWebSession `json:"active_web_sessions,omitempty"` + // DesktopClientSessions : List of desktop clients used by this team member + DesktopClientSessions []*DesktopClientSession `json:"desktop_client_sessions,omitempty"` + // MobileClientSessions : List of mobile client used by this team member + MobileClientSessions []*MobileClientSession `json:"mobile_client_sessions,omitempty"` +} + +// NewListMemberDevicesResult returns a new ListMemberDevicesResult instance +func NewListMemberDevicesResult() *ListMemberDevicesResult { + s := new(ListMemberDevicesResult) + return s +} + +// ListMembersAppsArg : Arguments for `linkedAppsListMembersLinkedApps`. +type ListMembersAppsArg struct { + // Cursor : At the first call to the `linkedAppsListMembersLinkedApps` the + // cursor shouldn't be passed. Then, if the result of the call includes a + // cursor, the following requests should include the received cursors in + // order to receive the next sub list of the team applications + Cursor string `json:"cursor,omitempty"` +} + +// NewListMembersAppsArg returns a new ListMembersAppsArg instance +func NewListMembersAppsArg() *ListMembersAppsArg { + s := new(ListMembersAppsArg) + return s +} + +// ListMembersAppsError : Error returned by `linkedAppsListMembersLinkedApps` +type ListMembersAppsError struct { + dropbox.Tagged +} + +// Valid tag values for ListMembersAppsError +const ( + ListMembersAppsErrorReset = "reset" + ListMembersAppsErrorOther = "other" +) + +// ListMembersAppsResult : Information returned by +// `linkedAppsListMembersLinkedApps`. +type ListMembersAppsResult struct { + // Apps : The linked applications of each member of the team + Apps []*MemberLinkedApps `json:"apps"` + // HasMore : If true, then there are more apps available. Pass the cursor to + // `linkedAppsListMembersLinkedApps` to retrieve the rest. + HasMore bool `json:"has_more"` + // Cursor : Pass the cursor into `linkedAppsListMembersLinkedApps` to + // receive the next sub list of team's applications. + Cursor string `json:"cursor,omitempty"` +} + +// NewListMembersAppsResult returns a new ListMembersAppsResult instance +func NewListMembersAppsResult(Apps []*MemberLinkedApps, HasMore bool) *ListMembersAppsResult { + s := new(ListMembersAppsResult) + s.Apps = Apps + s.HasMore = HasMore + return s +} + +// ListMembersDevicesArg : has no documentation (yet) +type ListMembersDevicesArg struct { + // Cursor : At the first call to the `devicesListMembersDevices` the cursor + // shouldn't be passed. Then, if the result of the call includes a cursor, + // the following requests should include the received cursors in order to + // receive the next sub list of team devices + Cursor string `json:"cursor,omitempty"` + // IncludeWebSessions : Whether to list web sessions of the team members + IncludeWebSessions bool `json:"include_web_sessions"` + // IncludeDesktopClients : Whether to list desktop clients of the team + // members + IncludeDesktopClients bool `json:"include_desktop_clients"` + // IncludeMobileClients : Whether to list mobile clients of the team members + IncludeMobileClients bool `json:"include_mobile_clients"` +} + +// NewListMembersDevicesArg returns a new ListMembersDevicesArg instance +func NewListMembersDevicesArg() *ListMembersDevicesArg { + s := new(ListMembersDevicesArg) + s.IncludeWebSessions = true + s.IncludeDesktopClients = true + s.IncludeMobileClients = true + return s +} + +// ListMembersDevicesError : has no documentation (yet) +type ListMembersDevicesError struct { + dropbox.Tagged +} + +// Valid tag values for ListMembersDevicesError +const ( + ListMembersDevicesErrorReset = "reset" + ListMembersDevicesErrorOther = "other" +) + +// ListMembersDevicesResult : has no documentation (yet) +type ListMembersDevicesResult struct { + // Devices : The devices of each member of the team + Devices []*MemberDevices `json:"devices"` + // HasMore : If true, then there are more devices available. Pass the cursor + // to `devicesListMembersDevices` to retrieve the rest. + HasMore bool `json:"has_more"` + // Cursor : Pass the cursor into `devicesListMembersDevices` to receive the + // next sub list of team's devices. + Cursor string `json:"cursor,omitempty"` +} + +// NewListMembersDevicesResult returns a new ListMembersDevicesResult instance +func NewListMembersDevicesResult(Devices []*MemberDevices, HasMore bool) *ListMembersDevicesResult { + s := new(ListMembersDevicesResult) + s.Devices = Devices + s.HasMore = HasMore + return s +} + +// ListTeamAppsArg : Arguments for `linkedAppsListTeamLinkedApps`. +type ListTeamAppsArg struct { + // Cursor : At the first call to the `linkedAppsListTeamLinkedApps` the + // cursor shouldn't be passed. Then, if the result of the call includes a + // cursor, the following requests should include the received cursors in + // order to receive the next sub list of the team applications + Cursor string `json:"cursor,omitempty"` +} + +// NewListTeamAppsArg returns a new ListTeamAppsArg instance +func NewListTeamAppsArg() *ListTeamAppsArg { + s := new(ListTeamAppsArg) + return s +} + +// ListTeamAppsError : Error returned by `linkedAppsListTeamLinkedApps` +type ListTeamAppsError struct { + dropbox.Tagged +} + +// Valid tag values for ListTeamAppsError +const ( + ListTeamAppsErrorReset = "reset" + ListTeamAppsErrorOther = "other" +) + +// ListTeamAppsResult : Information returned by `linkedAppsListTeamLinkedApps`. +type ListTeamAppsResult struct { + // Apps : The linked applications of each member of the team + Apps []*MemberLinkedApps `json:"apps"` + // HasMore : If true, then there are more apps available. Pass the cursor to + // `linkedAppsListTeamLinkedApps` to retrieve the rest. + HasMore bool `json:"has_more"` + // Cursor : Pass the cursor into `linkedAppsListTeamLinkedApps` to receive + // the next sub list of team's applications. + Cursor string `json:"cursor,omitempty"` +} + +// NewListTeamAppsResult returns a new ListTeamAppsResult instance +func NewListTeamAppsResult(Apps []*MemberLinkedApps, HasMore bool) *ListTeamAppsResult { + s := new(ListTeamAppsResult) + s.Apps = Apps + s.HasMore = HasMore + return s +} + +// ListTeamDevicesArg : has no documentation (yet) +type ListTeamDevicesArg struct { + // Cursor : At the first call to the `devicesListTeamDevices` the cursor + // shouldn't be passed. Then, if the result of the call includes a cursor, + // the following requests should include the received cursors in order to + // receive the next sub list of team devices + Cursor string `json:"cursor,omitempty"` + // IncludeWebSessions : Whether to list web sessions of the team members + IncludeWebSessions bool `json:"include_web_sessions"` + // IncludeDesktopClients : Whether to list desktop clients of the team + // members + IncludeDesktopClients bool `json:"include_desktop_clients"` + // IncludeMobileClients : Whether to list mobile clients of the team members + IncludeMobileClients bool `json:"include_mobile_clients"` +} + +// NewListTeamDevicesArg returns a new ListTeamDevicesArg instance +func NewListTeamDevicesArg() *ListTeamDevicesArg { + s := new(ListTeamDevicesArg) + s.IncludeWebSessions = true + s.IncludeDesktopClients = true + s.IncludeMobileClients = true + return s +} + +// ListTeamDevicesError : has no documentation (yet) +type ListTeamDevicesError struct { + dropbox.Tagged +} + +// Valid tag values for ListTeamDevicesError +const ( + ListTeamDevicesErrorReset = "reset" + ListTeamDevicesErrorOther = "other" +) + +// ListTeamDevicesResult : has no documentation (yet) +type ListTeamDevicesResult struct { + // Devices : The devices of each member of the team + Devices []*MemberDevices `json:"devices"` + // HasMore : If true, then there are more devices available. Pass the cursor + // to `devicesListTeamDevices` to retrieve the rest. + HasMore bool `json:"has_more"` + // Cursor : Pass the cursor into `devicesListTeamDevices` to receive the + // next sub list of team's devices. + Cursor string `json:"cursor,omitempty"` +} + +// NewListTeamDevicesResult returns a new ListTeamDevicesResult instance +func NewListTeamDevicesResult(Devices []*MemberDevices, HasMore bool) *ListTeamDevicesResult { + s := new(ListTeamDevicesResult) + s.Devices = Devices + s.HasMore = HasMore + return s +} + +// MemberAccess : Specify access type a member should have when joined to a +// group. +type MemberAccess struct { + // User : Identity of a user. + User *UserSelectorArg `json:"user"` + // AccessType : Access type. + AccessType *GroupAccessType `json:"access_type"` +} + +// NewMemberAccess returns a new MemberAccess instance +func NewMemberAccess(User *UserSelectorArg, AccessType *GroupAccessType) *MemberAccess { + s := new(MemberAccess) + s.User = User + s.AccessType = AccessType + return s +} + +// MemberAddArg : has no documentation (yet) +type MemberAddArg struct { + // MemberEmail : has no documentation (yet) + MemberEmail string `json:"member_email"` + // MemberGivenName : Member's first name. + MemberGivenName string `json:"member_given_name,omitempty"` + // MemberSurname : Member's last name. + MemberSurname string `json:"member_surname,omitempty"` + // MemberExternalId : External ID for member. + MemberExternalId string `json:"member_external_id,omitempty"` + // MemberPersistentId : Persistent ID for member. This field is only + // available to teams using persistent ID SAML configuration. + MemberPersistentId string `json:"member_persistent_id,omitempty"` + // SendWelcomeEmail : Whether to send a welcome email to the member. If + // send_welcome_email is false, no email invitation will be sent to the + // user. This may be useful for apps using single sign-on (SSO) flows for + // onboarding that want to handle announcements themselves. + SendWelcomeEmail bool `json:"send_welcome_email"` + // Role : has no documentation (yet) + Role *AdminTier `json:"role"` +} + +// NewMemberAddArg returns a new MemberAddArg instance +func NewMemberAddArg(MemberEmail string) *MemberAddArg { + s := new(MemberAddArg) + s.MemberEmail = MemberEmail + s.SendWelcomeEmail = true + s.Role = &AdminTier{Tagged: dropbox.Tagged{"member_only"}} + return s +} + +// MemberAddResult : Describes the result of attempting to add a single user to +// the team. 'success' is the only value indicating that a user was indeed added +// to the team - the other values explain the type of failure that occurred, and +// include the email of the user for which the operation has failed. +type MemberAddResult struct { + dropbox.Tagged + // Success : Describes a user that was successfully added to the team. + Success *TeamMemberInfo `json:"success,omitempty"` + // TeamLicenseLimit : Team is already full. The organization has no + // available licenses. + TeamLicenseLimit string `json:"team_license_limit,omitempty"` + // FreeTeamMemberLimitReached : Team is already full. The free team member + // limit has been reached. + FreeTeamMemberLimitReached string `json:"free_team_member_limit_reached,omitempty"` + // UserAlreadyOnTeam : User is already on this team. The provided email + // address is associated with a user who is already a member of (including + // in recoverable state) or invited to the team. + UserAlreadyOnTeam string `json:"user_already_on_team,omitempty"` + // UserOnAnotherTeam : User is already on another team. The provided email + // address is associated with a user that is already a member or invited to + // another team. + UserOnAnotherTeam string `json:"user_on_another_team,omitempty"` + // UserAlreadyPaired : User is already paired. + UserAlreadyPaired string `json:"user_already_paired,omitempty"` + // UserMigrationFailed : User migration has failed. + UserMigrationFailed string `json:"user_migration_failed,omitempty"` + // DuplicateExternalMemberId : A user with the given external member ID + // already exists on the team (including in recoverable state). + DuplicateExternalMemberId string `json:"duplicate_external_member_id,omitempty"` + // DuplicateMemberPersistentId : A user with the given persistent ID already + // exists on the team (including in recoverable state). + DuplicateMemberPersistentId string `json:"duplicate_member_persistent_id,omitempty"` + // PersistentIdDisabled : Persistent ID is only available to teams with + // persistent ID SAML configuration. Please contact Dropbox for more + // information. + PersistentIdDisabled string `json:"persistent_id_disabled,omitempty"` + // UserCreationFailed : User creation has failed. + UserCreationFailed string `json:"user_creation_failed,omitempty"` +} + +// Valid tag values for MemberAddResult +const ( + MemberAddResultSuccess = "success" + MemberAddResultTeamLicenseLimit = "team_license_limit" + MemberAddResultFreeTeamMemberLimitReached = "free_team_member_limit_reached" + MemberAddResultUserAlreadyOnTeam = "user_already_on_team" + MemberAddResultUserOnAnotherTeam = "user_on_another_team" + MemberAddResultUserAlreadyPaired = "user_already_paired" + MemberAddResultUserMigrationFailed = "user_migration_failed" + MemberAddResultDuplicateExternalMemberId = "duplicate_external_member_id" + MemberAddResultDuplicateMemberPersistentId = "duplicate_member_persistent_id" + MemberAddResultPersistentIdDisabled = "persistent_id_disabled" + MemberAddResultUserCreationFailed = "user_creation_failed" +) + +// UnmarshalJSON deserializes into a MemberAddResult instance +func (u *MemberAddResult) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Success : Describes a user that was successfully added to the team. + Success json.RawMessage `json:"success,omitempty"` + } + var w wrap + var err error + if err = json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "success": + err = json.Unmarshal(body, &u.Success) + + if err != nil { + return err + } + case "team_license_limit": + err = json.Unmarshal(body, &u.TeamLicenseLimit) + + if err != nil { + return err + } + case "free_team_member_limit_reached": + err = json.Unmarshal(body, &u.FreeTeamMemberLimitReached) + + if err != nil { + return err + } + case "user_already_on_team": + err = json.Unmarshal(body, &u.UserAlreadyOnTeam) + + if err != nil { + return err + } + case "user_on_another_team": + err = json.Unmarshal(body, &u.UserOnAnotherTeam) + + if err != nil { + return err + } + case "user_already_paired": + err = json.Unmarshal(body, &u.UserAlreadyPaired) + + if err != nil { + return err + } + case "user_migration_failed": + err = json.Unmarshal(body, &u.UserMigrationFailed) + + if err != nil { + return err + } + case "duplicate_external_member_id": + err = json.Unmarshal(body, &u.DuplicateExternalMemberId) + + if err != nil { + return err + } + case "duplicate_member_persistent_id": + err = json.Unmarshal(body, &u.DuplicateMemberPersistentId) + + if err != nil { + return err + } + case "persistent_id_disabled": + err = json.Unmarshal(body, &u.PersistentIdDisabled) + + if err != nil { + return err + } + case "user_creation_failed": + err = json.Unmarshal(body, &u.UserCreationFailed) + + if err != nil { + return err + } + } + return nil +} + +// MemberDevices : Information on devices of a team's member. +type MemberDevices struct { + // TeamMemberId : The member unique Id + TeamMemberId string `json:"team_member_id"` + // WebSessions : List of web sessions made by this team member + WebSessions []*ActiveWebSession `json:"web_sessions,omitempty"` + // DesktopClients : List of desktop clients by this team member + DesktopClients []*DesktopClientSession `json:"desktop_clients,omitempty"` + // MobileClients : List of mobile clients by this team member + MobileClients []*MobileClientSession `json:"mobile_clients,omitempty"` +} + +// NewMemberDevices returns a new MemberDevices instance +func NewMemberDevices(TeamMemberId string) *MemberDevices { + s := new(MemberDevices) + s.TeamMemberId = TeamMemberId + return s +} + +// MemberLinkedApps : Information on linked applications of a team member. +type MemberLinkedApps struct { + // TeamMemberId : The member unique Id + TeamMemberId string `json:"team_member_id"` + // LinkedApiApps : List of third party applications linked by this team + // member + LinkedApiApps []*ApiApp `json:"linked_api_apps"` +} + +// NewMemberLinkedApps returns a new MemberLinkedApps instance +func NewMemberLinkedApps(TeamMemberId string, LinkedApiApps []*ApiApp) *MemberLinkedApps { + s := new(MemberLinkedApps) + s.TeamMemberId = TeamMemberId + s.LinkedApiApps = LinkedApiApps + return s +} + +// MemberProfile : Basic member profile. +type MemberProfile struct { + // TeamMemberId : ID of user as a member of a team. + TeamMemberId string `json:"team_member_id"` + // ExternalId : External ID that a team can attach to the user. An + // application using the API may find it easier to use their own IDs instead + // of Dropbox IDs like account_id or team_member_id. + ExternalId string `json:"external_id,omitempty"` + // AccountId : A user's account identifier. + AccountId string `json:"account_id,omitempty"` + // Email : Email address of user. + Email string `json:"email"` + // EmailVerified : Is true if the user's email is verified to be owned by + // the user. + EmailVerified bool `json:"email_verified"` + // Status : The user's status as a member of a specific team. + Status *TeamMemberStatus `json:"status"` + // Name : Representations for a person's name. + Name *users.Name `json:"name"` + // MembershipType : The user's membership type: full (normal team member) vs + // limited (does not use a license; no access to the team's shared quota). + MembershipType *TeamMembershipType `json:"membership_type"` + // JoinedOn : The date and time the user joined as a member of a specific + // team. + JoinedOn time.Time `json:"joined_on,omitempty"` + // PersistentId : Persistent ID that a team can attach to the user. The + // persistent ID is unique ID to be used for SAML authentication. + PersistentId string `json:"persistent_id,omitempty"` +} + +// NewMemberProfile returns a new MemberProfile instance +func NewMemberProfile(TeamMemberId string, Email string, EmailVerified bool, Status *TeamMemberStatus, Name *users.Name, MembershipType *TeamMembershipType) *MemberProfile { + s := new(MemberProfile) + s.TeamMemberId = TeamMemberId + s.Email = Email + s.EmailVerified = EmailVerified + s.Status = Status + s.Name = Name + s.MembershipType = MembershipType + return s +} + +// UserSelectorError : Error that can be returned whenever a struct derived from +// `UserSelectorArg` is used. +type UserSelectorError struct { + dropbox.Tagged +} + +// Valid tag values for UserSelectorError +const ( + UserSelectorErrorUserNotFound = "user_not_found" +) + +// MemberSelectorError : has no documentation (yet) +type MemberSelectorError struct { + dropbox.Tagged +} + +// Valid tag values for MemberSelectorError +const ( + MemberSelectorErrorUserNotInTeam = "user_not_in_team" +) + +// MembersAddArg : has no documentation (yet) +type MembersAddArg struct { + // NewMembers : Details of new members to be added to the team. + NewMembers []*MemberAddArg `json:"new_members"` + // ForceAsync : Whether to force the add to happen asynchronously. + ForceAsync bool `json:"force_async"` +} + +// NewMembersAddArg returns a new MembersAddArg instance +func NewMembersAddArg(NewMembers []*MemberAddArg) *MembersAddArg { + s := new(MembersAddArg) + s.NewMembers = NewMembers + s.ForceAsync = false + return s +} + +// MembersAddJobStatus : has no documentation (yet) +type MembersAddJobStatus struct { + dropbox.Tagged + // Complete : The asynchronous job has finished. For each member that was + // specified in the parameter `MembersAddArg` that was provided to + // `membersAdd`, a corresponding item is returned in this list. + Complete []*MemberAddResult `json:"complete,omitempty"` + // Failed : The asynchronous job returned an error. The string contains an + // error message. + Failed string `json:"failed,omitempty"` +} + +// Valid tag values for MembersAddJobStatus +const ( + MembersAddJobStatusComplete = "complete" + MembersAddJobStatusFailed = "failed" +) + +// UnmarshalJSON deserializes into a MembersAddJobStatus instance +func (u *MembersAddJobStatus) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Complete : The asynchronous job has finished. For each member that + // was specified in the parameter `MembersAddArg` that was provided to + // `membersAdd`, a corresponding item is returned in this list. + Complete json.RawMessage `json:"complete,omitempty"` + } + var w wrap + var err error + if err = json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "complete": + err = json.Unmarshal(body, &u.Complete) + + if err != nil { + return err + } + case "failed": + err = json.Unmarshal(body, &u.Failed) + + if err != nil { + return err + } + } + return nil +} + +// MembersAddLaunch : has no documentation (yet) +type MembersAddLaunch struct { + dropbox.Tagged + // Complete : has no documentation (yet) + Complete []*MemberAddResult `json:"complete,omitempty"` +} + +// Valid tag values for MembersAddLaunch +const ( + MembersAddLaunchComplete = "complete" +) + +// UnmarshalJSON deserializes into a MembersAddLaunch instance +func (u *MembersAddLaunch) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Complete : has no documentation (yet) + Complete json.RawMessage `json:"complete,omitempty"` + } + var w wrap + var err error + if err = json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "complete": + err = json.Unmarshal(body, &u.Complete) + + if err != nil { + return err + } + } + return nil +} + +// MembersDeactivateArg : Exactly one of team_member_id, email, or external_id +// must be provided to identify the user account. +type MembersDeactivateArg struct { + // User : Identity of user to remove/suspend. + User *UserSelectorArg `json:"user"` + // WipeData : If provided, controls if the user's data will be deleted on + // their linked devices. + WipeData bool `json:"wipe_data"` +} + +// NewMembersDeactivateArg returns a new MembersDeactivateArg instance +func NewMembersDeactivateArg(User *UserSelectorArg) *MembersDeactivateArg { + s := new(MembersDeactivateArg) + s.User = User + s.WipeData = true + return s +} + +// MembersDeactivateError : has no documentation (yet) +type MembersDeactivateError struct { + dropbox.Tagged +} + +// Valid tag values for MembersDeactivateError +const ( + MembersDeactivateErrorUserNotInTeam = "user_not_in_team" + MembersDeactivateErrorOther = "other" +) + +// MembersGetInfoArgs : has no documentation (yet) +type MembersGetInfoArgs struct { + // Members : List of team members. + Members []*UserSelectorArg `json:"members"` +} + +// NewMembersGetInfoArgs returns a new MembersGetInfoArgs instance +func NewMembersGetInfoArgs(Members []*UserSelectorArg) *MembersGetInfoArgs { + s := new(MembersGetInfoArgs) + s.Members = Members + return s +} + +// MembersGetInfoError : +type MembersGetInfoError struct { + dropbox.Tagged +} + +// Valid tag values for MembersGetInfoError +const ( + MembersGetInfoErrorOther = "other" +) + +// MembersGetInfoItem : Describes a result obtained for a single user whose id +// was specified in the parameter of `membersGetInfo`. +type MembersGetInfoItem struct { + dropbox.Tagged + // IdNotFound : An ID that was provided as a parameter to `membersGetInfo`, + // and did not match a corresponding user. This might be a team_member_id, + // an email, or an external ID, depending on how the method was called. + IdNotFound string `json:"id_not_found,omitempty"` + // MemberInfo : Info about a team member. + MemberInfo *TeamMemberInfo `json:"member_info,omitempty"` +} + +// Valid tag values for MembersGetInfoItem +const ( + MembersGetInfoItemIdNotFound = "id_not_found" + MembersGetInfoItemMemberInfo = "member_info" +) + +// UnmarshalJSON deserializes into a MembersGetInfoItem instance +func (u *MembersGetInfoItem) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // MemberInfo : Info about a team member. + MemberInfo json.RawMessage `json:"member_info,omitempty"` + } + var w wrap + var err error + if err = json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "id_not_found": + err = json.Unmarshal(body, &u.IdNotFound) + + if err != nil { + return err + } + case "member_info": + err = json.Unmarshal(body, &u.MemberInfo) + + if err != nil { + return err + } + } + return nil +} + +// MembersListArg : has no documentation (yet) +type MembersListArg struct { + // Limit : Number of results to return per call. + Limit uint32 `json:"limit"` + // IncludeRemoved : Whether to return removed members. + IncludeRemoved bool `json:"include_removed"` +} + +// NewMembersListArg returns a new MembersListArg instance +func NewMembersListArg() *MembersListArg { + s := new(MembersListArg) + s.Limit = 1000 + s.IncludeRemoved = false + return s +} + +// MembersListContinueArg : has no documentation (yet) +type MembersListContinueArg struct { + // Cursor : Indicates from what point to get the next set of members. + Cursor string `json:"cursor"` +} + +// NewMembersListContinueArg returns a new MembersListContinueArg instance +func NewMembersListContinueArg(Cursor string) *MembersListContinueArg { + s := new(MembersListContinueArg) + s.Cursor = Cursor + return s +} + +// MembersListContinueError : has no documentation (yet) +type MembersListContinueError struct { + dropbox.Tagged +} + +// Valid tag values for MembersListContinueError +const ( + MembersListContinueErrorInvalidCursor = "invalid_cursor" + MembersListContinueErrorOther = "other" +) + +// MembersListError : +type MembersListError struct { + dropbox.Tagged +} + +// Valid tag values for MembersListError +const ( + MembersListErrorOther = "other" +) + +// MembersListResult : has no documentation (yet) +type MembersListResult struct { + // Members : List of team members. + Members []*TeamMemberInfo `json:"members"` + // Cursor : Pass the cursor into `membersListContinue` to obtain the + // additional members. + Cursor string `json:"cursor"` + // HasMore : Is true if there are additional team members that have not been + // returned yet. An additional call to `membersListContinue` can retrieve + // them. + HasMore bool `json:"has_more"` +} + +// NewMembersListResult returns a new MembersListResult instance +func NewMembersListResult(Members []*TeamMemberInfo, Cursor string, HasMore bool) *MembersListResult { + s := new(MembersListResult) + s.Members = Members + s.Cursor = Cursor + s.HasMore = HasMore + return s +} + +// MembersRecoverArg : Exactly one of team_member_id, email, or external_id must +// be provided to identify the user account. +type MembersRecoverArg struct { + // User : Identity of user to recover. + User *UserSelectorArg `json:"user"` +} + +// NewMembersRecoverArg returns a new MembersRecoverArg instance +func NewMembersRecoverArg(User *UserSelectorArg) *MembersRecoverArg { + s := new(MembersRecoverArg) + s.User = User + return s +} + +// MembersRecoverError : has no documentation (yet) +type MembersRecoverError struct { + dropbox.Tagged +} + +// Valid tag values for MembersRecoverError +const ( + MembersRecoverErrorUserUnrecoverable = "user_unrecoverable" + MembersRecoverErrorUserNotInTeam = "user_not_in_team" + MembersRecoverErrorTeamLicenseLimit = "team_license_limit" + MembersRecoverErrorOther = "other" +) + +// MembersRemoveArg : has no documentation (yet) +type MembersRemoveArg struct { + MembersDeactivateArg + // TransferDestId : If provided, files from the deleted member account will + // be transferred to this user. + TransferDestId *UserSelectorArg `json:"transfer_dest_id,omitempty"` + // TransferAdminId : If provided, errors during the transfer process will be + // sent via email to this user. If the transfer_dest_id argument was + // provided, then this argument must be provided as well. + TransferAdminId *UserSelectorArg `json:"transfer_admin_id,omitempty"` + // KeepAccount : Downgrade the member to a Basic account. The user will + // retain the email address associated with their Dropbox account and data + // in their account that is not restricted to team members. In order to keep + // the account the argument wipe_data should be set to False. + KeepAccount bool `json:"keep_account"` +} + +// NewMembersRemoveArg returns a new MembersRemoveArg instance +func NewMembersRemoveArg(User *UserSelectorArg) *MembersRemoveArg { + s := new(MembersRemoveArg) + s.User = User + s.WipeData = true + s.KeepAccount = false + return s +} + +// MembersRemoveError : has no documentation (yet) +type MembersRemoveError struct { + dropbox.Tagged +} + +// Valid tag values for MembersRemoveError +const ( + MembersRemoveErrorRemoveLastAdmin = "remove_last_admin" + MembersRemoveErrorRemovedAndTransferDestShouldDiffer = "removed_and_transfer_dest_should_differ" + MembersRemoveErrorRemovedAndTransferAdminShouldDiffer = "removed_and_transfer_admin_should_differ" + MembersRemoveErrorTransferDestUserNotFound = "transfer_dest_user_not_found" + MembersRemoveErrorTransferDestUserNotInTeam = "transfer_dest_user_not_in_team" + MembersRemoveErrorTransferAdminUserNotFound = "transfer_admin_user_not_found" + MembersRemoveErrorTransferAdminUserNotInTeam = "transfer_admin_user_not_in_team" + MembersRemoveErrorUnspecifiedTransferAdminId = "unspecified_transfer_admin_id" + MembersRemoveErrorTransferAdminIsNotAdmin = "transfer_admin_is_not_admin" + MembersRemoveErrorCannotKeepAccountAndTransfer = "cannot_keep_account_and_transfer" + MembersRemoveErrorCannotKeepAccountAndDeleteData = "cannot_keep_account_and_delete_data" + MembersRemoveErrorEmailAddressTooLongToBeDisabled = "email_address_too_long_to_be_disabled" +) + +// MembersSendWelcomeError : +type MembersSendWelcomeError struct { + dropbox.Tagged +} + +// Valid tag values for MembersSendWelcomeError +const ( + MembersSendWelcomeErrorOther = "other" +) + +// MembersSetPermissionsArg : Exactly one of team_member_id, email, or +// external_id must be provided to identify the user account. +type MembersSetPermissionsArg struct { + // User : Identity of user whose role will be set. + User *UserSelectorArg `json:"user"` + // NewRole : The new role of the member. + NewRole *AdminTier `json:"new_role"` +} + +// NewMembersSetPermissionsArg returns a new MembersSetPermissionsArg instance +func NewMembersSetPermissionsArg(User *UserSelectorArg, NewRole *AdminTier) *MembersSetPermissionsArg { + s := new(MembersSetPermissionsArg) + s.User = User + s.NewRole = NewRole + return s +} + +// MembersSetPermissionsError : has no documentation (yet) +type MembersSetPermissionsError struct { + dropbox.Tagged +} + +// Valid tag values for MembersSetPermissionsError +const ( + MembersSetPermissionsErrorLastAdmin = "last_admin" + MembersSetPermissionsErrorUserNotInTeam = "user_not_in_team" + MembersSetPermissionsErrorCannotSetPermissions = "cannot_set_permissions" + MembersSetPermissionsErrorTeamLicenseLimit = "team_license_limit" + MembersSetPermissionsErrorOther = "other" +) + +// MembersSetPermissionsResult : has no documentation (yet) +type MembersSetPermissionsResult struct { + // TeamMemberId : The member ID of the user to which the change was applied. + TeamMemberId string `json:"team_member_id"` + // Role : The role after the change. + Role *AdminTier `json:"role"` +} + +// NewMembersSetPermissionsResult returns a new MembersSetPermissionsResult instance +func NewMembersSetPermissionsResult(TeamMemberId string, Role *AdminTier) *MembersSetPermissionsResult { + s := new(MembersSetPermissionsResult) + s.TeamMemberId = TeamMemberId + s.Role = Role + return s +} + +// MembersSetProfileArg : Exactly one of team_member_id, email, or external_id +// must be provided to identify the user account. At least one of new_email, +// new_external_id, new_given_name, and/or new_surname must be provided. +type MembersSetProfileArg struct { + // User : Identity of user whose profile will be set. + User *UserSelectorArg `json:"user"` + // NewEmail : New email for member. + NewEmail string `json:"new_email,omitempty"` + // NewExternalId : New external ID for member. + NewExternalId string `json:"new_external_id,omitempty"` + // NewGivenName : New given name for member. + NewGivenName string `json:"new_given_name,omitempty"` + // NewSurname : New surname for member. + NewSurname string `json:"new_surname,omitempty"` + // NewPersistentId : New persistent ID. This field only available to teams + // using persistent ID SAML configuration. + NewPersistentId string `json:"new_persistent_id,omitempty"` +} + +// NewMembersSetProfileArg returns a new MembersSetProfileArg instance +func NewMembersSetProfileArg(User *UserSelectorArg) *MembersSetProfileArg { + s := new(MembersSetProfileArg) + s.User = User + return s +} + +// MembersSetProfileError : has no documentation (yet) +type MembersSetProfileError struct { + dropbox.Tagged +} + +// Valid tag values for MembersSetProfileError +const ( + MembersSetProfileErrorExternalIdAndNewExternalIdUnsafe = "external_id_and_new_external_id_unsafe" + MembersSetProfileErrorNoNewDataSpecified = "no_new_data_specified" + MembersSetProfileErrorEmailReservedForOtherUser = "email_reserved_for_other_user" + MembersSetProfileErrorExternalIdUsedByOtherUser = "external_id_used_by_other_user" + MembersSetProfileErrorSetProfileDisallowed = "set_profile_disallowed" + MembersSetProfileErrorParamCannotBeEmpty = "param_cannot_be_empty" + MembersSetProfileErrorPersistentIdDisabled = "persistent_id_disabled" + MembersSetProfileErrorPersistentIdUsedByOtherUser = "persistent_id_used_by_other_user" + MembersSetProfileErrorOther = "other" +) + +// MembersSuspendError : has no documentation (yet) +type MembersSuspendError struct { + dropbox.Tagged +} + +// Valid tag values for MembersSuspendError +const ( + MembersSuspendErrorSuspendInactiveUser = "suspend_inactive_user" + MembersSuspendErrorSuspendLastAdmin = "suspend_last_admin" + MembersSuspendErrorTeamLicenseLimit = "team_license_limit" +) + +// MembersUnsuspendArg : Exactly one of team_member_id, email, or external_id +// must be provided to identify the user account. +type MembersUnsuspendArg struct { + // User : Identity of user to unsuspend. + User *UserSelectorArg `json:"user"` +} + +// NewMembersUnsuspendArg returns a new MembersUnsuspendArg instance +func NewMembersUnsuspendArg(User *UserSelectorArg) *MembersUnsuspendArg { + s := new(MembersUnsuspendArg) + s.User = User + return s +} + +// MembersUnsuspendError : has no documentation (yet) +type MembersUnsuspendError struct { + dropbox.Tagged +} + +// Valid tag values for MembersUnsuspendError +const ( + MembersUnsuspendErrorUnsuspendNonSuspendedMember = "unsuspend_non_suspended_member" + MembersUnsuspendErrorTeamLicenseLimit = "team_license_limit" +) + +// MobileClientPlatform : has no documentation (yet) +type MobileClientPlatform struct { + dropbox.Tagged +} + +// Valid tag values for MobileClientPlatform +const ( + MobileClientPlatformIphone = "iphone" + MobileClientPlatformIpad = "ipad" + MobileClientPlatformAndroid = "android" + MobileClientPlatformWindowsPhone = "windows_phone" + MobileClientPlatformBlackberry = "blackberry" + MobileClientPlatformOther = "other" +) + +// MobileClientSession : Information about linked Dropbox mobile client sessions +type MobileClientSession struct { + DeviceSession + // DeviceName : The device name + DeviceName string `json:"device_name"` + // ClientType : The mobile application type + ClientType *MobileClientPlatform `json:"client_type"` + // ClientVersion : The dropbox client version + ClientVersion string `json:"client_version,omitempty"` + // OsVersion : The hosting OS version + OsVersion string `json:"os_version,omitempty"` + // LastCarrier : last carrier used by the device + LastCarrier string `json:"last_carrier,omitempty"` +} + +// NewMobileClientSession returns a new MobileClientSession instance +func NewMobileClientSession(SessionId string, DeviceName string, ClientType *MobileClientPlatform) *MobileClientSession { + s := new(MobileClientSession) + s.SessionId = SessionId + s.DeviceName = DeviceName + s.ClientType = ClientType + return s +} + +// NamespaceMetadata : Properties of a namespace. +type NamespaceMetadata struct { + // Name : The name of this namespace. + Name string `json:"name"` + // NamespaceId : The ID of this namespace. + NamespaceId string `json:"namespace_id"` + // NamespaceType : The type of this namespace. + NamespaceType *NamespaceType `json:"namespace_type"` + // TeamMemberId : If this is a team member folder, the ID of the team + // member. Otherwise, this field is not present. + TeamMemberId string `json:"team_member_id,omitempty"` +} + +// NewNamespaceMetadata returns a new NamespaceMetadata instance +func NewNamespaceMetadata(Name string, NamespaceId string, NamespaceType *NamespaceType) *NamespaceMetadata { + s := new(NamespaceMetadata) + s.Name = Name + s.NamespaceId = NamespaceId + s.NamespaceType = NamespaceType + return s +} + +// NamespaceType : has no documentation (yet) +type NamespaceType struct { + dropbox.Tagged +} + +// Valid tag values for NamespaceType +const ( + NamespaceTypeAppFolder = "app_folder" + NamespaceTypeSharedFolder = "shared_folder" + NamespaceTypeTeamFolder = "team_folder" + NamespaceTypeTeamMemberFolder = "team_member_folder" + NamespaceTypeOther = "other" +) + +// RemovedStatus : has no documentation (yet) +type RemovedStatus struct { + // IsRecoverable : True if the removed team member is recoverable. + IsRecoverable bool `json:"is_recoverable"` +} + +// NewRemovedStatus returns a new RemovedStatus instance +func NewRemovedStatus(IsRecoverable bool) *RemovedStatus { + s := new(RemovedStatus) + s.IsRecoverable = IsRecoverable + return s +} + +// RevokeDesktopClientArg : has no documentation (yet) +type RevokeDesktopClientArg struct { + DeviceSessionArg + // DeleteOnUnlink : Whether to delete all files of the account (this is + // possible only if supported by the desktop client and will be made the + // next time the client access the account) + DeleteOnUnlink bool `json:"delete_on_unlink"` +} + +// NewRevokeDesktopClientArg returns a new RevokeDesktopClientArg instance +func NewRevokeDesktopClientArg(SessionId string, TeamMemberId string) *RevokeDesktopClientArg { + s := new(RevokeDesktopClientArg) + s.SessionId = SessionId + s.TeamMemberId = TeamMemberId + s.DeleteOnUnlink = false + return s +} + +// RevokeDeviceSessionArg : has no documentation (yet) +type RevokeDeviceSessionArg struct { + dropbox.Tagged + // WebSession : End an active session + WebSession *DeviceSessionArg `json:"web_session,omitempty"` + // DesktopClient : Unlink a linked desktop device + DesktopClient *RevokeDesktopClientArg `json:"desktop_client,omitempty"` + // MobileClient : Unlink a linked mobile device + MobileClient *DeviceSessionArg `json:"mobile_client,omitempty"` +} + +// Valid tag values for RevokeDeviceSessionArg +const ( + RevokeDeviceSessionArgWebSession = "web_session" + RevokeDeviceSessionArgDesktopClient = "desktop_client" + RevokeDeviceSessionArgMobileClient = "mobile_client" +) + +// UnmarshalJSON deserializes into a RevokeDeviceSessionArg instance +func (u *RevokeDeviceSessionArg) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // WebSession : End an active session + WebSession json.RawMessage `json:"web_session,omitempty"` + // DesktopClient : Unlink a linked desktop device + DesktopClient json.RawMessage `json:"desktop_client,omitempty"` + // MobileClient : Unlink a linked mobile device + MobileClient json.RawMessage `json:"mobile_client,omitempty"` + } + var w wrap + var err error + if err = json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "web_session": + err = json.Unmarshal(body, &u.WebSession) + + if err != nil { + return err + } + case "desktop_client": + err = json.Unmarshal(body, &u.DesktopClient) + + if err != nil { + return err + } + case "mobile_client": + err = json.Unmarshal(body, &u.MobileClient) + + if err != nil { + return err + } + } + return nil +} + +// RevokeDeviceSessionBatchArg : has no documentation (yet) +type RevokeDeviceSessionBatchArg struct { + // RevokeDevices : has no documentation (yet) + RevokeDevices []*RevokeDeviceSessionArg `json:"revoke_devices"` +} + +// NewRevokeDeviceSessionBatchArg returns a new RevokeDeviceSessionBatchArg instance +func NewRevokeDeviceSessionBatchArg(RevokeDevices []*RevokeDeviceSessionArg) *RevokeDeviceSessionBatchArg { + s := new(RevokeDeviceSessionBatchArg) + s.RevokeDevices = RevokeDevices + return s +} + +// RevokeDeviceSessionBatchError : +type RevokeDeviceSessionBatchError struct { + dropbox.Tagged +} + +// Valid tag values for RevokeDeviceSessionBatchError +const ( + RevokeDeviceSessionBatchErrorOther = "other" +) + +// RevokeDeviceSessionBatchResult : has no documentation (yet) +type RevokeDeviceSessionBatchResult struct { + // RevokeDevicesStatus : has no documentation (yet) + RevokeDevicesStatus []*RevokeDeviceSessionStatus `json:"revoke_devices_status"` +} + +// NewRevokeDeviceSessionBatchResult returns a new RevokeDeviceSessionBatchResult instance +func NewRevokeDeviceSessionBatchResult(RevokeDevicesStatus []*RevokeDeviceSessionStatus) *RevokeDeviceSessionBatchResult { + s := new(RevokeDeviceSessionBatchResult) + s.RevokeDevicesStatus = RevokeDevicesStatus + return s +} + +// RevokeDeviceSessionError : has no documentation (yet) +type RevokeDeviceSessionError struct { + dropbox.Tagged +} + +// Valid tag values for RevokeDeviceSessionError +const ( + RevokeDeviceSessionErrorDeviceSessionNotFound = "device_session_not_found" + RevokeDeviceSessionErrorMemberNotFound = "member_not_found" + RevokeDeviceSessionErrorOther = "other" +) + +// RevokeDeviceSessionStatus : has no documentation (yet) +type RevokeDeviceSessionStatus struct { + // Success : Result of the revoking request + Success bool `json:"success"` + // ErrorType : The error cause in case of a failure + ErrorType *RevokeDeviceSessionError `json:"error_type,omitempty"` +} + +// NewRevokeDeviceSessionStatus returns a new RevokeDeviceSessionStatus instance +func NewRevokeDeviceSessionStatus(Success bool) *RevokeDeviceSessionStatus { + s := new(RevokeDeviceSessionStatus) + s.Success = Success + return s +} + +// RevokeLinkedApiAppArg : has no documentation (yet) +type RevokeLinkedApiAppArg struct { + // AppId : The application's unique id + AppId string `json:"app_id"` + // TeamMemberId : The unique id of the member owning the device + TeamMemberId string `json:"team_member_id"` + // KeepAppFolder : Whether to keep the application dedicated folder (in case + // the application uses one) + KeepAppFolder bool `json:"keep_app_folder"` +} + +// NewRevokeLinkedApiAppArg returns a new RevokeLinkedApiAppArg instance +func NewRevokeLinkedApiAppArg(AppId string, TeamMemberId string) *RevokeLinkedApiAppArg { + s := new(RevokeLinkedApiAppArg) + s.AppId = AppId + s.TeamMemberId = TeamMemberId + s.KeepAppFolder = true + return s +} + +// RevokeLinkedApiAppBatchArg : has no documentation (yet) +type RevokeLinkedApiAppBatchArg struct { + // RevokeLinkedApp : has no documentation (yet) + RevokeLinkedApp []*RevokeLinkedApiAppArg `json:"revoke_linked_app"` +} + +// NewRevokeLinkedApiAppBatchArg returns a new RevokeLinkedApiAppBatchArg instance +func NewRevokeLinkedApiAppBatchArg(RevokeLinkedApp []*RevokeLinkedApiAppArg) *RevokeLinkedApiAppBatchArg { + s := new(RevokeLinkedApiAppBatchArg) + s.RevokeLinkedApp = RevokeLinkedApp + return s +} + +// RevokeLinkedAppBatchError : Error returned by +// `linkedAppsRevokeLinkedAppBatch`. +type RevokeLinkedAppBatchError struct { + dropbox.Tagged +} + +// Valid tag values for RevokeLinkedAppBatchError +const ( + RevokeLinkedAppBatchErrorOther = "other" +) + +// RevokeLinkedAppBatchResult : has no documentation (yet) +type RevokeLinkedAppBatchResult struct { + // RevokeLinkedAppStatus : has no documentation (yet) + RevokeLinkedAppStatus []*RevokeLinkedAppStatus `json:"revoke_linked_app_status"` +} + +// NewRevokeLinkedAppBatchResult returns a new RevokeLinkedAppBatchResult instance +func NewRevokeLinkedAppBatchResult(RevokeLinkedAppStatus []*RevokeLinkedAppStatus) *RevokeLinkedAppBatchResult { + s := new(RevokeLinkedAppBatchResult) + s.RevokeLinkedAppStatus = RevokeLinkedAppStatus + return s +} + +// RevokeLinkedAppError : Error returned by `linkedAppsRevokeLinkedApp`. +type RevokeLinkedAppError struct { + dropbox.Tagged +} + +// Valid tag values for RevokeLinkedAppError +const ( + RevokeLinkedAppErrorAppNotFound = "app_not_found" + RevokeLinkedAppErrorMemberNotFound = "member_not_found" + RevokeLinkedAppErrorOther = "other" +) + +// RevokeLinkedAppStatus : has no documentation (yet) +type RevokeLinkedAppStatus struct { + // Success : Result of the revoking request + Success bool `json:"success"` + // ErrorType : The error cause in case of a failure + ErrorType *RevokeLinkedAppError `json:"error_type,omitempty"` +} + +// NewRevokeLinkedAppStatus returns a new RevokeLinkedAppStatus instance +func NewRevokeLinkedAppStatus(Success bool) *RevokeLinkedAppStatus { + s := new(RevokeLinkedAppStatus) + s.Success = Success + return s +} + +// StorageBucket : Describes the number of users in a specific storage bucket. +type StorageBucket struct { + // Bucket : The name of the storage bucket. For example, '1G' is a bucket of + // users with storage size up to 1 Giga. + Bucket string `json:"bucket"` + // Users : The number of people whose storage is in the range of this + // storage bucket. + Users uint64 `json:"users"` +} + +// NewStorageBucket returns a new StorageBucket instance +func NewStorageBucket(Bucket string, Users uint64) *StorageBucket { + s := new(StorageBucket) + s.Bucket = Bucket + s.Users = Users + return s +} + +// TeamFolderAccessError : has no documentation (yet) +type TeamFolderAccessError struct { + dropbox.Tagged +} + +// Valid tag values for TeamFolderAccessError +const ( + TeamFolderAccessErrorInvalidTeamFolderId = "invalid_team_folder_id" + TeamFolderAccessErrorNoAccess = "no_access" + TeamFolderAccessErrorOther = "other" +) + +// TeamFolderActivateError : +type TeamFolderActivateError struct { + dropbox.Tagged +} + +// Valid tag values for TeamFolderActivateError +const () + +// TeamFolderIdArg : has no documentation (yet) +type TeamFolderIdArg struct { + // TeamFolderId : The ID of the team folder. + TeamFolderId string `json:"team_folder_id"` +} + +// NewTeamFolderIdArg returns a new TeamFolderIdArg instance +func NewTeamFolderIdArg(TeamFolderId string) *TeamFolderIdArg { + s := new(TeamFolderIdArg) + s.TeamFolderId = TeamFolderId + return s +} + +// TeamFolderArchiveArg : has no documentation (yet) +type TeamFolderArchiveArg struct { + TeamFolderIdArg + // ForceAsyncOff : Whether to force the archive to happen synchronously. + ForceAsyncOff bool `json:"force_async_off"` +} + +// NewTeamFolderArchiveArg returns a new TeamFolderArchiveArg instance +func NewTeamFolderArchiveArg(TeamFolderId string) *TeamFolderArchiveArg { + s := new(TeamFolderArchiveArg) + s.TeamFolderId = TeamFolderId + s.ForceAsyncOff = false + return s +} + +// TeamFolderArchiveError : +type TeamFolderArchiveError struct { + dropbox.Tagged +} + +// Valid tag values for TeamFolderArchiveError +const () + +// TeamFolderArchiveJobStatus : has no documentation (yet) +type TeamFolderArchiveJobStatus struct { + dropbox.Tagged + // Complete : The archive job has finished. The value is the metadata for + // the resulting team folder. + Complete *TeamFolderMetadata `json:"complete,omitempty"` + // Failed : Error occurred while performing an asynchronous job from + // `teamFolderArchive`. + Failed *TeamFolderArchiveError `json:"failed,omitempty"` +} + +// Valid tag values for TeamFolderArchiveJobStatus +const ( + TeamFolderArchiveJobStatusComplete = "complete" + TeamFolderArchiveJobStatusFailed = "failed" +) + +// UnmarshalJSON deserializes into a TeamFolderArchiveJobStatus instance +func (u *TeamFolderArchiveJobStatus) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Complete : The archive job has finished. The value is the metadata + // for the resulting team folder. + Complete json.RawMessage `json:"complete,omitempty"` + // Failed : Error occurred while performing an asynchronous job from + // `teamFolderArchive`. + Failed json.RawMessage `json:"failed,omitempty"` + } + var w wrap + var err error + if err = json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "complete": + err = json.Unmarshal(body, &u.Complete) + + if err != nil { + return err + } + case "failed": + err = json.Unmarshal(w.Failed, &u.Failed) + + if err != nil { + return err + } + } + return nil +} + +// TeamFolderArchiveLaunch : has no documentation (yet) +type TeamFolderArchiveLaunch struct { + dropbox.Tagged + // Complete : has no documentation (yet) + Complete *TeamFolderMetadata `json:"complete,omitempty"` +} + +// Valid tag values for TeamFolderArchiveLaunch +const ( + TeamFolderArchiveLaunchComplete = "complete" +) + +// UnmarshalJSON deserializes into a TeamFolderArchiveLaunch instance +func (u *TeamFolderArchiveLaunch) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Complete : has no documentation (yet) + Complete json.RawMessage `json:"complete,omitempty"` + } + var w wrap + var err error + if err = json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "complete": + err = json.Unmarshal(body, &u.Complete) + + if err != nil { + return err + } + } + return nil +} + +// TeamFolderCreateArg : has no documentation (yet) +type TeamFolderCreateArg struct { + // Name : Name for the new team folder. + Name string `json:"name"` +} + +// NewTeamFolderCreateArg returns a new TeamFolderCreateArg instance +func NewTeamFolderCreateArg(Name string) *TeamFolderCreateArg { + s := new(TeamFolderCreateArg) + s.Name = Name + return s +} + +// TeamFolderCreateError : has no documentation (yet) +type TeamFolderCreateError struct { + dropbox.Tagged +} + +// Valid tag values for TeamFolderCreateError +const ( + TeamFolderCreateErrorInvalidFolderName = "invalid_folder_name" + TeamFolderCreateErrorFolderNameAlreadyUsed = "folder_name_already_used" + TeamFolderCreateErrorFolderNameReserved = "folder_name_reserved" + TeamFolderCreateErrorOther = "other" +) + +// TeamFolderGetInfoItem : has no documentation (yet) +type TeamFolderGetInfoItem struct { + dropbox.Tagged + // IdNotFound : An ID that was provided as a parameter to + // `teamFolderGetInfo` did not match any of the team's team folders. + IdNotFound string `json:"id_not_found,omitempty"` + // TeamFolderMetadata : Properties of a team folder. + TeamFolderMetadata *TeamFolderMetadata `json:"team_folder_metadata,omitempty"` +} + +// Valid tag values for TeamFolderGetInfoItem +const ( + TeamFolderGetInfoItemIdNotFound = "id_not_found" + TeamFolderGetInfoItemTeamFolderMetadata = "team_folder_metadata" +) + +// UnmarshalJSON deserializes into a TeamFolderGetInfoItem instance +func (u *TeamFolderGetInfoItem) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // TeamFolderMetadata : Properties of a team folder. + TeamFolderMetadata json.RawMessage `json:"team_folder_metadata,omitempty"` + } + var w wrap + var err error + if err = json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "id_not_found": + err = json.Unmarshal(body, &u.IdNotFound) + + if err != nil { + return err + } + case "team_folder_metadata": + err = json.Unmarshal(body, &u.TeamFolderMetadata) + + if err != nil { + return err + } + } + return nil +} + +// TeamFolderIdListArg : has no documentation (yet) +type TeamFolderIdListArg struct { + // TeamFolderIds : The list of team folder IDs. + TeamFolderIds []string `json:"team_folder_ids"` +} + +// NewTeamFolderIdListArg returns a new TeamFolderIdListArg instance +func NewTeamFolderIdListArg(TeamFolderIds []string) *TeamFolderIdListArg { + s := new(TeamFolderIdListArg) + s.TeamFolderIds = TeamFolderIds + return s +} + +// TeamFolderInvalidStatusError : has no documentation (yet) +type TeamFolderInvalidStatusError struct { + dropbox.Tagged +} + +// Valid tag values for TeamFolderInvalidStatusError +const ( + TeamFolderInvalidStatusErrorActive = "active" + TeamFolderInvalidStatusErrorArchived = "archived" + TeamFolderInvalidStatusErrorArchiveInProgress = "archive_in_progress" + TeamFolderInvalidStatusErrorOther = "other" +) + +// TeamFolderListArg : has no documentation (yet) +type TeamFolderListArg struct { + // Limit : The maximum number of results to return per request. + Limit uint32 `json:"limit"` +} + +// NewTeamFolderListArg returns a new TeamFolderListArg instance +func NewTeamFolderListArg() *TeamFolderListArg { + s := new(TeamFolderListArg) + s.Limit = 1000 + return s +} + +// TeamFolderListContinueArg : has no documentation (yet) +type TeamFolderListContinueArg struct { + // Cursor : Indicates from what point to get the next set of team folders. + Cursor string `json:"cursor"` +} + +// NewTeamFolderListContinueArg returns a new TeamFolderListContinueArg instance +func NewTeamFolderListContinueArg(Cursor string) *TeamFolderListContinueArg { + s := new(TeamFolderListContinueArg) + s.Cursor = Cursor + return s +} + +// TeamFolderListContinueError : has no documentation (yet) +type TeamFolderListContinueError struct { + dropbox.Tagged +} + +// Valid tag values for TeamFolderListContinueError +const ( + TeamFolderListContinueErrorInvalidCursor = "invalid_cursor" + TeamFolderListContinueErrorOther = "other" +) + +// TeamFolderListError : has no documentation (yet) +type TeamFolderListError struct { + // AccessError : has no documentation (yet) + AccessError *TeamFolderAccessError `json:"access_error"` +} + +// NewTeamFolderListError returns a new TeamFolderListError instance +func NewTeamFolderListError(AccessError *TeamFolderAccessError) *TeamFolderListError { + s := new(TeamFolderListError) + s.AccessError = AccessError + return s +} + +// TeamFolderListResult : Result for `teamFolderList` and +// `teamFolderListContinue`. +type TeamFolderListResult struct { + // TeamFolders : List of all team folders in the authenticated team. + TeamFolders []*TeamFolderMetadata `json:"team_folders"` + // Cursor : Pass the cursor into `teamFolderListContinue` to obtain + // additional team folders. + Cursor string `json:"cursor"` + // HasMore : Is true if there are additional team folders that have not been + // returned yet. An additional call to `teamFolderListContinue` can retrieve + // them. + HasMore bool `json:"has_more"` +} + +// NewTeamFolderListResult returns a new TeamFolderListResult instance +func NewTeamFolderListResult(TeamFolders []*TeamFolderMetadata, Cursor string, HasMore bool) *TeamFolderListResult { + s := new(TeamFolderListResult) + s.TeamFolders = TeamFolders + s.Cursor = Cursor + s.HasMore = HasMore + return s +} + +// TeamFolderMetadata : Properties of a team folder. +type TeamFolderMetadata struct { + // TeamFolderId : The ID of the team folder. + TeamFolderId string `json:"team_folder_id"` + // Name : The name of the team folder. + Name string `json:"name"` + // Status : The status of the team folder. + Status *TeamFolderStatus `json:"status"` + // IsTeamSharedDropbox : True if this team folder is the team shared + // dropbox. + IsTeamSharedDropbox bool `json:"is_team_shared_dropbox"` +} + +// NewTeamFolderMetadata returns a new TeamFolderMetadata instance +func NewTeamFolderMetadata(TeamFolderId string, Name string, Status *TeamFolderStatus, IsTeamSharedDropbox bool) *TeamFolderMetadata { + s := new(TeamFolderMetadata) + s.TeamFolderId = TeamFolderId + s.Name = Name + s.Status = Status + s.IsTeamSharedDropbox = IsTeamSharedDropbox + return s +} + +// TeamFolderPermanentlyDeleteError : +type TeamFolderPermanentlyDeleteError struct { + dropbox.Tagged +} + +// Valid tag values for TeamFolderPermanentlyDeleteError +const () + +// TeamFolderRenameArg : has no documentation (yet) +type TeamFolderRenameArg struct { + TeamFolderIdArg + // Name : New team folder name. + Name string `json:"name"` +} + +// NewTeamFolderRenameArg returns a new TeamFolderRenameArg instance +func NewTeamFolderRenameArg(TeamFolderId string, Name string) *TeamFolderRenameArg { + s := new(TeamFolderRenameArg) + s.TeamFolderId = TeamFolderId + s.Name = Name + return s +} + +// TeamFolderRenameError : has no documentation (yet) +type TeamFolderRenameError struct { + dropbox.Tagged +} + +// Valid tag values for TeamFolderRenameError +const ( + TeamFolderRenameErrorInvalidFolderName = "invalid_folder_name" + TeamFolderRenameErrorFolderNameAlreadyUsed = "folder_name_already_used" + TeamFolderRenameErrorFolderNameReserved = "folder_name_reserved" +) + +// TeamFolderStatus : has no documentation (yet) +type TeamFolderStatus struct { + dropbox.Tagged +} + +// Valid tag values for TeamFolderStatus +const ( + TeamFolderStatusActive = "active" + TeamFolderStatusArchived = "archived" + TeamFolderStatusArchiveInProgress = "archive_in_progress" + TeamFolderStatusOther = "other" +) + +// TeamFolderTeamSharedDropboxError : has no documentation (yet) +type TeamFolderTeamSharedDropboxError struct { + dropbox.Tagged +} + +// Valid tag values for TeamFolderTeamSharedDropboxError +const ( + TeamFolderTeamSharedDropboxErrorDisallowed = "disallowed" + TeamFolderTeamSharedDropboxErrorOther = "other" +) + +// TeamGetInfoResult : has no documentation (yet) +type TeamGetInfoResult struct { + // Name : The name of the team. + Name string `json:"name"` + // TeamId : The ID of the team. + TeamId string `json:"team_id"` + // NumLicensedUsers : The number of licenses available to the team. + NumLicensedUsers uint32 `json:"num_licensed_users"` + // NumProvisionedUsers : The number of accounts that have been invited or + // are already active members of the team. + NumProvisionedUsers uint32 `json:"num_provisioned_users"` + // Policies : has no documentation (yet) + Policies *team_policies.TeamMemberPolicies `json:"policies"` +} + +// NewTeamGetInfoResult returns a new TeamGetInfoResult instance +func NewTeamGetInfoResult(Name string, TeamId string, NumLicensedUsers uint32, NumProvisionedUsers uint32, Policies *team_policies.TeamMemberPolicies) *TeamGetInfoResult { + s := new(TeamGetInfoResult) + s.Name = Name + s.TeamId = TeamId + s.NumLicensedUsers = NumLicensedUsers + s.NumProvisionedUsers = NumProvisionedUsers + s.Policies = Policies + return s +} + +// TeamMemberInfo : Information about a team member. +type TeamMemberInfo struct { + // Profile : Profile of a user as a member of a team. + Profile *TeamMemberProfile `json:"profile"` + // Role : The user's role in the team. + Role *AdminTier `json:"role"` +} + +// NewTeamMemberInfo returns a new TeamMemberInfo instance +func NewTeamMemberInfo(Profile *TeamMemberProfile, Role *AdminTier) *TeamMemberInfo { + s := new(TeamMemberInfo) + s.Profile = Profile + s.Role = Role + return s +} + +// TeamMemberProfile : Profile of a user as a member of a team. +type TeamMemberProfile struct { + MemberProfile + // Groups : List of group IDs of groups that the user belongs to. + Groups []string `json:"groups"` + // MemberFolderId : The namespace id of the user's root folder. + MemberFolderId string `json:"member_folder_id"` +} + +// NewTeamMemberProfile returns a new TeamMemberProfile instance +func NewTeamMemberProfile(TeamMemberId string, Email string, EmailVerified bool, Status *TeamMemberStatus, Name *users.Name, MembershipType *TeamMembershipType, Groups []string, MemberFolderId string) *TeamMemberProfile { + s := new(TeamMemberProfile) + s.TeamMemberId = TeamMemberId + s.Email = Email + s.EmailVerified = EmailVerified + s.Status = Status + s.Name = Name + s.MembershipType = MembershipType + s.Groups = Groups + s.MemberFolderId = MemberFolderId + return s +} + +// TeamMemberStatus : The user's status as a member of a specific team. +type TeamMemberStatus struct { + dropbox.Tagged + // Removed : User is no longer a member of the team. Removed users are only + // listed when include_removed is true in members/list. + Removed *RemovedStatus `json:"removed,omitempty"` +} + +// Valid tag values for TeamMemberStatus +const ( + TeamMemberStatusActive = "active" + TeamMemberStatusInvited = "invited" + TeamMemberStatusSuspended = "suspended" + TeamMemberStatusRemoved = "removed" +) + +// UnmarshalJSON deserializes into a TeamMemberStatus instance +func (u *TeamMemberStatus) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Removed : User is no longer a member of the team. Removed users are + // only listed when include_removed is true in members/list. + Removed json.RawMessage `json:"removed,omitempty"` + } + var w wrap + var err error + if err = json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "removed": + err = json.Unmarshal(body, &u.Removed) + + if err != nil { + return err + } + } + return nil +} + +// TeamMembershipType : has no documentation (yet) +type TeamMembershipType struct { + dropbox.Tagged +} + +// Valid tag values for TeamMembershipType +const ( + TeamMembershipTypeFull = "full" + TeamMembershipTypeLimited = "limited" +) + +// TeamNamespacesListArg : has no documentation (yet) +type TeamNamespacesListArg struct { + // Limit : The approximate maximum number of results to return per request. + // This limit may be exceeded. + Limit uint32 `json:"limit"` +} + +// NewTeamNamespacesListArg returns a new TeamNamespacesListArg instance +func NewTeamNamespacesListArg() *TeamNamespacesListArg { + s := new(TeamNamespacesListArg) + s.Limit = 1000 + return s +} + +// TeamNamespacesListContinueArg : has no documentation (yet) +type TeamNamespacesListContinueArg struct { + // Cursor : Indicates from what point to get the next set of team-accessible + // namespaces. + Cursor string `json:"cursor"` +} + +// NewTeamNamespacesListContinueArg returns a new TeamNamespacesListContinueArg instance +func NewTeamNamespacesListContinueArg(Cursor string) *TeamNamespacesListContinueArg { + s := new(TeamNamespacesListContinueArg) + s.Cursor = Cursor + return s +} + +// TeamNamespacesListContinueError : has no documentation (yet) +type TeamNamespacesListContinueError struct { + dropbox.Tagged +} + +// Valid tag values for TeamNamespacesListContinueError +const ( + TeamNamespacesListContinueErrorInvalidCursor = "invalid_cursor" + TeamNamespacesListContinueErrorOther = "other" +) + +// TeamNamespacesListResult : Result for `namespacesList`. +type TeamNamespacesListResult struct { + // Namespaces : List of all namespaces the team can access. + Namespaces []*NamespaceMetadata `json:"namespaces"` + // Cursor : Pass the cursor into `namespacesListContinue` to obtain + // additional namespaces. Note that duplicate namespaces may be returned. + Cursor string `json:"cursor"` + // HasMore : Is true if there are additional namespaces that have not been + // returned yet. + HasMore bool `json:"has_more"` +} + +// NewTeamNamespacesListResult returns a new TeamNamespacesListResult instance +func NewTeamNamespacesListResult(Namespaces []*NamespaceMetadata, Cursor string, HasMore bool) *TeamNamespacesListResult { + s := new(TeamNamespacesListResult) + s.Namespaces = Namespaces + s.Cursor = Cursor + s.HasMore = HasMore + return s +} + +// TokenGetAuthenticatedAdminError : Error returned by +// `tokenGetAuthenticatedAdmin`. +type TokenGetAuthenticatedAdminError struct { + dropbox.Tagged +} + +// Valid tag values for TokenGetAuthenticatedAdminError +const ( + TokenGetAuthenticatedAdminErrorMappingNotFound = "mapping_not_found" + TokenGetAuthenticatedAdminErrorAdminNotActive = "admin_not_active" + TokenGetAuthenticatedAdminErrorOther = "other" +) + +// TokenGetAuthenticatedAdminResult : Results for `tokenGetAuthenticatedAdmin`. +type TokenGetAuthenticatedAdminResult struct { + // AdminProfile : The admin who authorized the token. + AdminProfile *TeamMemberProfile `json:"admin_profile"` +} + +// NewTokenGetAuthenticatedAdminResult returns a new TokenGetAuthenticatedAdminResult instance +func NewTokenGetAuthenticatedAdminResult(AdminProfile *TeamMemberProfile) *TokenGetAuthenticatedAdminResult { + s := new(TokenGetAuthenticatedAdminResult) + s.AdminProfile = AdminProfile + return s +} + +// UpdatePropertyTemplateArg : has no documentation (yet) +type UpdatePropertyTemplateArg struct { + // TemplateId : An identifier for property template added by + // `propertiesTemplateAdd`. + TemplateId string `json:"template_id"` + // Name : A display name for the property template. Property template names + // can be up to 256 bytes. + Name string `json:"name,omitempty"` + // Description : Description for new property template. Property template + // descriptions can be up to 1024 bytes. + Description string `json:"description,omitempty"` + // AddFields : This is a list of custom properties to add to the property + // template. There can be up to 64 properties in a single property template. + AddFields []*properties.PropertyFieldTemplate `json:"add_fields,omitempty"` +} + +// NewUpdatePropertyTemplateArg returns a new UpdatePropertyTemplateArg instance +func NewUpdatePropertyTemplateArg(TemplateId string) *UpdatePropertyTemplateArg { + s := new(UpdatePropertyTemplateArg) + s.TemplateId = TemplateId + return s +} + +// UpdatePropertyTemplateResult : has no documentation (yet) +type UpdatePropertyTemplateResult struct { + // TemplateId : An identifier for property template added by + // `propertiesTemplateAdd`. + TemplateId string `json:"template_id"` +} + +// NewUpdatePropertyTemplateResult returns a new UpdatePropertyTemplateResult instance +func NewUpdatePropertyTemplateResult(TemplateId string) *UpdatePropertyTemplateResult { + s := new(UpdatePropertyTemplateResult) + s.TemplateId = TemplateId + return s +} + +// UploadApiRateLimitValue : The value for `Feature.upload_api_rate_limit`. +type UploadApiRateLimitValue struct { + dropbox.Tagged + // Limit : The number of upload API calls allowed per month. + Limit uint32 `json:"limit,omitempty"` +} + +// Valid tag values for UploadApiRateLimitValue +const ( + UploadApiRateLimitValueUnlimited = "unlimited" + UploadApiRateLimitValueLimit = "limit" + UploadApiRateLimitValueOther = "other" +) + +// UnmarshalJSON deserializes into a UploadApiRateLimitValue instance +func (u *UploadApiRateLimitValue) 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 "limit": + err = json.Unmarshal(body, &u.Limit) + + if err != nil { + return err + } + } + return nil +} + +// UserSelectorArg : Argument for selecting a single user, either by +// team_member_id, external_id or email. +type UserSelectorArg struct { + dropbox.Tagged + // TeamMemberId : has no documentation (yet) + TeamMemberId string `json:"team_member_id,omitempty"` + // ExternalId : has no documentation (yet) + ExternalId string `json:"external_id,omitempty"` + // Email : has no documentation (yet) + Email string `json:"email,omitempty"` +} + +// Valid tag values for UserSelectorArg +const ( + UserSelectorArgTeamMemberId = "team_member_id" + UserSelectorArgExternalId = "external_id" + UserSelectorArgEmail = "email" +) + +// UnmarshalJSON deserializes into a UserSelectorArg instance +func (u *UserSelectorArg) 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 "team_member_id": + err = json.Unmarshal(body, &u.TeamMemberId) + + if err != nil { + return err + } + case "external_id": + err = json.Unmarshal(body, &u.ExternalId) + + if err != nil { + return err + } + case "email": + err = json.Unmarshal(body, &u.Email) + + if err != nil { + return err + } + } + return nil +} + +// UsersSelectorArg : Argument for selecting a list of users, either by +// team_member_ids, external_ids or emails. +type UsersSelectorArg struct { + dropbox.Tagged + // TeamMemberIds : List of member IDs. + TeamMemberIds []string `json:"team_member_ids,omitempty"` + // ExternalIds : List of external user IDs. + ExternalIds []string `json:"external_ids,omitempty"` + // Emails : List of email addresses. + Emails []string `json:"emails,omitempty"` +} + +// Valid tag values for UsersSelectorArg +const ( + UsersSelectorArgTeamMemberIds = "team_member_ids" + UsersSelectorArgExternalIds = "external_ids" + UsersSelectorArgEmails = "emails" +) + +// UnmarshalJSON deserializes into a UsersSelectorArg instance +func (u *UsersSelectorArg) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // TeamMemberIds : List of member IDs. + TeamMemberIds json.RawMessage `json:"team_member_ids,omitempty"` + // ExternalIds : List of external user IDs. + ExternalIds json.RawMessage `json:"external_ids,omitempty"` + // Emails : List of email addresses. + Emails json.RawMessage `json:"emails,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 "team_member_ids": + err = json.Unmarshal(body, &u.TeamMemberIds) + + if err != nil { + return err + } + case "external_ids": + err = json.Unmarshal(body, &u.ExternalIds) + + if err != nil { + return err + } + case "emails": + err = json.Unmarshal(body, &u.Emails) + + if err != nil { + return err + } + } + return nil +} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_common/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_common/types.go new file mode 100644 index 000000000..6239e1300 --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_common/types.go @@ -0,0 +1,91 @@ +// Copyright (c) Dropbox, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package team_common : has no documentation (yet) +package team_common + +import ( + "time" + + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" +) + +// GroupManagementType : The group type determines how a group is managed. +type GroupManagementType struct { + dropbox.Tagged +} + +// Valid tag values for GroupManagementType +const ( + GroupManagementTypeUserManaged = "user_managed" + GroupManagementTypeCompanyManaged = "company_managed" + GroupManagementTypeSystemManaged = "system_managed" + GroupManagementTypeOther = "other" +) + +// GroupSummary : Information about a group. +type GroupSummary struct { + // GroupName : has no documentation (yet) + GroupName string `json:"group_name"` + // GroupId : has no documentation (yet) + GroupId string `json:"group_id"` + // GroupExternalId : External ID of group. This is an arbitrary ID that an + // admin can attach to a group. + GroupExternalId string `json:"group_external_id,omitempty"` + // MemberCount : The number of members in the group. + MemberCount uint32 `json:"member_count,omitempty"` + // GroupManagementType : Who is allowed to manage the group. + GroupManagementType *GroupManagementType `json:"group_management_type"` +} + +// NewGroupSummary returns a new GroupSummary instance +func NewGroupSummary(GroupName string, GroupId string, GroupManagementType *GroupManagementType) *GroupSummary { + s := new(GroupSummary) + s.GroupName = GroupName + s.GroupId = GroupId + s.GroupManagementType = GroupManagementType + return s +} + +// GroupType : The group type determines how a group is created and managed. +type GroupType struct { + dropbox.Tagged +} + +// Valid tag values for GroupType +const ( + GroupTypeTeam = "team" + GroupTypeUserManaged = "user_managed" + GroupTypeOther = "other" +) + +// TimeRange : Time range. +type TimeRange struct { + // StartTime : Optional starting time (inclusive). + StartTime time.Time `json:"start_time,omitempty"` + // EndTime : Optional ending time (exclusive). + EndTime time.Time `json:"end_time,omitempty"` +} + +// NewTimeRange returns a new TimeRange instance +func NewTimeRange() *TimeRange { + s := new(TimeRange) + return s +} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_log/client.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_log/client.go new file mode 100644 index 000000000..b80a11095 --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_log/client.go @@ -0,0 +1,185 @@ +// Copyright (c) Dropbox, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package team_log + +import ( + "bytes" + "encoding/json" + "io/ioutil" + "net/http" + + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" +) + +// Client interface describes all routes in this namespace +type Client interface { + // GetEvents : Retrieves team events. Permission : Team Auditing. + GetEvents(arg *GetTeamEventsArg) (res *GetTeamEventsResult, err error) + // GetEventsContinue : Once a cursor has been retrieved from `getEvents`, + // use this to paginate through all events. Permission : Team Auditing. + GetEventsContinue(arg *GetTeamEventsContinueArg) (res *GetTeamEventsResult, err error) +} + +type apiImpl dropbox.Context + +//GetEventsAPIError is an error-wrapper for the get_events route +type GetEventsAPIError struct { + dropbox.APIError + EndpointError *GetTeamEventsError `json:"error"` +} + +func (dbx *apiImpl) GetEvents(arg *GetTeamEventsArg) (res *GetTeamEventsResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team_log", "get_events", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GetEventsAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//GetEventsContinueAPIError is an error-wrapper for the get_events/continue route +type GetEventsContinueAPIError struct { + dropbox.APIError + EndpointError *GetTeamEventsContinueError `json:"error"` +} + +func (dbx *apiImpl) GetEventsContinue(arg *GetTeamEventsContinueArg) (res *GetTeamEventsResult, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team_log", "get_events/continue", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GetEventsContinueAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +// New returns a Client implementation for this namespace +func New(c dropbox.Config) *apiImpl { + ctx := apiImpl(dropbox.NewContext(c)) + return &ctx +} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_log/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_log/types.go new file mode 100644 index 000000000..846bbd803 --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_log/types.go @@ -0,0 +1,9154 @@ +// Copyright (c) Dropbox, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package team_log : has no documentation (yet) +package team_log + +import ( + "encoding/json" + "time" + + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_common" +) + +// AccessMethodLogInfo : Indicates the method in which the action was performed. +type AccessMethodLogInfo struct { + dropbox.Tagged + // EndUser : End user session details. + EndUser IsSessionLogInfo `json:"end_user,omitempty"` + // SignInAs : Sign in as session details. + SignInAs *WebSessionLogInfo `json:"sign_in_as,omitempty"` + // ContentManager : Content manager session details. + ContentManager *WebSessionLogInfo `json:"content_manager,omitempty"` + // AdminConsole : Admin console session details. + AdminConsole *WebSessionLogInfo `json:"admin_console,omitempty"` + // Api : Api session details. + Api *ApiSessionLogInfo `json:"api,omitempty"` +} + +// Valid tag values for AccessMethodLogInfo +const ( + AccessMethodLogInfoEndUser = "end_user" + AccessMethodLogInfoSignInAs = "sign_in_as" + AccessMethodLogInfoContentManager = "content_manager" + AccessMethodLogInfoAdminConsole = "admin_console" + AccessMethodLogInfoApi = "api" + AccessMethodLogInfoOther = "other" +) + +// UnmarshalJSON deserializes into a AccessMethodLogInfo instance +func (u *AccessMethodLogInfo) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // EndUser : End user session details. + EndUser json.RawMessage `json:"end_user,omitempty"` + // SignInAs : Sign in as session details. + SignInAs json.RawMessage `json:"sign_in_as,omitempty"` + // ContentManager : Content manager session details. + ContentManager json.RawMessage `json:"content_manager,omitempty"` + // AdminConsole : Admin console session details. + AdminConsole json.RawMessage `json:"admin_console,omitempty"` + // Api : Api session details. + Api json.RawMessage `json:"api,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 "end_user": + u.EndUser, err = IsSessionLogInfoFromJSON(body) + + if err != nil { + return err + } + case "sign_in_as": + err = json.Unmarshal(body, &u.SignInAs) + + if err != nil { + return err + } + case "content_manager": + err = json.Unmarshal(body, &u.ContentManager) + + if err != nil { + return err + } + case "admin_console": + err = json.Unmarshal(body, &u.AdminConsole) + + if err != nil { + return err + } + case "api": + err = json.Unmarshal(body, &u.Api) + + if err != nil { + return err + } + } + return nil +} + +// AccountCaptureAvailability : has no documentation (yet) +type AccountCaptureAvailability struct { + dropbox.Tagged +} + +// Valid tag values for AccountCaptureAvailability +const ( + AccountCaptureAvailabilityUnavailable = "unavailable" + AccountCaptureAvailabilityAvailable = "available" + AccountCaptureAvailabilityOther = "other" +) + +// AccountCaptureChangeAvailabilityDetails : Granted or revoked the option to +// enable account capture on domains belonging to the team. +type AccountCaptureChangeAvailabilityDetails struct { + // NewValue : New account capture availabilty value. + NewValue *AccountCaptureAvailability `json:"new_value"` + // PreviousValue : Previous account capture availabilty value. Might be + // missing due to historical data gap. + PreviousValue *AccountCaptureAvailability `json:"previous_value,omitempty"` +} + +// NewAccountCaptureChangeAvailabilityDetails returns a new AccountCaptureChangeAvailabilityDetails instance +func NewAccountCaptureChangeAvailabilityDetails(NewValue *AccountCaptureAvailability) *AccountCaptureChangeAvailabilityDetails { + s := new(AccountCaptureChangeAvailabilityDetails) + s.NewValue = NewValue + return s +} + +// AccountCaptureChangePolicyDetails : Changed the account capture policy on a +// domain belonging to the team. +type AccountCaptureChangePolicyDetails struct { + // NewValue : New account capture policy. + NewValue *AccountCapturePolicy `json:"new_value"` + // PreviousValue : Previous account capture policy. Might be missing due to + // historical data gap. + PreviousValue *AccountCapturePolicy `json:"previous_value,omitempty"` +} + +// NewAccountCaptureChangePolicyDetails returns a new AccountCaptureChangePolicyDetails instance +func NewAccountCaptureChangePolicyDetails(NewValue *AccountCapturePolicy) *AccountCaptureChangePolicyDetails { + s := new(AccountCaptureChangePolicyDetails) + s.NewValue = NewValue + return s +} + +// AccountCaptureMigrateAccountDetails : Account captured user migrated their +// account to the team. +type AccountCaptureMigrateAccountDetails struct { + // DomainName : Domain name. + DomainName string `json:"domain_name"` +} + +// NewAccountCaptureMigrateAccountDetails returns a new AccountCaptureMigrateAccountDetails instance +func NewAccountCaptureMigrateAccountDetails(DomainName string) *AccountCaptureMigrateAccountDetails { + s := new(AccountCaptureMigrateAccountDetails) + s.DomainName = DomainName + return s +} + +// AccountCapturePolicy : has no documentation (yet) +type AccountCapturePolicy struct { + dropbox.Tagged +} + +// Valid tag values for AccountCapturePolicy +const ( + AccountCapturePolicyDisabled = "disabled" + AccountCapturePolicyInvitedUsers = "invited_users" + AccountCapturePolicyAllUsers = "all_users" + AccountCapturePolicyOther = "other" +) + +// AccountCaptureRelinquishAccountDetails : Account captured user relinquished +// their account by changing the email address associated with it. +type AccountCaptureRelinquishAccountDetails struct { + // DomainName : Domain name. + DomainName string `json:"domain_name"` +} + +// NewAccountCaptureRelinquishAccountDetails returns a new AccountCaptureRelinquishAccountDetails instance +func NewAccountCaptureRelinquishAccountDetails(DomainName string) *AccountCaptureRelinquishAccountDetails { + s := new(AccountCaptureRelinquishAccountDetails) + s.DomainName = DomainName + return s +} + +// ActorLogInfo : The entity who performed the action. +type ActorLogInfo struct { + dropbox.Tagged + // User : The user who did the action. + User IsUserLogInfo `json:"user,omitempty"` + // Admin : The admin who did the action. + Admin IsUserLogInfo `json:"admin,omitempty"` + // App : The application who did the action. + App IsAppLogInfo `json:"app,omitempty"` + // Reseller : Action done by reseller. + Reseller *ResellerLogInfo `json:"reseller,omitempty"` +} + +// Valid tag values for ActorLogInfo +const ( + ActorLogInfoUser = "user" + ActorLogInfoAdmin = "admin" + ActorLogInfoApp = "app" + ActorLogInfoReseller = "reseller" + ActorLogInfoDropbox = "dropbox" + ActorLogInfoOther = "other" +) + +// UnmarshalJSON deserializes into a ActorLogInfo instance +func (u *ActorLogInfo) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // User : The user who did the action. + User json.RawMessage `json:"user,omitempty"` + // Admin : The admin who did the action. + Admin json.RawMessage `json:"admin,omitempty"` + // App : The application who did the action. + App json.RawMessage `json:"app,omitempty"` + // Reseller : Action done by reseller. + Reseller json.RawMessage `json:"reseller,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 "user": + u.User, err = IsUserLogInfoFromJSON(body) + + if err != nil { + return err + } + case "admin": + u.Admin, err = IsUserLogInfoFromJSON(body) + + if err != nil { + return err + } + case "app": + u.App, err = IsAppLogInfoFromJSON(body) + + if err != nil { + return err + } + case "reseller": + err = json.Unmarshal(body, &u.Reseller) + + if err != nil { + return err + } + } + return nil +} + +// AdminRole : has no documentation (yet) +type AdminRole struct { + dropbox.Tagged +} + +// Valid tag values for AdminRole +const ( + AdminRoleUser = "user" + AdminRoleLimitedAdmin = "limited_admin" + AdminRoleSupportAdmin = "support_admin" + AdminRoleUserManagementAdmin = "user_management_admin" + AdminRoleTeamAdmin = "team_admin" + AdminRoleOther = "other" +) + +// AllowDownloadDisabledDetails : Disabled allow downloads. +type AllowDownloadDisabledDetails struct { +} + +// NewAllowDownloadDisabledDetails returns a new AllowDownloadDisabledDetails instance +func NewAllowDownloadDisabledDetails() *AllowDownloadDisabledDetails { + s := new(AllowDownloadDisabledDetails) + return s +} + +// AllowDownloadEnabledDetails : Enabled allow downloads. +type AllowDownloadEnabledDetails struct { +} + +// NewAllowDownloadEnabledDetails returns a new AllowDownloadEnabledDetails instance +func NewAllowDownloadEnabledDetails() *AllowDownloadEnabledDetails { + s := new(AllowDownloadEnabledDetails) + return s +} + +// ApiSessionLogInfo : Api session. +type ApiSessionLogInfo struct { + // RequestId : Api request ID. + RequestId string `json:"request_id"` +} + +// NewApiSessionLogInfo returns a new ApiSessionLogInfo instance +func NewApiSessionLogInfo(RequestId string) *ApiSessionLogInfo { + s := new(ApiSessionLogInfo) + s.RequestId = RequestId + return s +} + +// AppLinkTeamDetails : Linked an app for team. +type AppLinkTeamDetails struct { + // AppInfo : Relevant application details. + AppInfo IsAppLogInfo `json:"app_info"` +} + +// NewAppLinkTeamDetails returns a new AppLinkTeamDetails instance +func NewAppLinkTeamDetails(AppInfo IsAppLogInfo) *AppLinkTeamDetails { + s := new(AppLinkTeamDetails) + s.AppInfo = AppInfo + return s +} + +// AppLinkUserDetails : Linked an app for team member. +type AppLinkUserDetails struct { + // AppInfo : Relevant application details. + AppInfo IsAppLogInfo `json:"app_info"` +} + +// NewAppLinkUserDetails returns a new AppLinkUserDetails instance +func NewAppLinkUserDetails(AppInfo IsAppLogInfo) *AppLinkUserDetails { + s := new(AppLinkUserDetails) + s.AppInfo = AppInfo + return s +} + +// AppLogInfo : App's logged information. +type AppLogInfo struct { + // AppId : App unique ID. Might be missing due to historical data gap. + AppId string `json:"app_id,omitempty"` + // DisplayName : App display name. Might be missing due to historical data + // gap. + DisplayName string `json:"display_name,omitempty"` +} + +// NewAppLogInfo returns a new AppLogInfo instance +func NewAppLogInfo() *AppLogInfo { + s := new(AppLogInfo) + return s +} + +// IsAppLogInfo is the interface type for AppLogInfo and its subtypes +type IsAppLogInfo interface { + IsAppLogInfo() +} + +// IsAppLogInfo implements the IsAppLogInfo interface +func (u *AppLogInfo) IsAppLogInfo() {} + +type appLogInfoUnion struct { + dropbox.Tagged + // UserOrTeamLinkedApp : has no documentation (yet) + UserOrTeamLinkedApp *UserOrTeamLinkedAppLogInfo `json:"user_or_team_linked_app,omitempty"` + // UserLinkedApp : has no documentation (yet) + UserLinkedApp *UserLinkedAppLogInfo `json:"user_linked_app,omitempty"` + // TeamLinkedApp : has no documentation (yet) + TeamLinkedApp *TeamLinkedAppLogInfo `json:"team_linked_app,omitempty"` +} + +// Valid tag values for AppLogInfo +const ( + AppLogInfoUserOrTeamLinkedApp = "user_or_team_linked_app" + AppLogInfoUserLinkedApp = "user_linked_app" + AppLogInfoTeamLinkedApp = "team_linked_app" +) + +// UnmarshalJSON deserializes into a appLogInfoUnion instance +func (u *appLogInfoUnion) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // UserOrTeamLinkedApp : has no documentation (yet) + UserOrTeamLinkedApp json.RawMessage `json:"user_or_team_linked_app,omitempty"` + // UserLinkedApp : has no documentation (yet) + UserLinkedApp json.RawMessage `json:"user_linked_app,omitempty"` + // TeamLinkedApp : has no documentation (yet) + TeamLinkedApp json.RawMessage `json:"team_linked_app,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 "user_or_team_linked_app": + err = json.Unmarshal(body, &u.UserOrTeamLinkedApp) + + if err != nil { + return err + } + case "user_linked_app": + err = json.Unmarshal(body, &u.UserLinkedApp) + + if err != nil { + return err + } + case "team_linked_app": + err = json.Unmarshal(body, &u.TeamLinkedApp) + + if err != nil { + return err + } + } + return nil +} + +// IsAppLogInfoFromJSON converts JSON to a concrete IsAppLogInfo instance +func IsAppLogInfoFromJSON(data []byte) (IsAppLogInfo, error) { + var t appLogInfoUnion + if err := json.Unmarshal(data, &t); err != nil { + return nil, err + } + switch t.Tag { + case "user_or_team_linked_app": + return t.UserOrTeamLinkedApp, nil + + case "user_linked_app": + return t.UserLinkedApp, nil + + case "team_linked_app": + return t.TeamLinkedApp, nil + + } + return nil, nil +} + +// AppUnlinkTeamDetails : Unlinked an app for team. +type AppUnlinkTeamDetails struct { + // AppInfo : Relevant application details. + AppInfo IsAppLogInfo `json:"app_info"` +} + +// NewAppUnlinkTeamDetails returns a new AppUnlinkTeamDetails instance +func NewAppUnlinkTeamDetails(AppInfo IsAppLogInfo) *AppUnlinkTeamDetails { + s := new(AppUnlinkTeamDetails) + s.AppInfo = AppInfo + return s +} + +// AppUnlinkUserDetails : Unlinked an app for team member. +type AppUnlinkUserDetails struct { + // AppInfo : Relevant application details. + AppInfo IsAppLogInfo `json:"app_info"` +} + +// NewAppUnlinkUserDetails returns a new AppUnlinkUserDetails instance +func NewAppUnlinkUserDetails(AppInfo IsAppLogInfo) *AppUnlinkUserDetails { + s := new(AppUnlinkUserDetails) + s.AppInfo = AppInfo + return s +} + +// AssetLogInfo : Asset details. +type AssetLogInfo struct { + dropbox.Tagged + // File : File's details. + File *FileLogInfo `json:"file,omitempty"` + // Folder : Folder's details. + Folder *FolderLogInfo `json:"folder,omitempty"` + // PaperDocument : Paper docuement's details. + PaperDocument *PaperDocumentLogInfo `json:"paper_document,omitempty"` + // PaperFolder : Paper folder's details. + PaperFolder *PaperFolderLogInfo `json:"paper_folder,omitempty"` +} + +// Valid tag values for AssetLogInfo +const ( + AssetLogInfoFile = "file" + AssetLogInfoFolder = "folder" + AssetLogInfoPaperDocument = "paper_document" + AssetLogInfoPaperFolder = "paper_folder" + AssetLogInfoOther = "other" +) + +// UnmarshalJSON deserializes into a AssetLogInfo instance +func (u *AssetLogInfo) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // File : File's details. + File json.RawMessage `json:"file,omitempty"` + // Folder : Folder's details. + Folder json.RawMessage `json:"folder,omitempty"` + // PaperDocument : Paper docuement's details. + PaperDocument json.RawMessage `json:"paper_document,omitempty"` + // PaperFolder : Paper folder's details. + PaperFolder json.RawMessage `json:"paper_folder,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 "file": + err = json.Unmarshal(body, &u.File) + + if err != nil { + return err + } + case "folder": + err = json.Unmarshal(body, &u.Folder) + + if err != nil { + return err + } + case "paper_document": + err = json.Unmarshal(body, &u.PaperDocument) + + if err != nil { + return err + } + case "paper_folder": + err = json.Unmarshal(body, &u.PaperFolder) + + if err != nil { + return err + } + } + return nil +} + +// Certificate : Certificate details. +type Certificate struct { + // Subject : Certificate subject. + Subject string `json:"subject"` + // Issuer : Certificate issuer. + Issuer string `json:"issuer"` + // IssueDate : Certificate issue date. + IssueDate string `json:"issue_date"` + // ExpirationDate : Certificate expiration date. + ExpirationDate string `json:"expiration_date"` + // SerialNumber : Certificate serial number. + SerialNumber string `json:"serial_number"` + // Sha1Fingerprint : Certificate sha1 fingerprint. + Sha1Fingerprint string `json:"sha1_fingerprint"` + // CommonName : Certificate common name. + CommonName string `json:"common_name"` +} + +// NewCertificate returns a new Certificate instance +func NewCertificate(Subject string, Issuer string, IssueDate string, ExpirationDate string, SerialNumber string, Sha1Fingerprint string, CommonName string) *Certificate { + s := new(Certificate) + s.Subject = Subject + s.Issuer = Issuer + s.IssueDate = IssueDate + s.ExpirationDate = ExpirationDate + s.SerialNumber = SerialNumber + s.Sha1Fingerprint = Sha1Fingerprint + s.CommonName = CommonName + return s +} + +// CollectionShareDetails : Shared an album. +type CollectionShareDetails struct { + // AlbumName : Album name. + AlbumName string `json:"album_name"` +} + +// NewCollectionShareDetails returns a new CollectionShareDetails instance +func NewCollectionShareDetails(AlbumName string) *CollectionShareDetails { + s := new(CollectionShareDetails) + s.AlbumName = AlbumName + return s +} + +// Confidentiality : has no documentation (yet) +type Confidentiality struct { + dropbox.Tagged +} + +// Valid tag values for Confidentiality +const ( + ConfidentialityConfidential = "confidential" + ConfidentialityNonConfidential = "non_confidential" + ConfidentialityOther = "other" +) + +// ContentPermanentDeletePolicy : Policy for pemanent content deletion +type ContentPermanentDeletePolicy struct { + dropbox.Tagged +} + +// Valid tag values for ContentPermanentDeletePolicy +const ( + ContentPermanentDeletePolicyDisabled = "disabled" + ContentPermanentDeletePolicyEnabled = "enabled" + ContentPermanentDeletePolicyOther = "other" +) + +// ContextLogInfo : The primary entity on which the action was done. +type ContextLogInfo struct { + dropbox.Tagged + // TeamMember : Action was done on behalf of a team member. + TeamMember *TeamMemberLogInfo `json:"team_member,omitempty"` + // NonTeamMember : Action was done on behalf of a non team member. + NonTeamMember *NonTeamMemberLogInfo `json:"non_team_member,omitempty"` +} + +// Valid tag values for ContextLogInfo +const ( + ContextLogInfoTeamMember = "team_member" + ContextLogInfoNonTeamMember = "non_team_member" + ContextLogInfoTeam = "team" + ContextLogInfoOther = "other" +) + +// UnmarshalJSON deserializes into a ContextLogInfo instance +func (u *ContextLogInfo) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // TeamMember : Action was done on behalf of a team member. + TeamMember json.RawMessage `json:"team_member,omitempty"` + // NonTeamMember : Action was done on behalf of a non team member. + NonTeamMember json.RawMessage `json:"non_team_member,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 "team_member": + err = json.Unmarshal(body, &u.TeamMember) + + if err != nil { + return err + } + case "non_team_member": + err = json.Unmarshal(body, &u.NonTeamMember) + + if err != nil { + return err + } + } + return nil +} + +// CreateFolderDetails : Created folders. +type CreateFolderDetails struct { +} + +// NewCreateFolderDetails returns a new CreateFolderDetails instance +func NewCreateFolderDetails() *CreateFolderDetails { + s := new(CreateFolderDetails) + return s +} + +// DataPlacementRestrictionChangePolicyDetails : Set a restriction policy +// regarding the location of data centers where team data resides. +type DataPlacementRestrictionChangePolicyDetails struct { + // PreviousValue : Previous placement restriction. + PreviousValue *PlacementRestriction `json:"previous_value"` + // NewValue : New placement restriction. + NewValue *PlacementRestriction `json:"new_value"` +} + +// NewDataPlacementRestrictionChangePolicyDetails returns a new DataPlacementRestrictionChangePolicyDetails instance +func NewDataPlacementRestrictionChangePolicyDetails(PreviousValue *PlacementRestriction, NewValue *PlacementRestriction) *DataPlacementRestrictionChangePolicyDetails { + s := new(DataPlacementRestrictionChangePolicyDetails) + s.PreviousValue = PreviousValue + s.NewValue = NewValue + return s +} + +// DataPlacementRestrictionSatisfyPolicyDetails : Satisfied a previously set +// restriction policy regarding the location of data centers where team data +// resides (i.e. all data have been migrated according to the restriction +// placed). +type DataPlacementRestrictionSatisfyPolicyDetails struct { + // PlacementRestriction : Placement restriction. + PlacementRestriction *PlacementRestriction `json:"placement_restriction"` +} + +// NewDataPlacementRestrictionSatisfyPolicyDetails returns a new DataPlacementRestrictionSatisfyPolicyDetails instance +func NewDataPlacementRestrictionSatisfyPolicyDetails(PlacementRestriction *PlacementRestriction) *DataPlacementRestrictionSatisfyPolicyDetails { + s := new(DataPlacementRestrictionSatisfyPolicyDetails) + s.PlacementRestriction = PlacementRestriction + return s +} + +// SessionLogInfo : Session's logged information. +type SessionLogInfo struct { + // SessionId : Session ID. Might be missing due to historical data gap. + SessionId string `json:"session_id,omitempty"` +} + +// NewSessionLogInfo returns a new SessionLogInfo instance +func NewSessionLogInfo() *SessionLogInfo { + s := new(SessionLogInfo) + return s +} + +// IsSessionLogInfo is the interface type for SessionLogInfo and its subtypes +type IsSessionLogInfo interface { + IsSessionLogInfo() +} + +// IsSessionLogInfo implements the IsSessionLogInfo interface +func (u *SessionLogInfo) IsSessionLogInfo() {} + +type sessionLogInfoUnion struct { + dropbox.Tagged + // Web : has no documentation (yet) + Web *WebSessionLogInfo `json:"web,omitempty"` + // Desktop : has no documentation (yet) + Desktop *DesktopSessionLogInfo `json:"desktop,omitempty"` + // Mobile : has no documentation (yet) + Mobile *MobileSessionLogInfo `json:"mobile,omitempty"` +} + +// Valid tag values for SessionLogInfo +const ( + SessionLogInfoWeb = "web" + SessionLogInfoDesktop = "desktop" + SessionLogInfoMobile = "mobile" +) + +// UnmarshalJSON deserializes into a sessionLogInfoUnion instance +func (u *sessionLogInfoUnion) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Web : has no documentation (yet) + Web json.RawMessage `json:"web,omitempty"` + // Desktop : has no documentation (yet) + Desktop json.RawMessage `json:"desktop,omitempty"` + // Mobile : has no documentation (yet) + Mobile json.RawMessage `json:"mobile,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 "web": + err = json.Unmarshal(body, &u.Web) + + if err != nil { + return err + } + case "desktop": + err = json.Unmarshal(body, &u.Desktop) + + if err != nil { + return err + } + case "mobile": + err = json.Unmarshal(body, &u.Mobile) + + if err != nil { + return err + } + } + return nil +} + +// IsSessionLogInfoFromJSON converts JSON to a concrete IsSessionLogInfo instance +func IsSessionLogInfoFromJSON(data []byte) (IsSessionLogInfo, error) { + var t sessionLogInfoUnion + if err := json.Unmarshal(data, &t); err != nil { + return nil, err + } + switch t.Tag { + case "web": + return t.Web, nil + + case "desktop": + return t.Desktop, nil + + case "mobile": + return t.Mobile, nil + + } + return nil, nil +} + +// DesktopSessionLogInfo : Desktop session. +type DesktopSessionLogInfo struct { + SessionLogInfo +} + +// NewDesktopSessionLogInfo returns a new DesktopSessionLogInfo instance +func NewDesktopSessionLogInfo() *DesktopSessionLogInfo { + s := new(DesktopSessionLogInfo) + return s +} + +// DeviceApprovalsChangeDesktopPolicyDetails : Set or removed a limit on the +// number of computers each team member can link to their work Dropbox account. +type DeviceApprovalsChangeDesktopPolicyDetails struct { + // NewValue : New desktop device approvals policy. Might be missing due to + // historical data gap. + NewValue *DeviceApprovalsPolicy `json:"new_value,omitempty"` + // PreviousValue : Previous desktop device approvals policy. Might be + // missing due to historical data gap. + PreviousValue *DeviceApprovalsPolicy `json:"previous_value,omitempty"` +} + +// NewDeviceApprovalsChangeDesktopPolicyDetails returns a new DeviceApprovalsChangeDesktopPolicyDetails instance +func NewDeviceApprovalsChangeDesktopPolicyDetails() *DeviceApprovalsChangeDesktopPolicyDetails { + s := new(DeviceApprovalsChangeDesktopPolicyDetails) + return s +} + +// DeviceApprovalsChangeMobilePolicyDetails : Set or removed a limit on the +// number of mobiles devices each team member can link to their work Dropbox +// account. +type DeviceApprovalsChangeMobilePolicyDetails struct { + // NewValue : New mobile device approvals policy. Might be missing due to + // historical data gap. + NewValue *DeviceApprovalsPolicy `json:"new_value,omitempty"` + // PreviousValue : Previous mobile device approvals policy. Might be missing + // due to historical data gap. + PreviousValue *DeviceApprovalsPolicy `json:"previous_value,omitempty"` +} + +// NewDeviceApprovalsChangeMobilePolicyDetails returns a new DeviceApprovalsChangeMobilePolicyDetails instance +func NewDeviceApprovalsChangeMobilePolicyDetails() *DeviceApprovalsChangeMobilePolicyDetails { + s := new(DeviceApprovalsChangeMobilePolicyDetails) + return s +} + +// DeviceApprovalsChangeOverageActionDetails : Changed the action taken when a +// team member is already over the limits (e.g when they join the team, an admin +// lowers limits, etc.). +type DeviceApprovalsChangeOverageActionDetails struct { + // NewValue : New over the limits policy. Might be missing due to historical + // data gap. + NewValue *DeviceApprovalsRolloutPolicy `json:"new_value,omitempty"` + // PreviousValue : Previous over the limit policy. Might be missing due to + // historical data gap. + PreviousValue *DeviceApprovalsRolloutPolicy `json:"previous_value,omitempty"` +} + +// NewDeviceApprovalsChangeOverageActionDetails returns a new DeviceApprovalsChangeOverageActionDetails instance +func NewDeviceApprovalsChangeOverageActionDetails() *DeviceApprovalsChangeOverageActionDetails { + s := new(DeviceApprovalsChangeOverageActionDetails) + return s +} + +// DeviceApprovalsChangeUnlinkActionDetails : Changed the action taken with +// respect to approval limits when a team member unlinks an approved device. +type DeviceApprovalsChangeUnlinkActionDetails struct { + // NewValue : New device unlink policy. Might be missing due to historical + // data gap. + NewValue *DeviceUnlinkPolicy `json:"new_value,omitempty"` + // PreviousValue : Previous device unlink policy. Might be missing due to + // historical data gap. + PreviousValue *DeviceUnlinkPolicy `json:"previous_value,omitempty"` +} + +// NewDeviceApprovalsChangeUnlinkActionDetails returns a new DeviceApprovalsChangeUnlinkActionDetails instance +func NewDeviceApprovalsChangeUnlinkActionDetails() *DeviceApprovalsChangeUnlinkActionDetails { + s := new(DeviceApprovalsChangeUnlinkActionDetails) + return s +} + +// DeviceApprovalsPolicy : has no documentation (yet) +type DeviceApprovalsPolicy struct { + dropbox.Tagged +} + +// Valid tag values for DeviceApprovalsPolicy +const ( + DeviceApprovalsPolicyUnlimited = "unlimited" + DeviceApprovalsPolicyLimited = "limited" + DeviceApprovalsPolicyOther = "other" +) + +// DeviceApprovalsRolloutPolicy : has no documentation (yet) +type DeviceApprovalsRolloutPolicy struct { + dropbox.Tagged +} + +// Valid tag values for DeviceApprovalsRolloutPolicy +const ( + DeviceApprovalsRolloutPolicyRemoveOldest = "remove_oldest" + DeviceApprovalsRolloutPolicyRemoveAll = "remove_all" + DeviceApprovalsRolloutPolicyAddException = "add_exception" + DeviceApprovalsRolloutPolicyOther = "other" +) + +// DeviceChangeIpDesktopDetails : IP address associated with active desktop +// session changed. +type DeviceChangeIpDesktopDetails struct { + // DeviceInfo : Device information. + DeviceInfo *DeviceLogInfo `json:"device_info"` +} + +// NewDeviceChangeIpDesktopDetails returns a new DeviceChangeIpDesktopDetails instance +func NewDeviceChangeIpDesktopDetails(DeviceInfo *DeviceLogInfo) *DeviceChangeIpDesktopDetails { + s := new(DeviceChangeIpDesktopDetails) + s.DeviceInfo = DeviceInfo + return s +} + +// DeviceChangeIpMobileDetails : IP address associated with active mobile +// session changed. +type DeviceChangeIpMobileDetails struct { + // DeviceInfo : Device information. + DeviceInfo *DeviceLogInfo `json:"device_info"` +} + +// NewDeviceChangeIpMobileDetails returns a new DeviceChangeIpMobileDetails instance +func NewDeviceChangeIpMobileDetails(DeviceInfo *DeviceLogInfo) *DeviceChangeIpMobileDetails { + s := new(DeviceChangeIpMobileDetails) + s.DeviceInfo = DeviceInfo + return s +} + +// DeviceChangeIpWebDetails : IP address associated with active Web session +// changed. +type DeviceChangeIpWebDetails struct { + // DeviceInfo : Device information. Might be missing due to historical data + // gap. + DeviceInfo *DeviceLogInfo `json:"device_info,omitempty"` + // UserAgent : Web browser name. + UserAgent string `json:"user_agent"` +} + +// NewDeviceChangeIpWebDetails returns a new DeviceChangeIpWebDetails instance +func NewDeviceChangeIpWebDetails(UserAgent string) *DeviceChangeIpWebDetails { + s := new(DeviceChangeIpWebDetails) + s.UserAgent = UserAgent + return s +} + +// DeviceDeleteOnUnlinkFailDetails : Failed to delete all files from an unlinked +// device. +type DeviceDeleteOnUnlinkFailDetails struct { + // DeviceInfo : Device information. + DeviceInfo *DeviceLogInfo `json:"device_info"` + // NumFailures : The number of times that remote file deletion failed. + NumFailures int64 `json:"num_failures"` +} + +// NewDeviceDeleteOnUnlinkFailDetails returns a new DeviceDeleteOnUnlinkFailDetails instance +func NewDeviceDeleteOnUnlinkFailDetails(DeviceInfo *DeviceLogInfo, NumFailures int64) *DeviceDeleteOnUnlinkFailDetails { + s := new(DeviceDeleteOnUnlinkFailDetails) + s.DeviceInfo = DeviceInfo + s.NumFailures = NumFailures + return s +} + +// DeviceDeleteOnUnlinkSuccessDetails : Deleted all files from an unlinked +// device. +type DeviceDeleteOnUnlinkSuccessDetails struct { + // DeviceInfo : Device information. + DeviceInfo *DeviceLogInfo `json:"device_info"` +} + +// NewDeviceDeleteOnUnlinkSuccessDetails returns a new DeviceDeleteOnUnlinkSuccessDetails instance +func NewDeviceDeleteOnUnlinkSuccessDetails(DeviceInfo *DeviceLogInfo) *DeviceDeleteOnUnlinkSuccessDetails { + s := new(DeviceDeleteOnUnlinkSuccessDetails) + s.DeviceInfo = DeviceInfo + return s +} + +// DeviceLinkFailDetails : Failed to link a device. +type DeviceLinkFailDetails struct { + // DeviceInfo : Device information. Might be missing due to historical data + // gap. + DeviceInfo *DeviceLogInfo `json:"device_info,omitempty"` + // DeviceType : A description of the device used while user approval + // blocked. + DeviceType *DeviceType `json:"device_type"` +} + +// NewDeviceLinkFailDetails returns a new DeviceLinkFailDetails instance +func NewDeviceLinkFailDetails(DeviceType *DeviceType) *DeviceLinkFailDetails { + s := new(DeviceLinkFailDetails) + s.DeviceType = DeviceType + return s +} + +// DeviceLinkSuccessDetails : Linked a device. +type DeviceLinkSuccessDetails struct { + // DeviceInfo : Device information. + DeviceInfo *DeviceLogInfo `json:"device_info"` +} + +// NewDeviceLinkSuccessDetails returns a new DeviceLinkSuccessDetails instance +func NewDeviceLinkSuccessDetails(DeviceInfo *DeviceLogInfo) *DeviceLinkSuccessDetails { + s := new(DeviceLinkSuccessDetails) + s.DeviceInfo = DeviceInfo + return s +} + +// DeviceLogInfo : Device's logged information. +type DeviceLogInfo struct { + // DeviceId : Device unique id. Might be missing due to historical data gap. + DeviceId string `json:"device_id,omitempty"` + // DisplayName : Device display name. Might be missing due to historical + // data gap. + DisplayName string `json:"display_name,omitempty"` + // IsEmmManaged : True if this device is emm managed, false otherwise. Might + // be missing due to historical data gap. + IsEmmManaged bool `json:"is_emm_managed,omitempty"` + // Platform : Device platform name. Might be missing due to historical data + // gap. + Platform string `json:"platform,omitempty"` + // MacAddress : Device mac address. Might be missing due to historical data + // gap. + MacAddress string `json:"mac_address,omitempty"` + // OsVersion : Device OS version. Might be missing due to historical data + // gap. + OsVersion string `json:"os_version,omitempty"` + // DeviceType : Device type. Might be missing due to historical data gap. + DeviceType string `json:"device_type,omitempty"` + // IpAddress : IP address. Might be missing due to historical data gap. + IpAddress string `json:"ip_address,omitempty"` + // LastActivity : Last activity. Might be missing due to historical data + // gap. + LastActivity string `json:"last_activity,omitempty"` + // AppVersion : Linking app version. Might be missing due to historical data + // gap. + AppVersion string `json:"app_version,omitempty"` +} + +// NewDeviceLogInfo returns a new DeviceLogInfo instance +func NewDeviceLogInfo() *DeviceLogInfo { + s := new(DeviceLogInfo) + return s +} + +// DeviceManagementDisabledDetails : Disable Device Management. +type DeviceManagementDisabledDetails struct { +} + +// NewDeviceManagementDisabledDetails returns a new DeviceManagementDisabledDetails instance +func NewDeviceManagementDisabledDetails() *DeviceManagementDisabledDetails { + s := new(DeviceManagementDisabledDetails) + return s +} + +// DeviceManagementEnabledDetails : Enable Device Management. +type DeviceManagementEnabledDetails struct { +} + +// NewDeviceManagementEnabledDetails returns a new DeviceManagementEnabledDetails instance +func NewDeviceManagementEnabledDetails() *DeviceManagementEnabledDetails { + s := new(DeviceManagementEnabledDetails) + return s +} + +// DeviceType : has no documentation (yet) +type DeviceType struct { + dropbox.Tagged +} + +// Valid tag values for DeviceType +const ( + DeviceTypeDesktop = "desktop" + DeviceTypeMobile = "mobile" + DeviceTypeOther = "other" +) + +// DeviceUnlinkDetails : Disconnected a device. +type DeviceUnlinkDetails struct { + // DeviceInfo : Device information. + DeviceInfo *DeviceLogInfo `json:"device_info"` + // DeleteData : True if the user requested to delete data after device + // unlink, false otherwise. + DeleteData bool `json:"delete_data"` +} + +// NewDeviceUnlinkDetails returns a new DeviceUnlinkDetails instance +func NewDeviceUnlinkDetails(DeviceInfo *DeviceLogInfo, DeleteData bool) *DeviceUnlinkDetails { + s := new(DeviceUnlinkDetails) + s.DeviceInfo = DeviceInfo + s.DeleteData = DeleteData + return s +} + +// DeviceUnlinkPolicy : has no documentation (yet) +type DeviceUnlinkPolicy struct { + dropbox.Tagged +} + +// Valid tag values for DeviceUnlinkPolicy +const ( + DeviceUnlinkPolicyRemove = "remove" + DeviceUnlinkPolicyKeep = "keep" + DeviceUnlinkPolicyOther = "other" +) + +// DisabledDomainInvitesDetails : Disabled domain invites. +type DisabledDomainInvitesDetails struct { +} + +// NewDisabledDomainInvitesDetails returns a new DisabledDomainInvitesDetails instance +func NewDisabledDomainInvitesDetails() *DisabledDomainInvitesDetails { + s := new(DisabledDomainInvitesDetails) + return s +} + +// DomainInvitesApproveRequestToJoinTeamDetails : Approved a member's request to +// join the team. +type DomainInvitesApproveRequestToJoinTeamDetails struct { +} + +// NewDomainInvitesApproveRequestToJoinTeamDetails returns a new DomainInvitesApproveRequestToJoinTeamDetails instance +func NewDomainInvitesApproveRequestToJoinTeamDetails() *DomainInvitesApproveRequestToJoinTeamDetails { + s := new(DomainInvitesApproveRequestToJoinTeamDetails) + return s +} + +// DomainInvitesDeclineRequestToJoinTeamDetails : Declined a user's request to +// join the team. +type DomainInvitesDeclineRequestToJoinTeamDetails struct { +} + +// NewDomainInvitesDeclineRequestToJoinTeamDetails returns a new DomainInvitesDeclineRequestToJoinTeamDetails instance +func NewDomainInvitesDeclineRequestToJoinTeamDetails() *DomainInvitesDeclineRequestToJoinTeamDetails { + s := new(DomainInvitesDeclineRequestToJoinTeamDetails) + return s +} + +// DomainInvitesEmailExistingUsersDetails : Sent domain invites to existing +// domain accounts. +type DomainInvitesEmailExistingUsersDetails struct { + // DomainName : Domain names. + DomainName []string `json:"domain_name"` + // NumRecipients : Number of recipients. + NumRecipients uint64 `json:"num_recipients"` +} + +// NewDomainInvitesEmailExistingUsersDetails returns a new DomainInvitesEmailExistingUsersDetails instance +func NewDomainInvitesEmailExistingUsersDetails(DomainName []string, NumRecipients uint64) *DomainInvitesEmailExistingUsersDetails { + s := new(DomainInvitesEmailExistingUsersDetails) + s.DomainName = DomainName + s.NumRecipients = NumRecipients + return s +} + +// DomainInvitesRequestToJoinTeamDetails : Asked to join the team. +type DomainInvitesRequestToJoinTeamDetails struct { +} + +// NewDomainInvitesRequestToJoinTeamDetails returns a new DomainInvitesRequestToJoinTeamDetails instance +func NewDomainInvitesRequestToJoinTeamDetails() *DomainInvitesRequestToJoinTeamDetails { + s := new(DomainInvitesRequestToJoinTeamDetails) + return s +} + +// DomainInvitesSetInviteNewUserPrefToNoDetails : Turned off u201cAutomatically +// invite new usersu201d. +type DomainInvitesSetInviteNewUserPrefToNoDetails struct { +} + +// NewDomainInvitesSetInviteNewUserPrefToNoDetails returns a new DomainInvitesSetInviteNewUserPrefToNoDetails instance +func NewDomainInvitesSetInviteNewUserPrefToNoDetails() *DomainInvitesSetInviteNewUserPrefToNoDetails { + s := new(DomainInvitesSetInviteNewUserPrefToNoDetails) + return s +} + +// DomainInvitesSetInviteNewUserPrefToYesDetails : Turned on u201cAutomatically +// invite new usersu201d. +type DomainInvitesSetInviteNewUserPrefToYesDetails struct { +} + +// NewDomainInvitesSetInviteNewUserPrefToYesDetails returns a new DomainInvitesSetInviteNewUserPrefToYesDetails instance +func NewDomainInvitesSetInviteNewUserPrefToYesDetails() *DomainInvitesSetInviteNewUserPrefToYesDetails { + s := new(DomainInvitesSetInviteNewUserPrefToYesDetails) + return s +} + +// DomainVerificationAddDomainFailDetails : Failed to verify a domain belonging +// to the team. +type DomainVerificationAddDomainFailDetails struct { + // DomainName : Domain name. + DomainName string `json:"domain_name"` + // VerificationMethod : Domain name verification method. Might be missing + // due to historical data gap. + VerificationMethod string `json:"verification_method,omitempty"` +} + +// NewDomainVerificationAddDomainFailDetails returns a new DomainVerificationAddDomainFailDetails instance +func NewDomainVerificationAddDomainFailDetails(DomainName string) *DomainVerificationAddDomainFailDetails { + s := new(DomainVerificationAddDomainFailDetails) + s.DomainName = DomainName + return s +} + +// DomainVerificationAddDomainSuccessDetails : Verified a domain belonging to +// the team. +type DomainVerificationAddDomainSuccessDetails 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"` +} + +// NewDomainVerificationAddDomainSuccessDetails returns a new DomainVerificationAddDomainSuccessDetails instance +func NewDomainVerificationAddDomainSuccessDetails(DomainNames []string) *DomainVerificationAddDomainSuccessDetails { + s := new(DomainVerificationAddDomainSuccessDetails) + s.DomainNames = DomainNames + return s +} + +// DomainVerificationRemoveDomainDetails : Removed a domain from the list of +// verified domains belonging to the team. +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 +func NewDomainVerificationRemoveDomainDetails(DomainNames []string) *DomainVerificationRemoveDomainDetails { + s := new(DomainVerificationRemoveDomainDetails) + s.DomainNames = DomainNames + return s +} + +// DurationLogInfo : Represents a time duration: unit and amount +type DurationLogInfo struct { + // Unit : Time unit. + Unit *TimeUnit `json:"unit"` + // Amount : Amount of time. + Amount uint64 `json:"amount"` +} + +// NewDurationLogInfo returns a new DurationLogInfo instance +func NewDurationLogInfo(Unit *TimeUnit, Amount uint64) *DurationLogInfo { + s := new(DurationLogInfo) + s.Unit = Unit + s.Amount = Amount + return s +} + +// EmmAddExceptionDetails : Added an exception for one or more team members to +// optionally use the regular Dropbox app when EMM is enabled. +type EmmAddExceptionDetails struct { +} + +// NewEmmAddExceptionDetails returns a new EmmAddExceptionDetails instance +func NewEmmAddExceptionDetails() *EmmAddExceptionDetails { + s := new(EmmAddExceptionDetails) + return s +} + +// EmmChangePolicyDetails : Enabled or disabled enterprise mobility management +// for team members. +type EmmChangePolicyDetails struct { + // NewValue : New enterprise mobility management policy. + NewValue *EmmPolicy `json:"new_value"` + // PreviousValue : Previous enterprise mobility management policy. Might be + // missing due to historical data gap. + PreviousValue *EmmPolicy `json:"previous_value,omitempty"` +} + +// NewEmmChangePolicyDetails returns a new EmmChangePolicyDetails instance +func NewEmmChangePolicyDetails(NewValue *EmmPolicy) *EmmChangePolicyDetails { + s := new(EmmChangePolicyDetails) + s.NewValue = NewValue + return s +} + +// EmmCreateExceptionsReportDetails : EMM excluded users report created. +type EmmCreateExceptionsReportDetails struct { +} + +// NewEmmCreateExceptionsReportDetails returns a new EmmCreateExceptionsReportDetails instance +func NewEmmCreateExceptionsReportDetails() *EmmCreateExceptionsReportDetails { + s := new(EmmCreateExceptionsReportDetails) + return s +} + +// EmmCreateUsageReportDetails : EMM mobile app usage report created. +type EmmCreateUsageReportDetails struct { +} + +// NewEmmCreateUsageReportDetails returns a new EmmCreateUsageReportDetails instance +func NewEmmCreateUsageReportDetails() *EmmCreateUsageReportDetails { + s := new(EmmCreateUsageReportDetails) + return s +} + +// EmmLoginSuccessDetails : Signed in using the Dropbox EMM app. +type EmmLoginSuccessDetails struct { +} + +// NewEmmLoginSuccessDetails returns a new EmmLoginSuccessDetails instance +func NewEmmLoginSuccessDetails() *EmmLoginSuccessDetails { + s := new(EmmLoginSuccessDetails) + return s +} + +// EmmPolicy : Enterprise mobility management policy +type EmmPolicy struct { + dropbox.Tagged +} + +// Valid tag values for EmmPolicy +const ( + EmmPolicyDisabled = "disabled" + EmmPolicyOptional = "optional" + EmmPolicyRequired = "required" + EmmPolicyOther = "other" +) + +// EmmRefreshAuthTokenDetails : Refreshed the auth token used for setting up +// enterprise mobility management. +type EmmRefreshAuthTokenDetails struct { +} + +// NewEmmRefreshAuthTokenDetails returns a new EmmRefreshAuthTokenDetails instance +func NewEmmRefreshAuthTokenDetails() *EmmRefreshAuthTokenDetails { + s := new(EmmRefreshAuthTokenDetails) + return s +} + +// EmmRemoveExceptionDetails : Removed an exception for one or more team members +// to optionally use the regular Dropbox app when EMM is enabled. +type EmmRemoveExceptionDetails struct { +} + +// NewEmmRemoveExceptionDetails returns a new EmmRemoveExceptionDetails instance +func NewEmmRemoveExceptionDetails() *EmmRemoveExceptionDetails { + s := new(EmmRemoveExceptionDetails) + return s +} + +// EnabledDomainInvitesDetails : Enabled domain invites. +type EnabledDomainInvitesDetails struct { +} + +// NewEnabledDomainInvitesDetails returns a new EnabledDomainInvitesDetails instance +func NewEnabledDomainInvitesDetails() *EnabledDomainInvitesDetails { + s := new(EnabledDomainInvitesDetails) + return s +} + +// EventCategory : Category of events in event audit log. +type EventCategory struct { + dropbox.Tagged +} + +// Valid tag values for EventCategory +const ( + EventCategoryAccountCapture = "account_capture" + EventCategoryAdministration = "administration" + EventCategoryApps = "apps" + EventCategoryAuthentication = "authentication" + EventCategoryComments = "comments" + EventCategoryContentAccess = "content_access" + EventCategoryDevices = "devices" + EventCategoryDeviceApprovals = "device_approvals" + EventCategoryDomains = "domains" + EventCategoryEmm = "emm" + EventCategoryErrors = "errors" + EventCategoryFiles = "files" + EventCategoryFileOperations = "file_operations" + EventCategoryFileRequests = "file_requests" + EventCategoryGroups = "groups" + EventCategoryLogins = "logins" + EventCategoryMembers = "members" + EventCategoryPaper = "paper" + EventCategoryPasswords = "passwords" + EventCategoryReports = "reports" + EventCategorySessions = "sessions" + EventCategorySharedFiles = "shared_files" + EventCategorySharedFolders = "shared_folders" + EventCategorySharedLinks = "shared_links" + EventCategorySharing = "sharing" + EventCategorySharingPolicies = "sharing_policies" + EventCategorySso = "sso" + EventCategoryTeamFolders = "team_folders" + EventCategoryTeamPolicies = "team_policies" + EventCategoryTeamProfile = "team_profile" + EventCategoryTfa = "tfa" + EventCategoryOther = "other" +) + +// EventDetails : Additional fields depending on the event type. +type EventDetails struct { + dropbox.Tagged + // MemberChangeMembershipTypeDetails : Changed the membership type (limited + // vs full) for team member. + MemberChangeMembershipTypeDetails *MemberChangeMembershipTypeDetails `json:"member_change_membership_type_details,omitempty"` + // MemberPermanentlyDeleteAccountContentsDetails : Permanently deleted + // contents of a removed team member account. + MemberPermanentlyDeleteAccountContentsDetails *MemberPermanentlyDeleteAccountContentsDetails `json:"member_permanently_delete_account_contents_details,omitempty"` + // MemberSpaceLimitsChangeStatusDetails : Changed the status with respect to + // whether the team member is under or over storage quota specified by + // policy. + MemberSpaceLimitsChangeStatusDetails *MemberSpaceLimitsChangeStatusDetails `json:"member_space_limits_change_status_details,omitempty"` + // MemberTransferAccountContentsDetails : Transferred contents of a removed + // team member account to another member. + MemberTransferAccountContentsDetails *MemberTransferAccountContentsDetails `json:"member_transfer_account_contents_details,omitempty"` + // PaperEnabledUsersGroupAdditionDetails : Users added to Paper enabled + // users list. + PaperEnabledUsersGroupAdditionDetails *PaperEnabledUsersGroupAdditionDetails `json:"paper_enabled_users_group_addition_details,omitempty"` + // PaperEnabledUsersGroupRemovalDetails : Users removed from Paper enabled + // users list. + PaperEnabledUsersGroupRemovalDetails *PaperEnabledUsersGroupRemovalDetails `json:"paper_enabled_users_group_removal_details,omitempty"` + // PaperExternalViewAllowDetails : Paper external sharing policy changed: + // anyone. + PaperExternalViewAllowDetails *PaperExternalViewAllowDetails `json:"paper_external_view_allow_details,omitempty"` + // PaperExternalViewDefaultTeamDetails : Paper external sharing policy + // changed: default team. + PaperExternalViewDefaultTeamDetails *PaperExternalViewDefaultTeamDetails `json:"paper_external_view_default_team_details,omitempty"` + // PaperExternalViewForbidDetails : Paper external sharing policy changed: + // team-only. + PaperExternalViewForbidDetails *PaperExternalViewForbidDetails `json:"paper_external_view_forbid_details,omitempty"` + // SfExternalInviteWarnDetails : Admin settings: team members see a warning + // before sharing folders outside the team (DEPRECATED FEATURE). + SfExternalInviteWarnDetails *SfExternalInviteWarnDetails `json:"sf_external_invite_warn_details,omitempty"` + // TeamMergeFromDetails : Merged another team into this team. + TeamMergeFromDetails *TeamMergeFromDetails `json:"team_merge_from_details,omitempty"` + // TeamMergeToDetails : Merged this team into another team. + TeamMergeToDetails *TeamMergeToDetails `json:"team_merge_to_details,omitempty"` + // AppLinkTeamDetails : Linked an app for team. + AppLinkTeamDetails *AppLinkTeamDetails `json:"app_link_team_details,omitempty"` + // AppLinkUserDetails : Linked an app for team member. + AppLinkUserDetails *AppLinkUserDetails `json:"app_link_user_details,omitempty"` + // AppUnlinkTeamDetails : Unlinked an app for team. + AppUnlinkTeamDetails *AppUnlinkTeamDetails `json:"app_unlink_team_details,omitempty"` + // AppUnlinkUserDetails : Unlinked an app for team member. + AppUnlinkUserDetails *AppUnlinkUserDetails `json:"app_unlink_user_details,omitempty"` + // DeviceChangeIpDesktopDetails : IP address associated with active desktop + // session changed. + DeviceChangeIpDesktopDetails *DeviceChangeIpDesktopDetails `json:"device_change_ip_desktop_details,omitempty"` + // DeviceChangeIpMobileDetails : IP address associated with active mobile + // session changed. + DeviceChangeIpMobileDetails *DeviceChangeIpMobileDetails `json:"device_change_ip_mobile_details,omitempty"` + // DeviceChangeIpWebDetails : IP address associated with active Web session + // changed. + DeviceChangeIpWebDetails *DeviceChangeIpWebDetails `json:"device_change_ip_web_details,omitempty"` + // DeviceDeleteOnUnlinkFailDetails : Failed to delete all files from an + // unlinked device. + DeviceDeleteOnUnlinkFailDetails *DeviceDeleteOnUnlinkFailDetails `json:"device_delete_on_unlink_fail_details,omitempty"` + // DeviceDeleteOnUnlinkSuccessDetails : Deleted all files from an unlinked + // device. + DeviceDeleteOnUnlinkSuccessDetails *DeviceDeleteOnUnlinkSuccessDetails `json:"device_delete_on_unlink_success_details,omitempty"` + // DeviceLinkFailDetails : Failed to link a device. + DeviceLinkFailDetails *DeviceLinkFailDetails `json:"device_link_fail_details,omitempty"` + // DeviceLinkSuccessDetails : Linked a device. + DeviceLinkSuccessDetails *DeviceLinkSuccessDetails `json:"device_link_success_details,omitempty"` + // DeviceManagementDisabledDetails : Disable Device Management. + DeviceManagementDisabledDetails *DeviceManagementDisabledDetails `json:"device_management_disabled_details,omitempty"` + // DeviceManagementEnabledDetails : Enable Device Management. + DeviceManagementEnabledDetails *DeviceManagementEnabledDetails `json:"device_management_enabled_details,omitempty"` + // DeviceUnlinkDetails : Disconnected a device. + DeviceUnlinkDetails *DeviceUnlinkDetails `json:"device_unlink_details,omitempty"` + // EmmRefreshAuthTokenDetails : Refreshed the auth token used for setting up + // enterprise mobility management. + EmmRefreshAuthTokenDetails *EmmRefreshAuthTokenDetails `json:"emm_refresh_auth_token_details,omitempty"` + // AccountCaptureChangeAvailabilityDetails : Granted or revoked the option + // to enable account capture on domains belonging to the team. + AccountCaptureChangeAvailabilityDetails *AccountCaptureChangeAvailabilityDetails `json:"account_capture_change_availability_details,omitempty"` + // AccountCaptureMigrateAccountDetails : Account captured user migrated + // their account to the team. + AccountCaptureMigrateAccountDetails *AccountCaptureMigrateAccountDetails `json:"account_capture_migrate_account_details,omitempty"` + // AccountCaptureRelinquishAccountDetails : Account captured user + // relinquished their account by changing the email address associated with + // it. + AccountCaptureRelinquishAccountDetails *AccountCaptureRelinquishAccountDetails `json:"account_capture_relinquish_account_details,omitempty"` + // DisabledDomainInvitesDetails : Disabled domain invites. + DisabledDomainInvitesDetails *DisabledDomainInvitesDetails `json:"disabled_domain_invites_details,omitempty"` + // DomainInvitesApproveRequestToJoinTeamDetails : Approved a member's + // request to join the team. + DomainInvitesApproveRequestToJoinTeamDetails *DomainInvitesApproveRequestToJoinTeamDetails `json:"domain_invites_approve_request_to_join_team_details,omitempty"` + // DomainInvitesDeclineRequestToJoinTeamDetails : Declined a user's request + // to join the team. + DomainInvitesDeclineRequestToJoinTeamDetails *DomainInvitesDeclineRequestToJoinTeamDetails `json:"domain_invites_decline_request_to_join_team_details,omitempty"` + // DomainInvitesEmailExistingUsersDetails : Sent domain invites to existing + // domain accounts. + DomainInvitesEmailExistingUsersDetails *DomainInvitesEmailExistingUsersDetails `json:"domain_invites_email_existing_users_details,omitempty"` + // DomainInvitesRequestToJoinTeamDetails : Asked to join the team. + DomainInvitesRequestToJoinTeamDetails *DomainInvitesRequestToJoinTeamDetails `json:"domain_invites_request_to_join_team_details,omitempty"` + // DomainInvitesSetInviteNewUserPrefToNoDetails : Turned off + // u201cAutomatically invite new usersu201d. + DomainInvitesSetInviteNewUserPrefToNoDetails *DomainInvitesSetInviteNewUserPrefToNoDetails `json:"domain_invites_set_invite_new_user_pref_to_no_details,omitempty"` + // DomainInvitesSetInviteNewUserPrefToYesDetails : Turned on + // u201cAutomatically invite new usersu201d. + DomainInvitesSetInviteNewUserPrefToYesDetails *DomainInvitesSetInviteNewUserPrefToYesDetails `json:"domain_invites_set_invite_new_user_pref_to_yes_details,omitempty"` + // DomainVerificationAddDomainFailDetails : Failed to verify a domain + // belonging to the team. + DomainVerificationAddDomainFailDetails *DomainVerificationAddDomainFailDetails `json:"domain_verification_add_domain_fail_details,omitempty"` + // DomainVerificationAddDomainSuccessDetails : Verified a domain belonging + // to the team. + DomainVerificationAddDomainSuccessDetails *DomainVerificationAddDomainSuccessDetails `json:"domain_verification_add_domain_success_details,omitempty"` + // DomainVerificationRemoveDomainDetails : Removed a domain from the list of + // verified domains belonging to the team. + DomainVerificationRemoveDomainDetails *DomainVerificationRemoveDomainDetails `json:"domain_verification_remove_domain_details,omitempty"` + // EnabledDomainInvitesDetails : Enabled domain invites. + EnabledDomainInvitesDetails *EnabledDomainInvitesDetails `json:"enabled_domain_invites_details,omitempty"` + // CreateFolderDetails : Created folders. + CreateFolderDetails *CreateFolderDetails `json:"create_folder_details,omitempty"` + // FileAddDetails : Added files and/or folders. + FileAddDetails *FileAddDetails `json:"file_add_details,omitempty"` + // FileCopyDetails : Copied files and/or folders. + FileCopyDetails *FileCopyDetails `json:"file_copy_details,omitempty"` + // FileDeleteDetails : Deleted files and/or folders. + FileDeleteDetails *FileDeleteDetails `json:"file_delete_details,omitempty"` + // FileDownloadDetails : Downloaded files and/or folders. + FileDownloadDetails *FileDownloadDetails `json:"file_download_details,omitempty"` + // FileEditDetails : Edited files. + FileEditDetails *FileEditDetails `json:"file_edit_details,omitempty"` + // FileGetCopyReferenceDetails : Create a copy reference to a file or + // folder. + FileGetCopyReferenceDetails *FileGetCopyReferenceDetails `json:"file_get_copy_reference_details,omitempty"` + // FileMoveDetails : Moved files and/or folders. + FileMoveDetails *FileMoveDetails `json:"file_move_details,omitempty"` + // FilePermanentlyDeleteDetails : Permanently deleted files and/or folders. + FilePermanentlyDeleteDetails *FilePermanentlyDeleteDetails `json:"file_permanently_delete_details,omitempty"` + // FilePreviewDetails : Previewed files and/or folders. + FilePreviewDetails *FilePreviewDetails `json:"file_preview_details,omitempty"` + // FileRenameDetails : Renamed files and/or folders. + FileRenameDetails *FileRenameDetails `json:"file_rename_details,omitempty"` + // FileRestoreDetails : Restored deleted files and/or folders. + FileRestoreDetails *FileRestoreDetails `json:"file_restore_details,omitempty"` + // FileRevertDetails : Reverted files to a previous version. + FileRevertDetails *FileRevertDetails `json:"file_revert_details,omitempty"` + // FileRollbackChangesDetails : Rolled back file change location changes. + FileRollbackChangesDetails *FileRollbackChangesDetails `json:"file_rollback_changes_details,omitempty"` + // FileSaveCopyReferenceDetails : Save a file or folder using a copy + // reference. + FileSaveCopyReferenceDetails *FileSaveCopyReferenceDetails `json:"file_save_copy_reference_details,omitempty"` + // FileRequestAddDeadlineDetails : Added a deadline to a file request. + FileRequestAddDeadlineDetails *FileRequestAddDeadlineDetails `json:"file_request_add_deadline_details,omitempty"` + // FileRequestChangeFolderDetails : Changed the file request folder. + FileRequestChangeFolderDetails *FileRequestChangeFolderDetails `json:"file_request_change_folder_details,omitempty"` + // FileRequestChangeTitleDetails : Change the file request title. + FileRequestChangeTitleDetails *FileRequestChangeTitleDetails `json:"file_request_change_title_details,omitempty"` + // FileRequestCloseDetails : Closed a file request. + FileRequestCloseDetails *FileRequestCloseDetails `json:"file_request_close_details,omitempty"` + // FileRequestCreateDetails : Created a file request. + FileRequestCreateDetails *FileRequestCreateDetails `json:"file_request_create_details,omitempty"` + // FileRequestReceiveFileDetails : Received files for a file request. + FileRequestReceiveFileDetails *FileRequestReceiveFileDetails `json:"file_request_receive_file_details,omitempty"` + // FileRequestRemoveDeadlineDetails : Removed the file request deadline. + FileRequestRemoveDeadlineDetails *FileRequestRemoveDeadlineDetails `json:"file_request_remove_deadline_details,omitempty"` + // FileRequestSendDetails : Sent file request to users via email. + FileRequestSendDetails *FileRequestSendDetails `json:"file_request_send_details,omitempty"` + // GroupAddExternalIdDetails : Added an external ID for group. + GroupAddExternalIdDetails *GroupAddExternalIdDetails `json:"group_add_external_id_details,omitempty"` + // GroupAddMemberDetails : Added team members to a group. + GroupAddMemberDetails *GroupAddMemberDetails `json:"group_add_member_details,omitempty"` + // GroupChangeExternalIdDetails : Changed the external ID for group. + GroupChangeExternalIdDetails *GroupChangeExternalIdDetails `json:"group_change_external_id_details,omitempty"` + // GroupChangeManagementTypeDetails : Changed group management type. + GroupChangeManagementTypeDetails *GroupChangeManagementTypeDetails `json:"group_change_management_type_details,omitempty"` + // GroupChangeMemberRoleDetails : Changed the manager permissions belonging + // to a group member. + GroupChangeMemberRoleDetails *GroupChangeMemberRoleDetails `json:"group_change_member_role_details,omitempty"` + // GroupCreateDetails : Created a group. + GroupCreateDetails *GroupCreateDetails `json:"group_create_details,omitempty"` + // GroupDeleteDetails : Deleted a group. + GroupDeleteDetails *GroupDeleteDetails `json:"group_delete_details,omitempty"` + // GroupDescriptionUpdatedDetails : Updated a group. + GroupDescriptionUpdatedDetails *GroupDescriptionUpdatedDetails `json:"group_description_updated_details,omitempty"` + // GroupJoinPolicyUpdatedDetails : Updated a group join policy. + GroupJoinPolicyUpdatedDetails *GroupJoinPolicyUpdatedDetails `json:"group_join_policy_updated_details,omitempty"` + // GroupMovedDetails : Moved a group. + GroupMovedDetails *GroupMovedDetails `json:"group_moved_details,omitempty"` + // GroupRemoveExternalIdDetails : Removed the external ID for group. + GroupRemoveExternalIdDetails *GroupRemoveExternalIdDetails `json:"group_remove_external_id_details,omitempty"` + // GroupRemoveMemberDetails : Removed team members from a group. + GroupRemoveMemberDetails *GroupRemoveMemberDetails `json:"group_remove_member_details,omitempty"` + // GroupRenameDetails : Renamed a group. + GroupRenameDetails *GroupRenameDetails `json:"group_rename_details,omitempty"` + // EmmLoginSuccessDetails : Signed in using the Dropbox EMM app. + EmmLoginSuccessDetails *EmmLoginSuccessDetails `json:"emm_login_success_details,omitempty"` + // LogoutDetails : Signed out. + LogoutDetails *LogoutDetails `json:"logout_details,omitempty"` + // PasswordLoginFailDetails : Failed to sign in using a password. + PasswordLoginFailDetails *PasswordLoginFailDetails `json:"password_login_fail_details,omitempty"` + // PasswordLoginSuccessDetails : Signed in using a password. + PasswordLoginSuccessDetails *PasswordLoginSuccessDetails `json:"password_login_success_details,omitempty"` + // ResellerSupportSessionEndDetails : Ended reseller support session. + ResellerSupportSessionEndDetails *ResellerSupportSessionEndDetails `json:"reseller_support_session_end_details,omitempty"` + // ResellerSupportSessionStartDetails : Started reseller support session. + ResellerSupportSessionStartDetails *ResellerSupportSessionStartDetails `json:"reseller_support_session_start_details,omitempty"` + // SignInAsSessionEndDetails : Ended admin sign-in-as session. + SignInAsSessionEndDetails *SignInAsSessionEndDetails `json:"sign_in_as_session_end_details,omitempty"` + // SignInAsSessionStartDetails : Started admin sign-in-as session. + SignInAsSessionStartDetails *SignInAsSessionStartDetails `json:"sign_in_as_session_start_details,omitempty"` + // SsoLoginFailDetails : Failed to sign in using SSO. + SsoLoginFailDetails *SsoLoginFailDetails `json:"sso_login_fail_details,omitempty"` + // MemberAddNameDetails : Set team member name when joining team. + MemberAddNameDetails *MemberAddNameDetails `json:"member_add_name_details,omitempty"` + // MemberChangeAdminRoleDetails : Change the admin role belonging to team + // member. + MemberChangeAdminRoleDetails *MemberChangeAdminRoleDetails `json:"member_change_admin_role_details,omitempty"` + // MemberChangeEmailDetails : Changed team member email address. + MemberChangeEmailDetails *MemberChangeEmailDetails `json:"member_change_email_details,omitempty"` + // MemberChangeNameDetails : Changed team member name. + MemberChangeNameDetails *MemberChangeNameDetails `json:"member_change_name_details,omitempty"` + // MemberChangeStatusDetails : Changed the membership status of a team + // member. + MemberChangeStatusDetails *MemberChangeStatusDetails `json:"member_change_status_details,omitempty"` + // MemberSuggestDetails : Suggested a new team member to be added to the + // team. + MemberSuggestDetails *MemberSuggestDetails `json:"member_suggest_details,omitempty"` + // PaperContentAddMemberDetails : Added users to the membership of a Paper + // doc or folder. + PaperContentAddMemberDetails *PaperContentAddMemberDetails `json:"paper_content_add_member_details,omitempty"` + // PaperContentAddToFolderDetails : Added Paper doc or folder to a folder. + PaperContentAddToFolderDetails *PaperContentAddToFolderDetails `json:"paper_content_add_to_folder_details,omitempty"` + // PaperContentArchiveDetails : Archived Paper doc or folder. + PaperContentArchiveDetails *PaperContentArchiveDetails `json:"paper_content_archive_details,omitempty"` + // PaperContentChangeSubscriptionDetails : Followed or unfollowed a Paper + // doc or folder. + PaperContentChangeSubscriptionDetails *PaperContentChangeSubscriptionDetails `json:"paper_content_change_subscription_details,omitempty"` + // PaperContentCreateDetails : Created a Paper doc or folder. + PaperContentCreateDetails *PaperContentCreateDetails `json:"paper_content_create_details,omitempty"` + // PaperContentPermanentlyDeleteDetails : Permanently deleted a Paper doc or + // folder. + PaperContentPermanentlyDeleteDetails *PaperContentPermanentlyDeleteDetails `json:"paper_content_permanently_delete_details,omitempty"` + // PaperContentRemoveFromFolderDetails : Removed Paper doc or folder from a + // folder. + PaperContentRemoveFromFolderDetails *PaperContentRemoveFromFolderDetails `json:"paper_content_remove_from_folder_details,omitempty"` + // PaperContentRemoveMemberDetails : Removed a user from the membership of a + // Paper doc or folder. + PaperContentRemoveMemberDetails *PaperContentRemoveMemberDetails `json:"paper_content_remove_member_details,omitempty"` + // PaperContentRenameDetails : Renamed Paper doc or folder. + PaperContentRenameDetails *PaperContentRenameDetails `json:"paper_content_rename_details,omitempty"` + // PaperContentRestoreDetails : Restored an archived Paper doc or folder. + PaperContentRestoreDetails *PaperContentRestoreDetails `json:"paper_content_restore_details,omitempty"` + // PaperDocAddCommentDetails : Added a Paper doc comment. + PaperDocAddCommentDetails *PaperDocAddCommentDetails `json:"paper_doc_add_comment_details,omitempty"` + // PaperDocChangeMemberRoleDetails : Changed the access type of a Paper doc + // member. + PaperDocChangeMemberRoleDetails *PaperDocChangeMemberRoleDetails `json:"paper_doc_change_member_role_details,omitempty"` + // PaperDocChangeSharingPolicyDetails : Changed the sharing policy for Paper + // doc. + PaperDocChangeSharingPolicyDetails *PaperDocChangeSharingPolicyDetails `json:"paper_doc_change_sharing_policy_details,omitempty"` + // PaperDocDeletedDetails : Paper doc archived. + PaperDocDeletedDetails *PaperDocDeletedDetails `json:"paper_doc_deleted_details,omitempty"` + // PaperDocDeleteCommentDetails : Deleted a Paper doc comment. + PaperDocDeleteCommentDetails *PaperDocDeleteCommentDetails `json:"paper_doc_delete_comment_details,omitempty"` + // PaperDocDownloadDetails : Downloaded a Paper doc in a particular output + // format. + PaperDocDownloadDetails *PaperDocDownloadDetails `json:"paper_doc_download_details,omitempty"` + // PaperDocEditDetails : Edited a Paper doc. + PaperDocEditDetails *PaperDocEditDetails `json:"paper_doc_edit_details,omitempty"` + // PaperDocEditCommentDetails : Edited a Paper doc comment. + PaperDocEditCommentDetails *PaperDocEditCommentDetails `json:"paper_doc_edit_comment_details,omitempty"` + // PaperDocFollowedDetails : Followed a Paper doc. + PaperDocFollowedDetails *PaperDocFollowedDetails `json:"paper_doc_followed_details,omitempty"` + // PaperDocMentionDetails : Mentioned a member in a Paper doc. + PaperDocMentionDetails *PaperDocMentionDetails `json:"paper_doc_mention_details,omitempty"` + // PaperDocRequestAccessDetails : Requested to be a member on a Paper doc. + PaperDocRequestAccessDetails *PaperDocRequestAccessDetails `json:"paper_doc_request_access_details,omitempty"` + // PaperDocResolveCommentDetails : Paper doc comment resolved. + PaperDocResolveCommentDetails *PaperDocResolveCommentDetails `json:"paper_doc_resolve_comment_details,omitempty"` + // PaperDocRevertDetails : Restored a Paper doc to previous revision. + PaperDocRevertDetails *PaperDocRevertDetails `json:"paper_doc_revert_details,omitempty"` + // PaperDocSlackShareDetails : Paper doc link shared via slack. + PaperDocSlackShareDetails *PaperDocSlackShareDetails `json:"paper_doc_slack_share_details,omitempty"` + // PaperDocTeamInviteDetails : Paper doc shared with team member. + PaperDocTeamInviteDetails *PaperDocTeamInviteDetails `json:"paper_doc_team_invite_details,omitempty"` + // PaperDocUnresolveCommentDetails : Unresolved a Paper doc comment. + PaperDocUnresolveCommentDetails *PaperDocUnresolveCommentDetails `json:"paper_doc_unresolve_comment_details,omitempty"` + // PaperDocViewDetails : Viewed Paper doc. + PaperDocViewDetails *PaperDocViewDetails `json:"paper_doc_view_details,omitempty"` + // PaperFolderDeletedDetails : Paper folder archived. + PaperFolderDeletedDetails *PaperFolderDeletedDetails `json:"paper_folder_deleted_details,omitempty"` + // PaperFolderFollowedDetails : Followed a Paper folder. + PaperFolderFollowedDetails *PaperFolderFollowedDetails `json:"paper_folder_followed_details,omitempty"` + // PaperFolderTeamInviteDetails : Paper folder shared with team member. + PaperFolderTeamInviteDetails *PaperFolderTeamInviteDetails `json:"paper_folder_team_invite_details,omitempty"` + // PasswordChangeDetails : Changed password. + PasswordChangeDetails *PasswordChangeDetails `json:"password_change_details,omitempty"` + // PasswordResetDetails : Reset password. + PasswordResetDetails *PasswordResetDetails `json:"password_reset_details,omitempty"` + // PasswordResetAllDetails : Reset all team member passwords. + PasswordResetAllDetails *PasswordResetAllDetails `json:"password_reset_all_details,omitempty"` + // EmmCreateExceptionsReportDetails : EMM excluded users report created. + EmmCreateExceptionsReportDetails *EmmCreateExceptionsReportDetails `json:"emm_create_exceptions_report_details,omitempty"` + // EmmCreateUsageReportDetails : EMM mobile app usage report created. + EmmCreateUsageReportDetails *EmmCreateUsageReportDetails `json:"emm_create_usage_report_details,omitempty"` + // SmartSyncCreateAdminPrivilegeReportDetails : Smart Sync non-admin devices + // report created. + SmartSyncCreateAdminPrivilegeReportDetails *SmartSyncCreateAdminPrivilegeReportDetails `json:"smart_sync_create_admin_privilege_report_details,omitempty"` + // TeamActivityCreateReportDetails : Created a team activity report. + TeamActivityCreateReportDetails *TeamActivityCreateReportDetails `json:"team_activity_create_report_details,omitempty"` + // CollectionShareDetails : Shared an album. + CollectionShareDetails *CollectionShareDetails `json:"collection_share_details,omitempty"` + // FileAddCommentDetails : Added a file comment. + FileAddCommentDetails *FileAddCommentDetails `json:"file_add_comment_details,omitempty"` + // FileLikeCommentDetails : Liked a file comment. + FileLikeCommentDetails *FileLikeCommentDetails `json:"file_like_comment_details,omitempty"` + // FileUnlikeCommentDetails : Unliked a file comment. + FileUnlikeCommentDetails *FileUnlikeCommentDetails `json:"file_unlike_comment_details,omitempty"` + // NoteAclInviteOnlyDetails : Changed a Paper document to be invite-only. + NoteAclInviteOnlyDetails *NoteAclInviteOnlyDetails `json:"note_acl_invite_only_details,omitempty"` + // NoteAclLinkDetails : Changed a Paper document to be link accessible. + NoteAclLinkDetails *NoteAclLinkDetails `json:"note_acl_link_details,omitempty"` + // NoteAclTeamLinkDetails : Changed a Paper document to be link accessible + // for the team. + NoteAclTeamLinkDetails *NoteAclTeamLinkDetails `json:"note_acl_team_link_details,omitempty"` + // NoteSharedDetails : Shared a Paper doc. + NoteSharedDetails *NoteSharedDetails `json:"note_shared_details,omitempty"` + // NoteShareReceiveDetails : Shared Paper document received. + NoteShareReceiveDetails *NoteShareReceiveDetails `json:"note_share_receive_details,omitempty"` + // OpenNoteSharedDetails : Opened a shared Paper doc. + OpenNoteSharedDetails *OpenNoteSharedDetails `json:"open_note_shared_details,omitempty"` + // SfAddGroupDetails : Added the team to a shared folder. + SfAddGroupDetails *SfAddGroupDetails `json:"sf_add_group_details,omitempty"` + // SfAllowNonMembersToViewSharedLinksDetails : Allowed non collaborators to + // view links to files in a shared folder. + SfAllowNonMembersToViewSharedLinksDetails *SfAllowNonMembersToViewSharedLinksDetails `json:"sf_allow_non_members_to_view_shared_links_details,omitempty"` + // SfInviteGroupDetails : Invited a group to a shared folder. + SfInviteGroupDetails *SfInviteGroupDetails `json:"sf_invite_group_details,omitempty"` + // SfNestDetails : Changed parent of shared folder. + SfNestDetails *SfNestDetails `json:"sf_nest_details,omitempty"` + // SfTeamDeclineDetails : Declined a team member's invitation to a shared + // folder. + SfTeamDeclineDetails *SfTeamDeclineDetails `json:"sf_team_decline_details,omitempty"` + // SfTeamGrantAccessDetails : Granted access to a shared folder. + SfTeamGrantAccessDetails *SfTeamGrantAccessDetails `json:"sf_team_grant_access_details,omitempty"` + // SfTeamInviteDetails : Invited team members to a shared folder. + SfTeamInviteDetails *SfTeamInviteDetails `json:"sf_team_invite_details,omitempty"` + // SfTeamInviteChangeRoleDetails : Changed a team member's role in a shared + // folder. + SfTeamInviteChangeRoleDetails *SfTeamInviteChangeRoleDetails `json:"sf_team_invite_change_role_details,omitempty"` + // SfTeamJoinDetails : Joined a team member's shared folder. + SfTeamJoinDetails *SfTeamJoinDetails `json:"sf_team_join_details,omitempty"` + // SfTeamJoinFromOobLinkDetails : Joined a team member's shared folder from + // a link. + SfTeamJoinFromOobLinkDetails *SfTeamJoinFromOobLinkDetails `json:"sf_team_join_from_oob_link_details,omitempty"` + // SfTeamUninviteDetails : Unshared a folder with a team member. + SfTeamUninviteDetails *SfTeamUninviteDetails `json:"sf_team_uninvite_details,omitempty"` + // SharedContentAddInviteesDetails : Sent an email invitation to the + // membership of a shared file or folder. + SharedContentAddInviteesDetails *SharedContentAddInviteesDetails `json:"shared_content_add_invitees_details,omitempty"` + // SharedContentAddLinkExpiryDetails : Added an expiry to the link for the + // shared file or folder. + SharedContentAddLinkExpiryDetails *SharedContentAddLinkExpiryDetails `json:"shared_content_add_link_expiry_details,omitempty"` + // SharedContentAddLinkPasswordDetails : Added a password to the link for + // the shared file or folder. + SharedContentAddLinkPasswordDetails *SharedContentAddLinkPasswordDetails `json:"shared_content_add_link_password_details,omitempty"` + // SharedContentAddMemberDetails : Added users and/or groups to the + // membership of a shared file or folder. + SharedContentAddMemberDetails *SharedContentAddMemberDetails `json:"shared_content_add_member_details,omitempty"` + // SharedContentChangeDownloadsPolicyDetails : Changed whether members can + // download the shared file or folder. + SharedContentChangeDownloadsPolicyDetails *SharedContentChangeDownloadsPolicyDetails `json:"shared_content_change_downloads_policy_details,omitempty"` + // SharedContentChangeInviteeRoleDetails : Changed the access type of an + // invitee to a shared file or folder before the invitation was claimed. + SharedContentChangeInviteeRoleDetails *SharedContentChangeInviteeRoleDetails `json:"shared_content_change_invitee_role_details,omitempty"` + // SharedContentChangeLinkAudienceDetails : Changed the audience of the link + // for a shared file or folder. + SharedContentChangeLinkAudienceDetails *SharedContentChangeLinkAudienceDetails `json:"shared_content_change_link_audience_details,omitempty"` + // SharedContentChangeLinkExpiryDetails : Changed the expiry of the link for + // the shared file or folder. + SharedContentChangeLinkExpiryDetails *SharedContentChangeLinkExpiryDetails `json:"shared_content_change_link_expiry_details,omitempty"` + // SharedContentChangeLinkPasswordDetails : Changed the password on the link + // for the shared file or folder. + SharedContentChangeLinkPasswordDetails *SharedContentChangeLinkPasswordDetails `json:"shared_content_change_link_password_details,omitempty"` + // SharedContentChangeMemberRoleDetails : Changed the access type of a + // shared file or folder member. + SharedContentChangeMemberRoleDetails *SharedContentChangeMemberRoleDetails `json:"shared_content_change_member_role_details,omitempty"` + // SharedContentChangeViewerInfoPolicyDetails : Changed whether members can + // see who viewed the shared file or folder. + SharedContentChangeViewerInfoPolicyDetails *SharedContentChangeViewerInfoPolicyDetails `json:"shared_content_change_viewer_info_policy_details,omitempty"` + // SharedContentClaimInvitationDetails : Claimed membership to a team + // member's shared folder. + SharedContentClaimInvitationDetails *SharedContentClaimInvitationDetails `json:"shared_content_claim_invitation_details,omitempty"` + // SharedContentCopyDetails : Copied the shared file or folder to own + // Dropbox. + SharedContentCopyDetails *SharedContentCopyDetails `json:"shared_content_copy_details,omitempty"` + // SharedContentDownloadDetails : Downloaded the shared file or folder. + SharedContentDownloadDetails *SharedContentDownloadDetails `json:"shared_content_download_details,omitempty"` + // SharedContentRelinquishMembershipDetails : Left the membership of a + // shared file or folder. + SharedContentRelinquishMembershipDetails *SharedContentRelinquishMembershipDetails `json:"shared_content_relinquish_membership_details,omitempty"` + // SharedContentRemoveInviteeDetails : Removed an invitee from the + // membership of a shared file or folder before it was claimed. + SharedContentRemoveInviteeDetails *SharedContentRemoveInviteeDetails `json:"shared_content_remove_invitee_details,omitempty"` + // SharedContentRemoveLinkExpiryDetails : Removed the expiry of the link for + // the shared file or folder. + SharedContentRemoveLinkExpiryDetails *SharedContentRemoveLinkExpiryDetails `json:"shared_content_remove_link_expiry_details,omitempty"` + // SharedContentRemoveLinkPasswordDetails : Removed the password on the link + // for the shared file or folder. + SharedContentRemoveLinkPasswordDetails *SharedContentRemoveLinkPasswordDetails `json:"shared_content_remove_link_password_details,omitempty"` + // SharedContentRemoveMemberDetails : Removed a user or a group from the + // membership of a shared file or folder. + SharedContentRemoveMemberDetails *SharedContentRemoveMemberDetails `json:"shared_content_remove_member_details,omitempty"` + // SharedContentRequestAccessDetails : Requested to be on the membership of + // a shared file or folder. + SharedContentRequestAccessDetails *SharedContentRequestAccessDetails `json:"shared_content_request_access_details,omitempty"` + // SharedContentUnshareDetails : Unshared a shared file or folder by + // clearing its membership and turning off its link. + SharedContentUnshareDetails *SharedContentUnshareDetails `json:"shared_content_unshare_details,omitempty"` + // SharedContentViewDetails : Previewed the shared file or folder. + SharedContentViewDetails *SharedContentViewDetails `json:"shared_content_view_details,omitempty"` + // SharedFolderChangeConfidentialityDetails : Set or unset the confidential + // flag on a shared folder. + SharedFolderChangeConfidentialityDetails *SharedFolderChangeConfidentialityDetails `json:"shared_folder_change_confidentiality_details,omitempty"` + // SharedFolderChangeLinkPolicyDetails : Changed who can access the shared + // folder via a link. + SharedFolderChangeLinkPolicyDetails *SharedFolderChangeLinkPolicyDetails `json:"shared_folder_change_link_policy_details,omitempty"` + // SharedFolderChangeMemberManagementPolicyDetails : Changed who can manage + // the membership of a shared folder. + SharedFolderChangeMemberManagementPolicyDetails *SharedFolderChangeMemberManagementPolicyDetails `json:"shared_folder_change_member_management_policy_details,omitempty"` + // SharedFolderChangeMemberPolicyDetails : Changed who can become a member + // of the shared folder. + SharedFolderChangeMemberPolicyDetails *SharedFolderChangeMemberPolicyDetails `json:"shared_folder_change_member_policy_details,omitempty"` + // SharedFolderCreateDetails : Created a shared folder. + SharedFolderCreateDetails *SharedFolderCreateDetails `json:"shared_folder_create_details,omitempty"` + // SharedFolderMountDetails : Added a shared folder to own Dropbox. + SharedFolderMountDetails *SharedFolderMountDetails `json:"shared_folder_mount_details,omitempty"` + // SharedFolderTransferOwnershipDetails : Transferred the ownership of a + // shared folder to another member. + SharedFolderTransferOwnershipDetails *SharedFolderTransferOwnershipDetails `json:"shared_folder_transfer_ownership_details,omitempty"` + // SharedFolderUnmountDetails : Deleted a shared folder from Dropbox. + SharedFolderUnmountDetails *SharedFolderUnmountDetails `json:"shared_folder_unmount_details,omitempty"` + // SharedNoteOpenedDetails : Shared Paper document was opened. + SharedNoteOpenedDetails *SharedNoteOpenedDetails `json:"shared_note_opened_details,omitempty"` + // ShmodelAppCreateDetails : Created a link to a file using an app. + ShmodelAppCreateDetails *ShmodelAppCreateDetails `json:"shmodel_app_create_details,omitempty"` + // ShmodelCreateDetails : Created a new link. + ShmodelCreateDetails *ShmodelCreateDetails `json:"shmodel_create_details,omitempty"` + // ShmodelDisableDetails : Removed a link. + ShmodelDisableDetails *ShmodelDisableDetails `json:"shmodel_disable_details,omitempty"` + // ShmodelFbShareDetails : Shared a link with Facebook users. + ShmodelFbShareDetails *ShmodelFbShareDetails `json:"shmodel_fb_share_details,omitempty"` + // ShmodelGroupShareDetails : Shared a link with a group. + ShmodelGroupShareDetails *ShmodelGroupShareDetails `json:"shmodel_group_share_details,omitempty"` + // ShmodelRemoveExpirationDetails : Removed the expiration date from a link. + ShmodelRemoveExpirationDetails *ShmodelRemoveExpirationDetails `json:"shmodel_remove_expiration_details,omitempty"` + // ShmodelSetExpirationDetails : Added an expiration date to a link. + ShmodelSetExpirationDetails *ShmodelSetExpirationDetails `json:"shmodel_set_expiration_details,omitempty"` + // ShmodelTeamCopyDetails : Added a team member's file/folder to their + // Dropbox from a link. + ShmodelTeamCopyDetails *ShmodelTeamCopyDetails `json:"shmodel_team_copy_details,omitempty"` + // ShmodelTeamDownloadDetails : Downloaded a team member's file/folder from + // a link. + ShmodelTeamDownloadDetails *ShmodelTeamDownloadDetails `json:"shmodel_team_download_details,omitempty"` + // ShmodelTeamShareDetails : Shared a link with team members. + ShmodelTeamShareDetails *ShmodelTeamShareDetails `json:"shmodel_team_share_details,omitempty"` + // ShmodelTeamViewDetails : Opened a team member's link. + ShmodelTeamViewDetails *ShmodelTeamViewDetails `json:"shmodel_team_view_details,omitempty"` + // ShmodelVisibilityPasswordDetails : Password-protected a link. + ShmodelVisibilityPasswordDetails *ShmodelVisibilityPasswordDetails `json:"shmodel_visibility_password_details,omitempty"` + // ShmodelVisibilityPublicDetails : Made a file/folder visible to anyone + // with the link. + ShmodelVisibilityPublicDetails *ShmodelVisibilityPublicDetails `json:"shmodel_visibility_public_details,omitempty"` + // ShmodelVisibilityTeamOnlyDetails : Made a file/folder visible only to + // team members with the link. + ShmodelVisibilityTeamOnlyDetails *ShmodelVisibilityTeamOnlyDetails `json:"shmodel_visibility_team_only_details,omitempty"` + // RemoveLogoutUrlDetails : Removed single sign-on logout URL. + RemoveLogoutUrlDetails *RemoveLogoutUrlDetails `json:"remove_logout_url_details,omitempty"` + // RemoveSsoUrlDetails : Changed the sign-out URL for SSO. + RemoveSsoUrlDetails *RemoveSsoUrlDetails `json:"remove_sso_url_details,omitempty"` + // SsoChangeCertDetails : Changed the X.509 certificate for SSO. + SsoChangeCertDetails *SsoChangeCertDetails `json:"sso_change_cert_details,omitempty"` + // SsoChangeLoginUrlDetails : Changed the sign-in URL for SSO. + SsoChangeLoginUrlDetails *SsoChangeLoginUrlDetails `json:"sso_change_login_url_details,omitempty"` + // SsoChangeLogoutUrlDetails : Changed the sign-out URL for SSO. + SsoChangeLogoutUrlDetails *SsoChangeLogoutUrlDetails `json:"sso_change_logout_url_details,omitempty"` + // SsoChangeSamlIdentityModeDetails : Changed the SAML identity mode for + // SSO. + SsoChangeSamlIdentityModeDetails *SsoChangeSamlIdentityModeDetails `json:"sso_change_saml_identity_mode_details,omitempty"` + // TeamFolderChangeStatusDetails : Changed the archival status of a team + // folder. + TeamFolderChangeStatusDetails *TeamFolderChangeStatusDetails `json:"team_folder_change_status_details,omitempty"` + // TeamFolderCreateDetails : Created a new team folder in active status. + TeamFolderCreateDetails *TeamFolderCreateDetails `json:"team_folder_create_details,omitempty"` + // TeamFolderDowngradeDetails : Downgraded a team folder to a regular shared + // folder. + TeamFolderDowngradeDetails *TeamFolderDowngradeDetails `json:"team_folder_downgrade_details,omitempty"` + // TeamFolderPermanentlyDeleteDetails : Permanently deleted an archived team + // folder. + TeamFolderPermanentlyDeleteDetails *TeamFolderPermanentlyDeleteDetails `json:"team_folder_permanently_delete_details,omitempty"` + // TeamFolderRenameDetails : Renamed an active or archived team folder. + TeamFolderRenameDetails *TeamFolderRenameDetails `json:"team_folder_rename_details,omitempty"` + // AccountCaptureChangePolicyDetails : Changed the account capture policy on + // a domain belonging to the team. + AccountCaptureChangePolicyDetails *AccountCaptureChangePolicyDetails `json:"account_capture_change_policy_details,omitempty"` + // AllowDownloadDisabledDetails : Disabled allow downloads. + AllowDownloadDisabledDetails *AllowDownloadDisabledDetails `json:"allow_download_disabled_details,omitempty"` + // AllowDownloadEnabledDetails : Enabled allow downloads. + AllowDownloadEnabledDetails *AllowDownloadEnabledDetails `json:"allow_download_enabled_details,omitempty"` + // DataPlacementRestrictionChangePolicyDetails : Set a restriction policy + // regarding the location of data centers where team data resides. + DataPlacementRestrictionChangePolicyDetails *DataPlacementRestrictionChangePolicyDetails `json:"data_placement_restriction_change_policy_details,omitempty"` + // DataPlacementRestrictionSatisfyPolicyDetails : Satisfied a previously set + // restriction policy regarding the location of data centers where team data + // resides (i.e. all data have been migrated according to the restriction + // placed). + DataPlacementRestrictionSatisfyPolicyDetails *DataPlacementRestrictionSatisfyPolicyDetails `json:"data_placement_restriction_satisfy_policy_details,omitempty"` + // DeviceApprovalsChangeDesktopPolicyDetails : Set or removed a limit on the + // number of computers each team member can link to their work Dropbox + // account. + DeviceApprovalsChangeDesktopPolicyDetails *DeviceApprovalsChangeDesktopPolicyDetails `json:"device_approvals_change_desktop_policy_details,omitempty"` + // DeviceApprovalsChangeMobilePolicyDetails : Set or removed a limit on the + // number of mobiles devices each team member can link to their work Dropbox + // account. + DeviceApprovalsChangeMobilePolicyDetails *DeviceApprovalsChangeMobilePolicyDetails `json:"device_approvals_change_mobile_policy_details,omitempty"` + // DeviceApprovalsChangeOverageActionDetails : Changed the action taken when + // a team member is already over the limits (e.g when they join the team, an + // admin lowers limits, etc.). + DeviceApprovalsChangeOverageActionDetails *DeviceApprovalsChangeOverageActionDetails `json:"device_approvals_change_overage_action_details,omitempty"` + // DeviceApprovalsChangeUnlinkActionDetails : Changed the action taken with + // respect to approval limits when a team member unlinks an approved device. + DeviceApprovalsChangeUnlinkActionDetails *DeviceApprovalsChangeUnlinkActionDetails `json:"device_approvals_change_unlink_action_details,omitempty"` + // EmmAddExceptionDetails : Added an exception for one or more team members + // to optionally use the regular Dropbox app when EMM is enabled. + EmmAddExceptionDetails *EmmAddExceptionDetails `json:"emm_add_exception_details,omitempty"` + // EmmChangePolicyDetails : Enabled or disabled enterprise mobility + // management for team members. + EmmChangePolicyDetails *EmmChangePolicyDetails `json:"emm_change_policy_details,omitempty"` + // EmmRemoveExceptionDetails : Removed an exception for one or more team + // members to optionally use the regular Dropbox app when EMM is enabled. + EmmRemoveExceptionDetails *EmmRemoveExceptionDetails `json:"emm_remove_exception_details,omitempty"` + // ExtendedVersionHistoryChangePolicyDetails : Accepted or opted out of + // extended version history. + ExtendedVersionHistoryChangePolicyDetails *ExtendedVersionHistoryChangePolicyDetails `json:"extended_version_history_change_policy_details,omitempty"` + // FileCommentsChangePolicyDetails : Enabled or disabled commenting on team + // files. + FileCommentsChangePolicyDetails *FileCommentsChangePolicyDetails `json:"file_comments_change_policy_details,omitempty"` + // FileRequestsChangePolicyDetails : Enabled or disabled file requests. + FileRequestsChangePolicyDetails *FileRequestsChangePolicyDetails `json:"file_requests_change_policy_details,omitempty"` + // FileRequestsEmailsEnabledDetails : Enabled file request emails for + // everyone. + FileRequestsEmailsEnabledDetails *FileRequestsEmailsEnabledDetails `json:"file_requests_emails_enabled_details,omitempty"` + // FileRequestsEmailsRestrictedToTeamOnlyDetails : Allowed file request + // emails for the team. + FileRequestsEmailsRestrictedToTeamOnlyDetails *FileRequestsEmailsRestrictedToTeamOnlyDetails `json:"file_requests_emails_restricted_to_team_only_details,omitempty"` + // GoogleSsoChangePolicyDetails : Enabled or disabled Google single sign-on + // for the team. + GoogleSsoChangePolicyDetails *GoogleSsoChangePolicyDetails `json:"google_sso_change_policy_details,omitempty"` + // GroupUserManagementChangePolicyDetails : Changed who can create groups. + GroupUserManagementChangePolicyDetails *GroupUserManagementChangePolicyDetails `json:"group_user_management_change_policy_details,omitempty"` + // MemberRequestsChangePolicyDetails : Changed whether users can find the + // team when not invited. + MemberRequestsChangePolicyDetails *MemberRequestsChangePolicyDetails `json:"member_requests_change_policy_details,omitempty"` + // MemberSpaceLimitsAddExceptionDetails : Added an exception for one or more + // team members to bypass space limits imposed by policy. + MemberSpaceLimitsAddExceptionDetails *MemberSpaceLimitsAddExceptionDetails `json:"member_space_limits_add_exception_details,omitempty"` + // MemberSpaceLimitsChangePolicyDetails : Changed the storage limits applied + // to team members by policy. + MemberSpaceLimitsChangePolicyDetails *MemberSpaceLimitsChangePolicyDetails `json:"member_space_limits_change_policy_details,omitempty"` + // MemberSpaceLimitsRemoveExceptionDetails : Removed an exception for one or + // more team members to bypass space limits imposed by policy. + MemberSpaceLimitsRemoveExceptionDetails *MemberSpaceLimitsRemoveExceptionDetails `json:"member_space_limits_remove_exception_details,omitempty"` + // MemberSuggestionsChangePolicyDetails : Enabled or disabled the option for + // team members to suggest new members to add to the team. + MemberSuggestionsChangePolicyDetails *MemberSuggestionsChangePolicyDetails `json:"member_suggestions_change_policy_details,omitempty"` + // MicrosoftOfficeAddinChangePolicyDetails : Enabled or disabled the + // Microsoft Office add-in, which lets team members save files to Dropbox + // directly from Microsoft Office. + MicrosoftOfficeAddinChangePolicyDetails *MicrosoftOfficeAddinChangePolicyDetails `json:"microsoft_office_addin_change_policy_details,omitempty"` + // NetworkControlChangePolicyDetails : Enabled or disabled network control. + NetworkControlChangePolicyDetails *NetworkControlChangePolicyDetails `json:"network_control_change_policy_details,omitempty"` + // 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"` + // 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. + PaperChangeMemberPolicyDetails *PaperChangeMemberPolicyDetails `json:"paper_change_member_policy_details,omitempty"` + // PaperChangePolicyDetails : Enabled or disabled Dropbox Paper for the + // team. + PaperChangePolicyDetails *PaperChangePolicyDetails `json:"paper_change_policy_details,omitempty"` + // PermanentDeleteChangePolicyDetails : Enabled or disabled the ability of + // team members to permanently delete content. + PermanentDeleteChangePolicyDetails *PermanentDeleteChangePolicyDetails `json:"permanent_delete_change_policy_details,omitempty"` + // SharingChangeFolderJoinPolicyDetails : Changed whether team members can + // join shared folders owned externally (i.e. outside the team). + SharingChangeFolderJoinPolicyDetails *SharingChangeFolderJoinPolicyDetails `json:"sharing_change_folder_join_policy_details,omitempty"` + // SharingChangeLinkPolicyDetails : Changed whether team members can share + // links externally (i.e. outside the team), and if so, whether links should + // be accessible only by team members or anyone by default. + SharingChangeLinkPolicyDetails *SharingChangeLinkPolicyDetails `json:"sharing_change_link_policy_details,omitempty"` + // SharingChangeMemberPolicyDetails : Changed whether team members can share + // files and folders externally (i.e. outside the team). + SharingChangeMemberPolicyDetails *SharingChangeMemberPolicyDetails `json:"sharing_change_member_policy_details,omitempty"` + // SmartSyncChangePolicyDetails : Changed the default Smart Sync policy for + // team members. + SmartSyncChangePolicyDetails *SmartSyncChangePolicyDetails `json:"smart_sync_change_policy_details,omitempty"` + // SmartSyncNotOptOutDetails : Opted team into Smart Sync. + SmartSyncNotOptOutDetails *SmartSyncNotOptOutDetails `json:"smart_sync_not_opt_out_details,omitempty"` + // SmartSyncOptOutDetails : Opted team out of Smart Sync. + SmartSyncOptOutDetails *SmartSyncOptOutDetails `json:"smart_sync_opt_out_details,omitempty"` + // SsoChangePolicyDetails : Change the single sign-on policy for the team. + SsoChangePolicyDetails *SsoChangePolicyDetails `json:"sso_change_policy_details,omitempty"` + // TfaChangePolicyDetails : Change two-step verification policy for the + // team. + TfaChangePolicyDetails *TfaChangePolicyDetails `json:"tfa_change_policy_details,omitempty"` + // TwoAccountChangePolicyDetails : Enabled or disabled the option for team + // members to link a personal Dropbox account in addition to their work + // account to the same computer. + TwoAccountChangePolicyDetails *TwoAccountChangePolicyDetails `json:"two_account_change_policy_details,omitempty"` + // WebSessionsChangeFixedLengthPolicyDetails : Changed how long team members + // can stay signed in to Dropbox on the web. + WebSessionsChangeFixedLengthPolicyDetails *WebSessionsChangeFixedLengthPolicyDetails `json:"web_sessions_change_fixed_length_policy_details,omitempty"` + // WebSessionsChangeIdleLengthPolicyDetails : Changed how long team members + // can be idle while signed in to Dropbox on the web. + WebSessionsChangeIdleLengthPolicyDetails *WebSessionsChangeIdleLengthPolicyDetails `json:"web_sessions_change_idle_length_policy_details,omitempty"` + // TeamProfileAddLogoDetails : Added a team logo to be displayed on shared + // link headers. + TeamProfileAddLogoDetails *TeamProfileAddLogoDetails `json:"team_profile_add_logo_details,omitempty"` + // TeamProfileChangeLogoDetails : Changed the team logo to be displayed on + // shared link headers. + TeamProfileChangeLogoDetails *TeamProfileChangeLogoDetails `json:"team_profile_change_logo_details,omitempty"` + // TeamProfileChangeNameDetails : Changed the team name. + TeamProfileChangeNameDetails *TeamProfileChangeNameDetails `json:"team_profile_change_name_details,omitempty"` + // TeamProfileRemoveLogoDetails : Removed the team logo to be displayed on + // shared link headers. + TeamProfileRemoveLogoDetails *TeamProfileRemoveLogoDetails `json:"team_profile_remove_logo_details,omitempty"` + // TfaAddBackupPhoneDetails : Added a backup phone for two-step + // verification. + TfaAddBackupPhoneDetails *TfaAddBackupPhoneDetails `json:"tfa_add_backup_phone_details,omitempty"` + // TfaAddSecurityKeyDetails : Added a security key for two-step + // verification. + TfaAddSecurityKeyDetails *TfaAddSecurityKeyDetails `json:"tfa_add_security_key_details,omitempty"` + // TfaChangeBackupPhoneDetails : Changed the backup phone for two-step + // verification. + TfaChangeBackupPhoneDetails *TfaChangeBackupPhoneDetails `json:"tfa_change_backup_phone_details,omitempty"` + // TfaChangeStatusDetails : Enabled, disabled or changed the configuration + // for two-step verification. + TfaChangeStatusDetails *TfaChangeStatusDetails `json:"tfa_change_status_details,omitempty"` + // TfaRemoveBackupPhoneDetails : Removed the backup phone for two-step + // verification. + TfaRemoveBackupPhoneDetails *TfaRemoveBackupPhoneDetails `json:"tfa_remove_backup_phone_details,omitempty"` + // TfaRemoveSecurityKeyDetails : Removed a security key for two-step + // verification. + TfaRemoveSecurityKeyDetails *TfaRemoveSecurityKeyDetails `json:"tfa_remove_security_key_details,omitempty"` + // TfaResetDetails : Reset two-step verification for team member. + TfaResetDetails *TfaResetDetails `json:"tfa_reset_details,omitempty"` + // MissingDetails : Hints that this event was returned with missing details + // due to an internal error. + MissingDetails *MissingDetails `json:"missing_details,omitempty"` +} + +// Valid tag values for EventDetails +const ( + EventDetailsMemberChangeMembershipTypeDetails = "member_change_membership_type_details" + EventDetailsMemberPermanentlyDeleteAccountContentsDetails = "member_permanently_delete_account_contents_details" + EventDetailsMemberSpaceLimitsChangeStatusDetails = "member_space_limits_change_status_details" + EventDetailsMemberTransferAccountContentsDetails = "member_transfer_account_contents_details" + EventDetailsPaperEnabledUsersGroupAdditionDetails = "paper_enabled_users_group_addition_details" + EventDetailsPaperEnabledUsersGroupRemovalDetails = "paper_enabled_users_group_removal_details" + EventDetailsPaperExternalViewAllowDetails = "paper_external_view_allow_details" + EventDetailsPaperExternalViewDefaultTeamDetails = "paper_external_view_default_team_details" + EventDetailsPaperExternalViewForbidDetails = "paper_external_view_forbid_details" + EventDetailsSfExternalInviteWarnDetails = "sf_external_invite_warn_details" + EventDetailsTeamMergeFromDetails = "team_merge_from_details" + EventDetailsTeamMergeToDetails = "team_merge_to_details" + EventDetailsAppLinkTeamDetails = "app_link_team_details" + EventDetailsAppLinkUserDetails = "app_link_user_details" + EventDetailsAppUnlinkTeamDetails = "app_unlink_team_details" + EventDetailsAppUnlinkUserDetails = "app_unlink_user_details" + EventDetailsDeviceChangeIpDesktopDetails = "device_change_ip_desktop_details" + EventDetailsDeviceChangeIpMobileDetails = "device_change_ip_mobile_details" + EventDetailsDeviceChangeIpWebDetails = "device_change_ip_web_details" + EventDetailsDeviceDeleteOnUnlinkFailDetails = "device_delete_on_unlink_fail_details" + EventDetailsDeviceDeleteOnUnlinkSuccessDetails = "device_delete_on_unlink_success_details" + EventDetailsDeviceLinkFailDetails = "device_link_fail_details" + EventDetailsDeviceLinkSuccessDetails = "device_link_success_details" + EventDetailsDeviceManagementDisabledDetails = "device_management_disabled_details" + EventDetailsDeviceManagementEnabledDetails = "device_management_enabled_details" + EventDetailsDeviceUnlinkDetails = "device_unlink_details" + EventDetailsEmmRefreshAuthTokenDetails = "emm_refresh_auth_token_details" + EventDetailsAccountCaptureChangeAvailabilityDetails = "account_capture_change_availability_details" + EventDetailsAccountCaptureMigrateAccountDetails = "account_capture_migrate_account_details" + EventDetailsAccountCaptureRelinquishAccountDetails = "account_capture_relinquish_account_details" + EventDetailsDisabledDomainInvitesDetails = "disabled_domain_invites_details" + EventDetailsDomainInvitesApproveRequestToJoinTeamDetails = "domain_invites_approve_request_to_join_team_details" + EventDetailsDomainInvitesDeclineRequestToJoinTeamDetails = "domain_invites_decline_request_to_join_team_details" + EventDetailsDomainInvitesEmailExistingUsersDetails = "domain_invites_email_existing_users_details" + EventDetailsDomainInvitesRequestToJoinTeamDetails = "domain_invites_request_to_join_team_details" + EventDetailsDomainInvitesSetInviteNewUserPrefToNoDetails = "domain_invites_set_invite_new_user_pref_to_no_details" + EventDetailsDomainInvitesSetInviteNewUserPrefToYesDetails = "domain_invites_set_invite_new_user_pref_to_yes_details" + EventDetailsDomainVerificationAddDomainFailDetails = "domain_verification_add_domain_fail_details" + EventDetailsDomainVerificationAddDomainSuccessDetails = "domain_verification_add_domain_success_details" + EventDetailsDomainVerificationRemoveDomainDetails = "domain_verification_remove_domain_details" + EventDetailsEnabledDomainInvitesDetails = "enabled_domain_invites_details" + EventDetailsCreateFolderDetails = "create_folder_details" + EventDetailsFileAddDetails = "file_add_details" + EventDetailsFileCopyDetails = "file_copy_details" + EventDetailsFileDeleteDetails = "file_delete_details" + EventDetailsFileDownloadDetails = "file_download_details" + EventDetailsFileEditDetails = "file_edit_details" + EventDetailsFileGetCopyReferenceDetails = "file_get_copy_reference_details" + EventDetailsFileMoveDetails = "file_move_details" + EventDetailsFilePermanentlyDeleteDetails = "file_permanently_delete_details" + EventDetailsFilePreviewDetails = "file_preview_details" + EventDetailsFileRenameDetails = "file_rename_details" + EventDetailsFileRestoreDetails = "file_restore_details" + EventDetailsFileRevertDetails = "file_revert_details" + EventDetailsFileRollbackChangesDetails = "file_rollback_changes_details" + EventDetailsFileSaveCopyReferenceDetails = "file_save_copy_reference_details" + EventDetailsFileRequestAddDeadlineDetails = "file_request_add_deadline_details" + EventDetailsFileRequestChangeFolderDetails = "file_request_change_folder_details" + EventDetailsFileRequestChangeTitleDetails = "file_request_change_title_details" + EventDetailsFileRequestCloseDetails = "file_request_close_details" + EventDetailsFileRequestCreateDetails = "file_request_create_details" + EventDetailsFileRequestReceiveFileDetails = "file_request_receive_file_details" + EventDetailsFileRequestRemoveDeadlineDetails = "file_request_remove_deadline_details" + EventDetailsFileRequestSendDetails = "file_request_send_details" + EventDetailsGroupAddExternalIdDetails = "group_add_external_id_details" + EventDetailsGroupAddMemberDetails = "group_add_member_details" + EventDetailsGroupChangeExternalIdDetails = "group_change_external_id_details" + EventDetailsGroupChangeManagementTypeDetails = "group_change_management_type_details" + EventDetailsGroupChangeMemberRoleDetails = "group_change_member_role_details" + EventDetailsGroupCreateDetails = "group_create_details" + EventDetailsGroupDeleteDetails = "group_delete_details" + EventDetailsGroupDescriptionUpdatedDetails = "group_description_updated_details" + EventDetailsGroupJoinPolicyUpdatedDetails = "group_join_policy_updated_details" + EventDetailsGroupMovedDetails = "group_moved_details" + EventDetailsGroupRemoveExternalIdDetails = "group_remove_external_id_details" + EventDetailsGroupRemoveMemberDetails = "group_remove_member_details" + EventDetailsGroupRenameDetails = "group_rename_details" + EventDetailsEmmLoginSuccessDetails = "emm_login_success_details" + EventDetailsLogoutDetails = "logout_details" + EventDetailsPasswordLoginFailDetails = "password_login_fail_details" + EventDetailsPasswordLoginSuccessDetails = "password_login_success_details" + EventDetailsResellerSupportSessionEndDetails = "reseller_support_session_end_details" + EventDetailsResellerSupportSessionStartDetails = "reseller_support_session_start_details" + EventDetailsSignInAsSessionEndDetails = "sign_in_as_session_end_details" + EventDetailsSignInAsSessionStartDetails = "sign_in_as_session_start_details" + EventDetailsSsoLoginFailDetails = "sso_login_fail_details" + EventDetailsMemberAddNameDetails = "member_add_name_details" + EventDetailsMemberChangeAdminRoleDetails = "member_change_admin_role_details" + EventDetailsMemberChangeEmailDetails = "member_change_email_details" + EventDetailsMemberChangeNameDetails = "member_change_name_details" + EventDetailsMemberChangeStatusDetails = "member_change_status_details" + EventDetailsMemberSuggestDetails = "member_suggest_details" + EventDetailsPaperContentAddMemberDetails = "paper_content_add_member_details" + EventDetailsPaperContentAddToFolderDetails = "paper_content_add_to_folder_details" + EventDetailsPaperContentArchiveDetails = "paper_content_archive_details" + EventDetailsPaperContentChangeSubscriptionDetails = "paper_content_change_subscription_details" + EventDetailsPaperContentCreateDetails = "paper_content_create_details" + EventDetailsPaperContentPermanentlyDeleteDetails = "paper_content_permanently_delete_details" + EventDetailsPaperContentRemoveFromFolderDetails = "paper_content_remove_from_folder_details" + EventDetailsPaperContentRemoveMemberDetails = "paper_content_remove_member_details" + EventDetailsPaperContentRenameDetails = "paper_content_rename_details" + EventDetailsPaperContentRestoreDetails = "paper_content_restore_details" + EventDetailsPaperDocAddCommentDetails = "paper_doc_add_comment_details" + EventDetailsPaperDocChangeMemberRoleDetails = "paper_doc_change_member_role_details" + EventDetailsPaperDocChangeSharingPolicyDetails = "paper_doc_change_sharing_policy_details" + EventDetailsPaperDocDeletedDetails = "paper_doc_deleted_details" + EventDetailsPaperDocDeleteCommentDetails = "paper_doc_delete_comment_details" + EventDetailsPaperDocDownloadDetails = "paper_doc_download_details" + EventDetailsPaperDocEditDetails = "paper_doc_edit_details" + EventDetailsPaperDocEditCommentDetails = "paper_doc_edit_comment_details" + EventDetailsPaperDocFollowedDetails = "paper_doc_followed_details" + EventDetailsPaperDocMentionDetails = "paper_doc_mention_details" + EventDetailsPaperDocRequestAccessDetails = "paper_doc_request_access_details" + EventDetailsPaperDocResolveCommentDetails = "paper_doc_resolve_comment_details" + EventDetailsPaperDocRevertDetails = "paper_doc_revert_details" + EventDetailsPaperDocSlackShareDetails = "paper_doc_slack_share_details" + EventDetailsPaperDocTeamInviteDetails = "paper_doc_team_invite_details" + EventDetailsPaperDocUnresolveCommentDetails = "paper_doc_unresolve_comment_details" + EventDetailsPaperDocViewDetails = "paper_doc_view_details" + EventDetailsPaperFolderDeletedDetails = "paper_folder_deleted_details" + EventDetailsPaperFolderFollowedDetails = "paper_folder_followed_details" + EventDetailsPaperFolderTeamInviteDetails = "paper_folder_team_invite_details" + EventDetailsPasswordChangeDetails = "password_change_details" + EventDetailsPasswordResetDetails = "password_reset_details" + EventDetailsPasswordResetAllDetails = "password_reset_all_details" + EventDetailsEmmCreateExceptionsReportDetails = "emm_create_exceptions_report_details" + EventDetailsEmmCreateUsageReportDetails = "emm_create_usage_report_details" + EventDetailsSmartSyncCreateAdminPrivilegeReportDetails = "smart_sync_create_admin_privilege_report_details" + EventDetailsTeamActivityCreateReportDetails = "team_activity_create_report_details" + EventDetailsCollectionShareDetails = "collection_share_details" + EventDetailsFileAddCommentDetails = "file_add_comment_details" + EventDetailsFileLikeCommentDetails = "file_like_comment_details" + EventDetailsFileUnlikeCommentDetails = "file_unlike_comment_details" + EventDetailsNoteAclInviteOnlyDetails = "note_acl_invite_only_details" + EventDetailsNoteAclLinkDetails = "note_acl_link_details" + EventDetailsNoteAclTeamLinkDetails = "note_acl_team_link_details" + EventDetailsNoteSharedDetails = "note_shared_details" + EventDetailsNoteShareReceiveDetails = "note_share_receive_details" + EventDetailsOpenNoteSharedDetails = "open_note_shared_details" + EventDetailsSfAddGroupDetails = "sf_add_group_details" + EventDetailsSfAllowNonMembersToViewSharedLinksDetails = "sf_allow_non_members_to_view_shared_links_details" + EventDetailsSfInviteGroupDetails = "sf_invite_group_details" + EventDetailsSfNestDetails = "sf_nest_details" + EventDetailsSfTeamDeclineDetails = "sf_team_decline_details" + EventDetailsSfTeamGrantAccessDetails = "sf_team_grant_access_details" + EventDetailsSfTeamInviteDetails = "sf_team_invite_details" + EventDetailsSfTeamInviteChangeRoleDetails = "sf_team_invite_change_role_details" + EventDetailsSfTeamJoinDetails = "sf_team_join_details" + EventDetailsSfTeamJoinFromOobLinkDetails = "sf_team_join_from_oob_link_details" + EventDetailsSfTeamUninviteDetails = "sf_team_uninvite_details" + EventDetailsSharedContentAddInviteesDetails = "shared_content_add_invitees_details" + EventDetailsSharedContentAddLinkExpiryDetails = "shared_content_add_link_expiry_details" + EventDetailsSharedContentAddLinkPasswordDetails = "shared_content_add_link_password_details" + EventDetailsSharedContentAddMemberDetails = "shared_content_add_member_details" + EventDetailsSharedContentChangeDownloadsPolicyDetails = "shared_content_change_downloads_policy_details" + EventDetailsSharedContentChangeInviteeRoleDetails = "shared_content_change_invitee_role_details" + EventDetailsSharedContentChangeLinkAudienceDetails = "shared_content_change_link_audience_details" + EventDetailsSharedContentChangeLinkExpiryDetails = "shared_content_change_link_expiry_details" + EventDetailsSharedContentChangeLinkPasswordDetails = "shared_content_change_link_password_details" + EventDetailsSharedContentChangeMemberRoleDetails = "shared_content_change_member_role_details" + EventDetailsSharedContentChangeViewerInfoPolicyDetails = "shared_content_change_viewer_info_policy_details" + EventDetailsSharedContentClaimInvitationDetails = "shared_content_claim_invitation_details" + EventDetailsSharedContentCopyDetails = "shared_content_copy_details" + EventDetailsSharedContentDownloadDetails = "shared_content_download_details" + EventDetailsSharedContentRelinquishMembershipDetails = "shared_content_relinquish_membership_details" + EventDetailsSharedContentRemoveInviteeDetails = "shared_content_remove_invitee_details" + EventDetailsSharedContentRemoveLinkExpiryDetails = "shared_content_remove_link_expiry_details" + EventDetailsSharedContentRemoveLinkPasswordDetails = "shared_content_remove_link_password_details" + EventDetailsSharedContentRemoveMemberDetails = "shared_content_remove_member_details" + EventDetailsSharedContentRequestAccessDetails = "shared_content_request_access_details" + EventDetailsSharedContentUnshareDetails = "shared_content_unshare_details" + EventDetailsSharedContentViewDetails = "shared_content_view_details" + EventDetailsSharedFolderChangeConfidentialityDetails = "shared_folder_change_confidentiality_details" + EventDetailsSharedFolderChangeLinkPolicyDetails = "shared_folder_change_link_policy_details" + EventDetailsSharedFolderChangeMemberManagementPolicyDetails = "shared_folder_change_member_management_policy_details" + EventDetailsSharedFolderChangeMemberPolicyDetails = "shared_folder_change_member_policy_details" + EventDetailsSharedFolderCreateDetails = "shared_folder_create_details" + EventDetailsSharedFolderMountDetails = "shared_folder_mount_details" + EventDetailsSharedFolderTransferOwnershipDetails = "shared_folder_transfer_ownership_details" + EventDetailsSharedFolderUnmountDetails = "shared_folder_unmount_details" + EventDetailsSharedNoteOpenedDetails = "shared_note_opened_details" + EventDetailsShmodelAppCreateDetails = "shmodel_app_create_details" + EventDetailsShmodelCreateDetails = "shmodel_create_details" + EventDetailsShmodelDisableDetails = "shmodel_disable_details" + EventDetailsShmodelFbShareDetails = "shmodel_fb_share_details" + EventDetailsShmodelGroupShareDetails = "shmodel_group_share_details" + EventDetailsShmodelRemoveExpirationDetails = "shmodel_remove_expiration_details" + EventDetailsShmodelSetExpirationDetails = "shmodel_set_expiration_details" + EventDetailsShmodelTeamCopyDetails = "shmodel_team_copy_details" + EventDetailsShmodelTeamDownloadDetails = "shmodel_team_download_details" + EventDetailsShmodelTeamShareDetails = "shmodel_team_share_details" + EventDetailsShmodelTeamViewDetails = "shmodel_team_view_details" + EventDetailsShmodelVisibilityPasswordDetails = "shmodel_visibility_password_details" + EventDetailsShmodelVisibilityPublicDetails = "shmodel_visibility_public_details" + EventDetailsShmodelVisibilityTeamOnlyDetails = "shmodel_visibility_team_only_details" + EventDetailsRemoveLogoutUrlDetails = "remove_logout_url_details" + EventDetailsRemoveSsoUrlDetails = "remove_sso_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" + EventDetailsTeamFolderChangeStatusDetails = "team_folder_change_status_details" + EventDetailsTeamFolderCreateDetails = "team_folder_create_details" + EventDetailsTeamFolderDowngradeDetails = "team_folder_downgrade_details" + EventDetailsTeamFolderPermanentlyDeleteDetails = "team_folder_permanently_delete_details" + EventDetailsTeamFolderRenameDetails = "team_folder_rename_details" + EventDetailsAccountCaptureChangePolicyDetails = "account_capture_change_policy_details" + EventDetailsAllowDownloadDisabledDetails = "allow_download_disabled_details" + EventDetailsAllowDownloadEnabledDetails = "allow_download_enabled_details" + EventDetailsDataPlacementRestrictionChangePolicyDetails = "data_placement_restriction_change_policy_details" + EventDetailsDataPlacementRestrictionSatisfyPolicyDetails = "data_placement_restriction_satisfy_policy_details" + EventDetailsDeviceApprovalsChangeDesktopPolicyDetails = "device_approvals_change_desktop_policy_details" + EventDetailsDeviceApprovalsChangeMobilePolicyDetails = "device_approvals_change_mobile_policy_details" + EventDetailsDeviceApprovalsChangeOverageActionDetails = "device_approvals_change_overage_action_details" + EventDetailsDeviceApprovalsChangeUnlinkActionDetails = "device_approvals_change_unlink_action_details" + EventDetailsEmmAddExceptionDetails = "emm_add_exception_details" + EventDetailsEmmChangePolicyDetails = "emm_change_policy_details" + EventDetailsEmmRemoveExceptionDetails = "emm_remove_exception_details" + EventDetailsExtendedVersionHistoryChangePolicyDetails = "extended_version_history_change_policy_details" + EventDetailsFileCommentsChangePolicyDetails = "file_comments_change_policy_details" + EventDetailsFileRequestsChangePolicyDetails = "file_requests_change_policy_details" + EventDetailsFileRequestsEmailsEnabledDetails = "file_requests_emails_enabled_details" + EventDetailsFileRequestsEmailsRestrictedToTeamOnlyDetails = "file_requests_emails_restricted_to_team_only_details" + EventDetailsGoogleSsoChangePolicyDetails = "google_sso_change_policy_details" + EventDetailsGroupUserManagementChangePolicyDetails = "group_user_management_change_policy_details" + EventDetailsMemberRequestsChangePolicyDetails = "member_requests_change_policy_details" + EventDetailsMemberSpaceLimitsAddExceptionDetails = "member_space_limits_add_exception_details" + EventDetailsMemberSpaceLimitsChangePolicyDetails = "member_space_limits_change_policy_details" + EventDetailsMemberSpaceLimitsRemoveExceptionDetails = "member_space_limits_remove_exception_details" + EventDetailsMemberSuggestionsChangePolicyDetails = "member_suggestions_change_policy_details" + EventDetailsMicrosoftOfficeAddinChangePolicyDetails = "microsoft_office_addin_change_policy_details" + EventDetailsNetworkControlChangePolicyDetails = "network_control_change_policy_details" + EventDetailsPaperChangeDeploymentPolicyDetails = "paper_change_deployment_policy_details" + EventDetailsPaperChangeMemberPolicyDetails = "paper_change_member_policy_details" + EventDetailsPaperChangePolicyDetails = "paper_change_policy_details" + EventDetailsPermanentDeleteChangePolicyDetails = "permanent_delete_change_policy_details" + EventDetailsSharingChangeFolderJoinPolicyDetails = "sharing_change_folder_join_policy_details" + EventDetailsSharingChangeLinkPolicyDetails = "sharing_change_link_policy_details" + EventDetailsSharingChangeMemberPolicyDetails = "sharing_change_member_policy_details" + EventDetailsSmartSyncChangePolicyDetails = "smart_sync_change_policy_details" + EventDetailsSmartSyncNotOptOutDetails = "smart_sync_not_opt_out_details" + EventDetailsSmartSyncOptOutDetails = "smart_sync_opt_out_details" + EventDetailsSsoChangePolicyDetails = "sso_change_policy_details" + EventDetailsTfaChangePolicyDetails = "tfa_change_policy_details" + EventDetailsTwoAccountChangePolicyDetails = "two_account_change_policy_details" + EventDetailsWebSessionsChangeFixedLengthPolicyDetails = "web_sessions_change_fixed_length_policy_details" + EventDetailsWebSessionsChangeIdleLengthPolicyDetails = "web_sessions_change_idle_length_policy_details" + EventDetailsTeamProfileAddLogoDetails = "team_profile_add_logo_details" + EventDetailsTeamProfileChangeLogoDetails = "team_profile_change_logo_details" + EventDetailsTeamProfileChangeNameDetails = "team_profile_change_name_details" + EventDetailsTeamProfileRemoveLogoDetails = "team_profile_remove_logo_details" + EventDetailsTfaAddBackupPhoneDetails = "tfa_add_backup_phone_details" + EventDetailsTfaAddSecurityKeyDetails = "tfa_add_security_key_details" + EventDetailsTfaChangeBackupPhoneDetails = "tfa_change_backup_phone_details" + EventDetailsTfaChangeStatusDetails = "tfa_change_status_details" + EventDetailsTfaRemoveBackupPhoneDetails = "tfa_remove_backup_phone_details" + EventDetailsTfaRemoveSecurityKeyDetails = "tfa_remove_security_key_details" + EventDetailsTfaResetDetails = "tfa_reset_details" + EventDetailsMissingDetails = "missing_details" + EventDetailsOther = "other" +) + +// UnmarshalJSON deserializes into a EventDetails instance +func (u *EventDetails) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // MemberChangeMembershipTypeDetails : Changed the membership type + // (limited vs full) for team member. + MemberChangeMembershipTypeDetails json.RawMessage `json:"member_change_membership_type_details,omitempty"` + // MemberPermanentlyDeleteAccountContentsDetails : Permanently deleted + // contents of a removed team member account. + MemberPermanentlyDeleteAccountContentsDetails json.RawMessage `json:"member_permanently_delete_account_contents_details,omitempty"` + // MemberSpaceLimitsChangeStatusDetails : Changed the status with + // respect to whether the team member is under or over storage quota + // specified by policy. + MemberSpaceLimitsChangeStatusDetails json.RawMessage `json:"member_space_limits_change_status_details,omitempty"` + // MemberTransferAccountContentsDetails : Transferred contents of a + // removed team member account to another member. + MemberTransferAccountContentsDetails json.RawMessage `json:"member_transfer_account_contents_details,omitempty"` + // PaperEnabledUsersGroupAdditionDetails : Users added to Paper enabled + // users list. + PaperEnabledUsersGroupAdditionDetails json.RawMessage `json:"paper_enabled_users_group_addition_details,omitempty"` + // PaperEnabledUsersGroupRemovalDetails : Users removed from Paper + // enabled users list. + PaperEnabledUsersGroupRemovalDetails json.RawMessage `json:"paper_enabled_users_group_removal_details,omitempty"` + // PaperExternalViewAllowDetails : Paper external sharing policy + // changed: anyone. + PaperExternalViewAllowDetails json.RawMessage `json:"paper_external_view_allow_details,omitempty"` + // PaperExternalViewDefaultTeamDetails : Paper external sharing policy + // changed: default team. + PaperExternalViewDefaultTeamDetails json.RawMessage `json:"paper_external_view_default_team_details,omitempty"` + // PaperExternalViewForbidDetails : Paper external sharing policy + // changed: team-only. + PaperExternalViewForbidDetails json.RawMessage `json:"paper_external_view_forbid_details,omitempty"` + // SfExternalInviteWarnDetails : Admin settings: team members see a + // warning before sharing folders outside the team (DEPRECATED FEATURE). + SfExternalInviteWarnDetails json.RawMessage `json:"sf_external_invite_warn_details,omitempty"` + // TeamMergeFromDetails : Merged another team into this team. + TeamMergeFromDetails json.RawMessage `json:"team_merge_from_details,omitempty"` + // TeamMergeToDetails : Merged this team into another team. + TeamMergeToDetails json.RawMessage `json:"team_merge_to_details,omitempty"` + // AppLinkTeamDetails : Linked an app for team. + AppLinkTeamDetails json.RawMessage `json:"app_link_team_details,omitempty"` + // AppLinkUserDetails : Linked an app for team member. + AppLinkUserDetails json.RawMessage `json:"app_link_user_details,omitempty"` + // AppUnlinkTeamDetails : Unlinked an app for team. + AppUnlinkTeamDetails json.RawMessage `json:"app_unlink_team_details,omitempty"` + // AppUnlinkUserDetails : Unlinked an app for team member. + AppUnlinkUserDetails json.RawMessage `json:"app_unlink_user_details,omitempty"` + // DeviceChangeIpDesktopDetails : IP address associated with active + // desktop session changed. + DeviceChangeIpDesktopDetails json.RawMessage `json:"device_change_ip_desktop_details,omitempty"` + // DeviceChangeIpMobileDetails : IP address associated with active + // mobile session changed. + DeviceChangeIpMobileDetails json.RawMessage `json:"device_change_ip_mobile_details,omitempty"` + // DeviceChangeIpWebDetails : IP address associated with active Web + // session changed. + DeviceChangeIpWebDetails json.RawMessage `json:"device_change_ip_web_details,omitempty"` + // DeviceDeleteOnUnlinkFailDetails : Failed to delete all files from an + // unlinked device. + DeviceDeleteOnUnlinkFailDetails json.RawMessage `json:"device_delete_on_unlink_fail_details,omitempty"` + // DeviceDeleteOnUnlinkSuccessDetails : Deleted all files from an + // unlinked device. + DeviceDeleteOnUnlinkSuccessDetails json.RawMessage `json:"device_delete_on_unlink_success_details,omitempty"` + // DeviceLinkFailDetails : Failed to link a device. + DeviceLinkFailDetails json.RawMessage `json:"device_link_fail_details,omitempty"` + // DeviceLinkSuccessDetails : Linked a device. + DeviceLinkSuccessDetails json.RawMessage `json:"device_link_success_details,omitempty"` + // DeviceManagementDisabledDetails : Disable Device Management. + DeviceManagementDisabledDetails json.RawMessage `json:"device_management_disabled_details,omitempty"` + // DeviceManagementEnabledDetails : Enable Device Management. + DeviceManagementEnabledDetails json.RawMessage `json:"device_management_enabled_details,omitempty"` + // DeviceUnlinkDetails : Disconnected a device. + DeviceUnlinkDetails json.RawMessage `json:"device_unlink_details,omitempty"` + // EmmRefreshAuthTokenDetails : Refreshed the auth token used for + // setting up enterprise mobility management. + EmmRefreshAuthTokenDetails json.RawMessage `json:"emm_refresh_auth_token_details,omitempty"` + // AccountCaptureChangeAvailabilityDetails : Granted or revoked the + // option to enable account capture on domains belonging to the team. + AccountCaptureChangeAvailabilityDetails json.RawMessage `json:"account_capture_change_availability_details,omitempty"` + // AccountCaptureMigrateAccountDetails : Account captured user migrated + // their account to the team. + AccountCaptureMigrateAccountDetails json.RawMessage `json:"account_capture_migrate_account_details,omitempty"` + // AccountCaptureRelinquishAccountDetails : Account captured user + // relinquished their account by changing the email address associated + // with it. + AccountCaptureRelinquishAccountDetails json.RawMessage `json:"account_capture_relinquish_account_details,omitempty"` + // DisabledDomainInvitesDetails : Disabled domain invites. + DisabledDomainInvitesDetails json.RawMessage `json:"disabled_domain_invites_details,omitempty"` + // DomainInvitesApproveRequestToJoinTeamDetails : Approved a member's + // request to join the team. + DomainInvitesApproveRequestToJoinTeamDetails json.RawMessage `json:"domain_invites_approve_request_to_join_team_details,omitempty"` + // DomainInvitesDeclineRequestToJoinTeamDetails : Declined a user's + // request to join the team. + DomainInvitesDeclineRequestToJoinTeamDetails json.RawMessage `json:"domain_invites_decline_request_to_join_team_details,omitempty"` + // DomainInvitesEmailExistingUsersDetails : Sent domain invites to + // existing domain accounts. + DomainInvitesEmailExistingUsersDetails json.RawMessage `json:"domain_invites_email_existing_users_details,omitempty"` + // DomainInvitesRequestToJoinTeamDetails : Asked to join the team. + DomainInvitesRequestToJoinTeamDetails json.RawMessage `json:"domain_invites_request_to_join_team_details,omitempty"` + // DomainInvitesSetInviteNewUserPrefToNoDetails : Turned off + // u201cAutomatically invite new usersu201d. + DomainInvitesSetInviteNewUserPrefToNoDetails json.RawMessage `json:"domain_invites_set_invite_new_user_pref_to_no_details,omitempty"` + // DomainInvitesSetInviteNewUserPrefToYesDetails : Turned on + // u201cAutomatically invite new usersu201d. + DomainInvitesSetInviteNewUserPrefToYesDetails json.RawMessage `json:"domain_invites_set_invite_new_user_pref_to_yes_details,omitempty"` + // DomainVerificationAddDomainFailDetails : Failed to verify a domain + // belonging to the team. + DomainVerificationAddDomainFailDetails json.RawMessage `json:"domain_verification_add_domain_fail_details,omitempty"` + // DomainVerificationAddDomainSuccessDetails : Verified a domain + // belonging to the team. + DomainVerificationAddDomainSuccessDetails json.RawMessage `json:"domain_verification_add_domain_success_details,omitempty"` + // DomainVerificationRemoveDomainDetails : Removed a domain from the + // list of verified domains belonging to the team. + DomainVerificationRemoveDomainDetails json.RawMessage `json:"domain_verification_remove_domain_details,omitempty"` + // EnabledDomainInvitesDetails : Enabled domain invites. + EnabledDomainInvitesDetails json.RawMessage `json:"enabled_domain_invites_details,omitempty"` + // CreateFolderDetails : Created folders. + CreateFolderDetails json.RawMessage `json:"create_folder_details,omitempty"` + // FileAddDetails : Added files and/or folders. + FileAddDetails json.RawMessage `json:"file_add_details,omitempty"` + // FileCopyDetails : Copied files and/or folders. + FileCopyDetails json.RawMessage `json:"file_copy_details,omitempty"` + // FileDeleteDetails : Deleted files and/or folders. + FileDeleteDetails json.RawMessage `json:"file_delete_details,omitempty"` + // FileDownloadDetails : Downloaded files and/or folders. + FileDownloadDetails json.RawMessage `json:"file_download_details,omitempty"` + // FileEditDetails : Edited files. + FileEditDetails json.RawMessage `json:"file_edit_details,omitempty"` + // FileGetCopyReferenceDetails : Create a copy reference to a file or + // folder. + FileGetCopyReferenceDetails json.RawMessage `json:"file_get_copy_reference_details,omitempty"` + // FileMoveDetails : Moved files and/or folders. + FileMoveDetails json.RawMessage `json:"file_move_details,omitempty"` + // FilePermanentlyDeleteDetails : Permanently deleted files and/or + // folders. + FilePermanentlyDeleteDetails json.RawMessage `json:"file_permanently_delete_details,omitempty"` + // FilePreviewDetails : Previewed files and/or folders. + FilePreviewDetails json.RawMessage `json:"file_preview_details,omitempty"` + // FileRenameDetails : Renamed files and/or folders. + FileRenameDetails json.RawMessage `json:"file_rename_details,omitempty"` + // FileRestoreDetails : Restored deleted files and/or folders. + FileRestoreDetails json.RawMessage `json:"file_restore_details,omitempty"` + // FileRevertDetails : Reverted files to a previous version. + FileRevertDetails json.RawMessage `json:"file_revert_details,omitempty"` + // FileRollbackChangesDetails : Rolled back file change location + // changes. + FileRollbackChangesDetails json.RawMessage `json:"file_rollback_changes_details,omitempty"` + // FileSaveCopyReferenceDetails : Save a file or folder using a copy + // reference. + FileSaveCopyReferenceDetails json.RawMessage `json:"file_save_copy_reference_details,omitempty"` + // FileRequestAddDeadlineDetails : Added a deadline to a file request. + FileRequestAddDeadlineDetails json.RawMessage `json:"file_request_add_deadline_details,omitempty"` + // FileRequestChangeFolderDetails : Changed the file request folder. + FileRequestChangeFolderDetails json.RawMessage `json:"file_request_change_folder_details,omitempty"` + // FileRequestChangeTitleDetails : Change the file request title. + FileRequestChangeTitleDetails json.RawMessage `json:"file_request_change_title_details,omitempty"` + // FileRequestCloseDetails : Closed a file request. + FileRequestCloseDetails json.RawMessage `json:"file_request_close_details,omitempty"` + // FileRequestCreateDetails : Created a file request. + FileRequestCreateDetails json.RawMessage `json:"file_request_create_details,omitempty"` + // FileRequestReceiveFileDetails : Received files for a file request. + FileRequestReceiveFileDetails json.RawMessage `json:"file_request_receive_file_details,omitempty"` + // FileRequestRemoveDeadlineDetails : Removed the file request deadline. + FileRequestRemoveDeadlineDetails json.RawMessage `json:"file_request_remove_deadline_details,omitempty"` + // FileRequestSendDetails : Sent file request to users via email. + FileRequestSendDetails json.RawMessage `json:"file_request_send_details,omitempty"` + // GroupAddExternalIdDetails : Added an external ID for group. + GroupAddExternalIdDetails json.RawMessage `json:"group_add_external_id_details,omitempty"` + // GroupAddMemberDetails : Added team members to a group. + GroupAddMemberDetails json.RawMessage `json:"group_add_member_details,omitempty"` + // GroupChangeExternalIdDetails : Changed the external ID for group. + GroupChangeExternalIdDetails json.RawMessage `json:"group_change_external_id_details,omitempty"` + // GroupChangeManagementTypeDetails : Changed group management type. + GroupChangeManagementTypeDetails json.RawMessage `json:"group_change_management_type_details,omitempty"` + // GroupChangeMemberRoleDetails : Changed the manager permissions + // belonging to a group member. + GroupChangeMemberRoleDetails json.RawMessage `json:"group_change_member_role_details,omitempty"` + // GroupCreateDetails : Created a group. + GroupCreateDetails json.RawMessage `json:"group_create_details,omitempty"` + // GroupDeleteDetails : Deleted a group. + GroupDeleteDetails json.RawMessage `json:"group_delete_details,omitempty"` + // GroupDescriptionUpdatedDetails : Updated a group. + GroupDescriptionUpdatedDetails json.RawMessage `json:"group_description_updated_details,omitempty"` + // GroupJoinPolicyUpdatedDetails : Updated a group join policy. + GroupJoinPolicyUpdatedDetails json.RawMessage `json:"group_join_policy_updated_details,omitempty"` + // GroupMovedDetails : Moved a group. + GroupMovedDetails json.RawMessage `json:"group_moved_details,omitempty"` + // GroupRemoveExternalIdDetails : Removed the external ID for group. + GroupRemoveExternalIdDetails json.RawMessage `json:"group_remove_external_id_details,omitempty"` + // GroupRemoveMemberDetails : Removed team members from a group. + GroupRemoveMemberDetails json.RawMessage `json:"group_remove_member_details,omitempty"` + // GroupRenameDetails : Renamed a group. + GroupRenameDetails json.RawMessage `json:"group_rename_details,omitempty"` + // EmmLoginSuccessDetails : Signed in using the Dropbox EMM app. + EmmLoginSuccessDetails json.RawMessage `json:"emm_login_success_details,omitempty"` + // LogoutDetails : Signed out. + LogoutDetails json.RawMessage `json:"logout_details,omitempty"` + // PasswordLoginFailDetails : Failed to sign in using a password. + PasswordLoginFailDetails json.RawMessage `json:"password_login_fail_details,omitempty"` + // PasswordLoginSuccessDetails : Signed in using a password. + PasswordLoginSuccessDetails json.RawMessage `json:"password_login_success_details,omitempty"` + // ResellerSupportSessionEndDetails : Ended reseller support session. + ResellerSupportSessionEndDetails json.RawMessage `json:"reseller_support_session_end_details,omitempty"` + // ResellerSupportSessionStartDetails : Started reseller support + // session. + ResellerSupportSessionStartDetails json.RawMessage `json:"reseller_support_session_start_details,omitempty"` + // SignInAsSessionEndDetails : Ended admin sign-in-as session. + SignInAsSessionEndDetails json.RawMessage `json:"sign_in_as_session_end_details,omitempty"` + // SignInAsSessionStartDetails : Started admin sign-in-as session. + SignInAsSessionStartDetails json.RawMessage `json:"sign_in_as_session_start_details,omitempty"` + // SsoLoginFailDetails : Failed to sign in using SSO. + SsoLoginFailDetails json.RawMessage `json:"sso_login_fail_details,omitempty"` + // MemberAddNameDetails : Set team member name when joining team. + MemberAddNameDetails json.RawMessage `json:"member_add_name_details,omitempty"` + // MemberChangeAdminRoleDetails : Change the admin role belonging to + // team member. + MemberChangeAdminRoleDetails json.RawMessage `json:"member_change_admin_role_details,omitempty"` + // MemberChangeEmailDetails : Changed team member email address. + MemberChangeEmailDetails json.RawMessage `json:"member_change_email_details,omitempty"` + // MemberChangeNameDetails : Changed team member name. + MemberChangeNameDetails json.RawMessage `json:"member_change_name_details,omitempty"` + // MemberChangeStatusDetails : Changed the membership status of a team + // member. + MemberChangeStatusDetails json.RawMessage `json:"member_change_status_details,omitempty"` + // MemberSuggestDetails : Suggested a new team member to be added to the + // team. + MemberSuggestDetails json.RawMessage `json:"member_suggest_details,omitempty"` + // PaperContentAddMemberDetails : Added users to the membership of a + // Paper doc or folder. + PaperContentAddMemberDetails json.RawMessage `json:"paper_content_add_member_details,omitempty"` + // PaperContentAddToFolderDetails : Added Paper doc or folder to a + // folder. + PaperContentAddToFolderDetails json.RawMessage `json:"paper_content_add_to_folder_details,omitempty"` + // PaperContentArchiveDetails : Archived Paper doc or folder. + PaperContentArchiveDetails json.RawMessage `json:"paper_content_archive_details,omitempty"` + // PaperContentChangeSubscriptionDetails : Followed or unfollowed a + // Paper doc or folder. + PaperContentChangeSubscriptionDetails json.RawMessage `json:"paper_content_change_subscription_details,omitempty"` + // PaperContentCreateDetails : Created a Paper doc or folder. + PaperContentCreateDetails json.RawMessage `json:"paper_content_create_details,omitempty"` + // PaperContentPermanentlyDeleteDetails : Permanently deleted a Paper + // doc or folder. + PaperContentPermanentlyDeleteDetails json.RawMessage `json:"paper_content_permanently_delete_details,omitempty"` + // PaperContentRemoveFromFolderDetails : Removed Paper doc or folder + // from a folder. + PaperContentRemoveFromFolderDetails json.RawMessage `json:"paper_content_remove_from_folder_details,omitempty"` + // PaperContentRemoveMemberDetails : Removed a user from the membership + // of a Paper doc or folder. + PaperContentRemoveMemberDetails json.RawMessage `json:"paper_content_remove_member_details,omitempty"` + // PaperContentRenameDetails : Renamed Paper doc or folder. + PaperContentRenameDetails json.RawMessage `json:"paper_content_rename_details,omitempty"` + // PaperContentRestoreDetails : Restored an archived Paper doc or + // folder. + PaperContentRestoreDetails json.RawMessage `json:"paper_content_restore_details,omitempty"` + // PaperDocAddCommentDetails : Added a Paper doc comment. + PaperDocAddCommentDetails json.RawMessage `json:"paper_doc_add_comment_details,omitempty"` + // PaperDocChangeMemberRoleDetails : Changed the access type of a Paper + // doc member. + PaperDocChangeMemberRoleDetails json.RawMessage `json:"paper_doc_change_member_role_details,omitempty"` + // PaperDocChangeSharingPolicyDetails : Changed the sharing policy for + // Paper doc. + PaperDocChangeSharingPolicyDetails json.RawMessage `json:"paper_doc_change_sharing_policy_details,omitempty"` + // PaperDocDeletedDetails : Paper doc archived. + PaperDocDeletedDetails json.RawMessage `json:"paper_doc_deleted_details,omitempty"` + // PaperDocDeleteCommentDetails : Deleted a Paper doc comment. + PaperDocDeleteCommentDetails json.RawMessage `json:"paper_doc_delete_comment_details,omitempty"` + // PaperDocDownloadDetails : Downloaded a Paper doc in a particular + // output format. + PaperDocDownloadDetails json.RawMessage `json:"paper_doc_download_details,omitempty"` + // PaperDocEditDetails : Edited a Paper doc. + PaperDocEditDetails json.RawMessage `json:"paper_doc_edit_details,omitempty"` + // PaperDocEditCommentDetails : Edited a Paper doc comment. + PaperDocEditCommentDetails json.RawMessage `json:"paper_doc_edit_comment_details,omitempty"` + // PaperDocFollowedDetails : Followed a Paper doc. + PaperDocFollowedDetails json.RawMessage `json:"paper_doc_followed_details,omitempty"` + // PaperDocMentionDetails : Mentioned a member in a Paper doc. + PaperDocMentionDetails json.RawMessage `json:"paper_doc_mention_details,omitempty"` + // PaperDocRequestAccessDetails : Requested to be a member on a Paper + // doc. + PaperDocRequestAccessDetails json.RawMessage `json:"paper_doc_request_access_details,omitempty"` + // PaperDocResolveCommentDetails : Paper doc comment resolved. + PaperDocResolveCommentDetails json.RawMessage `json:"paper_doc_resolve_comment_details,omitempty"` + // PaperDocRevertDetails : Restored a Paper doc to previous revision. + PaperDocRevertDetails json.RawMessage `json:"paper_doc_revert_details,omitempty"` + // PaperDocSlackShareDetails : Paper doc link shared via slack. + PaperDocSlackShareDetails json.RawMessage `json:"paper_doc_slack_share_details,omitempty"` + // PaperDocTeamInviteDetails : Paper doc shared with team member. + PaperDocTeamInviteDetails json.RawMessage `json:"paper_doc_team_invite_details,omitempty"` + // PaperDocUnresolveCommentDetails : Unresolved a Paper doc comment. + PaperDocUnresolveCommentDetails json.RawMessage `json:"paper_doc_unresolve_comment_details,omitempty"` + // PaperDocViewDetails : Viewed Paper doc. + PaperDocViewDetails json.RawMessage `json:"paper_doc_view_details,omitempty"` + // PaperFolderDeletedDetails : Paper folder archived. + PaperFolderDeletedDetails json.RawMessage `json:"paper_folder_deleted_details,omitempty"` + // PaperFolderFollowedDetails : Followed a Paper folder. + PaperFolderFollowedDetails json.RawMessage `json:"paper_folder_followed_details,omitempty"` + // PaperFolderTeamInviteDetails : Paper folder shared with team member. + PaperFolderTeamInviteDetails json.RawMessage `json:"paper_folder_team_invite_details,omitempty"` + // PasswordChangeDetails : Changed password. + PasswordChangeDetails json.RawMessage `json:"password_change_details,omitempty"` + // PasswordResetDetails : Reset password. + PasswordResetDetails json.RawMessage `json:"password_reset_details,omitempty"` + // PasswordResetAllDetails : Reset all team member passwords. + PasswordResetAllDetails json.RawMessage `json:"password_reset_all_details,omitempty"` + // EmmCreateExceptionsReportDetails : EMM excluded users report created. + EmmCreateExceptionsReportDetails json.RawMessage `json:"emm_create_exceptions_report_details,omitempty"` + // EmmCreateUsageReportDetails : EMM mobile app usage report created. + EmmCreateUsageReportDetails json.RawMessage `json:"emm_create_usage_report_details,omitempty"` + // SmartSyncCreateAdminPrivilegeReportDetails : Smart Sync non-admin + // devices report created. + SmartSyncCreateAdminPrivilegeReportDetails json.RawMessage `json:"smart_sync_create_admin_privilege_report_details,omitempty"` + // TeamActivityCreateReportDetails : Created a team activity report. + TeamActivityCreateReportDetails json.RawMessage `json:"team_activity_create_report_details,omitempty"` + // CollectionShareDetails : Shared an album. + CollectionShareDetails json.RawMessage `json:"collection_share_details,omitempty"` + // FileAddCommentDetails : Added a file comment. + FileAddCommentDetails json.RawMessage `json:"file_add_comment_details,omitempty"` + // FileLikeCommentDetails : Liked a file comment. + FileLikeCommentDetails json.RawMessage `json:"file_like_comment_details,omitempty"` + // FileUnlikeCommentDetails : Unliked a file comment. + FileUnlikeCommentDetails json.RawMessage `json:"file_unlike_comment_details,omitempty"` + // NoteAclInviteOnlyDetails : Changed a Paper document to be + // invite-only. + NoteAclInviteOnlyDetails json.RawMessage `json:"note_acl_invite_only_details,omitempty"` + // NoteAclLinkDetails : Changed a Paper document to be link accessible. + NoteAclLinkDetails json.RawMessage `json:"note_acl_link_details,omitempty"` + // NoteAclTeamLinkDetails : Changed a Paper document to be link + // accessible for the team. + NoteAclTeamLinkDetails json.RawMessage `json:"note_acl_team_link_details,omitempty"` + // NoteSharedDetails : Shared a Paper doc. + NoteSharedDetails json.RawMessage `json:"note_shared_details,omitempty"` + // NoteShareReceiveDetails : Shared Paper document received. + NoteShareReceiveDetails json.RawMessage `json:"note_share_receive_details,omitempty"` + // OpenNoteSharedDetails : Opened a shared Paper doc. + OpenNoteSharedDetails json.RawMessage `json:"open_note_shared_details,omitempty"` + // SfAddGroupDetails : Added the team to a shared folder. + SfAddGroupDetails json.RawMessage `json:"sf_add_group_details,omitempty"` + // SfAllowNonMembersToViewSharedLinksDetails : Allowed non collaborators + // to view links to files in a shared folder. + SfAllowNonMembersToViewSharedLinksDetails json.RawMessage `json:"sf_allow_non_members_to_view_shared_links_details,omitempty"` + // SfInviteGroupDetails : Invited a group to a shared folder. + SfInviteGroupDetails json.RawMessage `json:"sf_invite_group_details,omitempty"` + // SfNestDetails : Changed parent of shared folder. + SfNestDetails json.RawMessage `json:"sf_nest_details,omitempty"` + // SfTeamDeclineDetails : Declined a team member's invitation to a + // shared folder. + SfTeamDeclineDetails json.RawMessage `json:"sf_team_decline_details,omitempty"` + // SfTeamGrantAccessDetails : Granted access to a shared folder. + SfTeamGrantAccessDetails json.RawMessage `json:"sf_team_grant_access_details,omitempty"` + // SfTeamInviteDetails : Invited team members to a shared folder. + SfTeamInviteDetails json.RawMessage `json:"sf_team_invite_details,omitempty"` + // SfTeamInviteChangeRoleDetails : Changed a team member's role in a + // shared folder. + SfTeamInviteChangeRoleDetails json.RawMessage `json:"sf_team_invite_change_role_details,omitempty"` + // SfTeamJoinDetails : Joined a team member's shared folder. + SfTeamJoinDetails json.RawMessage `json:"sf_team_join_details,omitempty"` + // SfTeamJoinFromOobLinkDetails : Joined a team member's shared folder + // from a link. + SfTeamJoinFromOobLinkDetails json.RawMessage `json:"sf_team_join_from_oob_link_details,omitempty"` + // SfTeamUninviteDetails : Unshared a folder with a team member. + SfTeamUninviteDetails json.RawMessage `json:"sf_team_uninvite_details,omitempty"` + // SharedContentAddInviteesDetails : Sent an email invitation to the + // membership of a shared file or folder. + SharedContentAddInviteesDetails json.RawMessage `json:"shared_content_add_invitees_details,omitempty"` + // SharedContentAddLinkExpiryDetails : Added an expiry to the link for + // the shared file or folder. + SharedContentAddLinkExpiryDetails json.RawMessage `json:"shared_content_add_link_expiry_details,omitempty"` + // SharedContentAddLinkPasswordDetails : Added a password to the link + // for the shared file or folder. + SharedContentAddLinkPasswordDetails json.RawMessage `json:"shared_content_add_link_password_details,omitempty"` + // SharedContentAddMemberDetails : Added users and/or groups to the + // membership of a shared file or folder. + SharedContentAddMemberDetails json.RawMessage `json:"shared_content_add_member_details,omitempty"` + // SharedContentChangeDownloadsPolicyDetails : Changed whether members + // can download the shared file or folder. + SharedContentChangeDownloadsPolicyDetails json.RawMessage `json:"shared_content_change_downloads_policy_details,omitempty"` + // SharedContentChangeInviteeRoleDetails : Changed the access type of an + // invitee to a shared file or folder before the invitation was claimed. + SharedContentChangeInviteeRoleDetails json.RawMessage `json:"shared_content_change_invitee_role_details,omitempty"` + // SharedContentChangeLinkAudienceDetails : Changed the audience of the + // link for a shared file or folder. + SharedContentChangeLinkAudienceDetails json.RawMessage `json:"shared_content_change_link_audience_details,omitempty"` + // SharedContentChangeLinkExpiryDetails : Changed the expiry of the link + // for the shared file or folder. + SharedContentChangeLinkExpiryDetails json.RawMessage `json:"shared_content_change_link_expiry_details,omitempty"` + // SharedContentChangeLinkPasswordDetails : Changed the password on the + // link for the shared file or folder. + SharedContentChangeLinkPasswordDetails json.RawMessage `json:"shared_content_change_link_password_details,omitempty"` + // SharedContentChangeMemberRoleDetails : Changed the access type of a + // shared file or folder member. + SharedContentChangeMemberRoleDetails json.RawMessage `json:"shared_content_change_member_role_details,omitempty"` + // SharedContentChangeViewerInfoPolicyDetails : Changed whether members + // can see who viewed the shared file or folder. + SharedContentChangeViewerInfoPolicyDetails json.RawMessage `json:"shared_content_change_viewer_info_policy_details,omitempty"` + // SharedContentClaimInvitationDetails : Claimed membership to a team + // member's shared folder. + SharedContentClaimInvitationDetails json.RawMessage `json:"shared_content_claim_invitation_details,omitempty"` + // SharedContentCopyDetails : Copied the shared file or folder to own + // Dropbox. + SharedContentCopyDetails json.RawMessage `json:"shared_content_copy_details,omitempty"` + // SharedContentDownloadDetails : Downloaded the shared file or folder. + SharedContentDownloadDetails json.RawMessage `json:"shared_content_download_details,omitempty"` + // SharedContentRelinquishMembershipDetails : Left the membership of a + // shared file or folder. + SharedContentRelinquishMembershipDetails json.RawMessage `json:"shared_content_relinquish_membership_details,omitempty"` + // SharedContentRemoveInviteeDetails : Removed an invitee from the + // membership of a shared file or folder before it was claimed. + SharedContentRemoveInviteeDetails json.RawMessage `json:"shared_content_remove_invitee_details,omitempty"` + // SharedContentRemoveLinkExpiryDetails : Removed the expiry of the link + // for the shared file or folder. + SharedContentRemoveLinkExpiryDetails json.RawMessage `json:"shared_content_remove_link_expiry_details,omitempty"` + // SharedContentRemoveLinkPasswordDetails : Removed the password on the + // link for the shared file or folder. + SharedContentRemoveLinkPasswordDetails json.RawMessage `json:"shared_content_remove_link_password_details,omitempty"` + // SharedContentRemoveMemberDetails : Removed a user or a group from the + // membership of a shared file or folder. + SharedContentRemoveMemberDetails json.RawMessage `json:"shared_content_remove_member_details,omitempty"` + // SharedContentRequestAccessDetails : Requested to be on the membership + // of a shared file or folder. + SharedContentRequestAccessDetails json.RawMessage `json:"shared_content_request_access_details,omitempty"` + // SharedContentUnshareDetails : Unshared a shared file or folder by + // clearing its membership and turning off its link. + SharedContentUnshareDetails json.RawMessage `json:"shared_content_unshare_details,omitempty"` + // SharedContentViewDetails : Previewed the shared file or folder. + SharedContentViewDetails json.RawMessage `json:"shared_content_view_details,omitempty"` + // SharedFolderChangeConfidentialityDetails : Set or unset the + // confidential flag on a shared folder. + SharedFolderChangeConfidentialityDetails json.RawMessage `json:"shared_folder_change_confidentiality_details,omitempty"` + // SharedFolderChangeLinkPolicyDetails : Changed who can access the + // shared folder via a link. + SharedFolderChangeLinkPolicyDetails json.RawMessage `json:"shared_folder_change_link_policy_details,omitempty"` + // SharedFolderChangeMemberManagementPolicyDetails : Changed who can + // manage the membership of a shared folder. + SharedFolderChangeMemberManagementPolicyDetails json.RawMessage `json:"shared_folder_change_member_management_policy_details,omitempty"` + // SharedFolderChangeMemberPolicyDetails : Changed who can become a + // member of the shared folder. + SharedFolderChangeMemberPolicyDetails json.RawMessage `json:"shared_folder_change_member_policy_details,omitempty"` + // SharedFolderCreateDetails : Created a shared folder. + SharedFolderCreateDetails json.RawMessage `json:"shared_folder_create_details,omitempty"` + // SharedFolderMountDetails : Added a shared folder to own Dropbox. + SharedFolderMountDetails json.RawMessage `json:"shared_folder_mount_details,omitempty"` + // SharedFolderTransferOwnershipDetails : Transferred the ownership of a + // shared folder to another member. + SharedFolderTransferOwnershipDetails json.RawMessage `json:"shared_folder_transfer_ownership_details,omitempty"` + // SharedFolderUnmountDetails : Deleted a shared folder from Dropbox. + SharedFolderUnmountDetails json.RawMessage `json:"shared_folder_unmount_details,omitempty"` + // SharedNoteOpenedDetails : Shared Paper document was opened. + SharedNoteOpenedDetails json.RawMessage `json:"shared_note_opened_details,omitempty"` + // ShmodelAppCreateDetails : Created a link to a file using an app. + ShmodelAppCreateDetails json.RawMessage `json:"shmodel_app_create_details,omitempty"` + // ShmodelCreateDetails : Created a new link. + ShmodelCreateDetails json.RawMessage `json:"shmodel_create_details,omitempty"` + // ShmodelDisableDetails : Removed a link. + ShmodelDisableDetails json.RawMessage `json:"shmodel_disable_details,omitempty"` + // ShmodelFbShareDetails : Shared a link with Facebook users. + ShmodelFbShareDetails json.RawMessage `json:"shmodel_fb_share_details,omitempty"` + // ShmodelGroupShareDetails : Shared a link with a group. + ShmodelGroupShareDetails json.RawMessage `json:"shmodel_group_share_details,omitempty"` + // ShmodelRemoveExpirationDetails : Removed the expiration date from a + // link. + ShmodelRemoveExpirationDetails json.RawMessage `json:"shmodel_remove_expiration_details,omitempty"` + // ShmodelSetExpirationDetails : Added an expiration date to a link. + ShmodelSetExpirationDetails json.RawMessage `json:"shmodel_set_expiration_details,omitempty"` + // ShmodelTeamCopyDetails : Added a team member's file/folder to their + // Dropbox from a link. + ShmodelTeamCopyDetails json.RawMessage `json:"shmodel_team_copy_details,omitempty"` + // ShmodelTeamDownloadDetails : Downloaded a team member's file/folder + // from a link. + ShmodelTeamDownloadDetails json.RawMessage `json:"shmodel_team_download_details,omitempty"` + // ShmodelTeamShareDetails : Shared a link with team members. + ShmodelTeamShareDetails json.RawMessage `json:"shmodel_team_share_details,omitempty"` + // ShmodelTeamViewDetails : Opened a team member's link. + ShmodelTeamViewDetails json.RawMessage `json:"shmodel_team_view_details,omitempty"` + // ShmodelVisibilityPasswordDetails : Password-protected a link. + ShmodelVisibilityPasswordDetails json.RawMessage `json:"shmodel_visibility_password_details,omitempty"` + // ShmodelVisibilityPublicDetails : Made a file/folder visible to anyone + // with the link. + ShmodelVisibilityPublicDetails json.RawMessage `json:"shmodel_visibility_public_details,omitempty"` + // ShmodelVisibilityTeamOnlyDetails : Made a file/folder visible only to + // team members with the link. + ShmodelVisibilityTeamOnlyDetails json.RawMessage `json:"shmodel_visibility_team_only_details,omitempty"` + // RemoveLogoutUrlDetails : Removed single sign-on logout URL. + RemoveLogoutUrlDetails json.RawMessage `json:"remove_logout_url_details,omitempty"` + // RemoveSsoUrlDetails : Changed the sign-out URL for SSO. + RemoveSsoUrlDetails json.RawMessage `json:"remove_sso_url_details,omitempty"` + // SsoChangeCertDetails : Changed the X.509 certificate for SSO. + SsoChangeCertDetails json.RawMessage `json:"sso_change_cert_details,omitempty"` + // SsoChangeLoginUrlDetails : Changed the sign-in URL for SSO. + SsoChangeLoginUrlDetails json.RawMessage `json:"sso_change_login_url_details,omitempty"` + // SsoChangeLogoutUrlDetails : Changed the sign-out URL for SSO. + SsoChangeLogoutUrlDetails json.RawMessage `json:"sso_change_logout_url_details,omitempty"` + // SsoChangeSamlIdentityModeDetails : Changed the SAML identity mode for + // SSO. + SsoChangeSamlIdentityModeDetails json.RawMessage `json:"sso_change_saml_identity_mode_details,omitempty"` + // TeamFolderChangeStatusDetails : Changed the archival status of a team + // folder. + TeamFolderChangeStatusDetails json.RawMessage `json:"team_folder_change_status_details,omitempty"` + // TeamFolderCreateDetails : Created a new team folder in active status. + TeamFolderCreateDetails json.RawMessage `json:"team_folder_create_details,omitempty"` + // TeamFolderDowngradeDetails : Downgraded a team folder to a regular + // shared folder. + TeamFolderDowngradeDetails json.RawMessage `json:"team_folder_downgrade_details,omitempty"` + // TeamFolderPermanentlyDeleteDetails : Permanently deleted an archived + // team folder. + TeamFolderPermanentlyDeleteDetails json.RawMessage `json:"team_folder_permanently_delete_details,omitempty"` + // TeamFolderRenameDetails : Renamed an active or archived team folder. + TeamFolderRenameDetails json.RawMessage `json:"team_folder_rename_details,omitempty"` + // AccountCaptureChangePolicyDetails : Changed the account capture + // policy on a domain belonging to the team. + AccountCaptureChangePolicyDetails json.RawMessage `json:"account_capture_change_policy_details,omitempty"` + // AllowDownloadDisabledDetails : Disabled allow downloads. + AllowDownloadDisabledDetails json.RawMessage `json:"allow_download_disabled_details,omitempty"` + // AllowDownloadEnabledDetails : Enabled allow downloads. + AllowDownloadEnabledDetails json.RawMessage `json:"allow_download_enabled_details,omitempty"` + // DataPlacementRestrictionChangePolicyDetails : Set a restriction + // policy regarding the location of data centers where team data + // resides. + DataPlacementRestrictionChangePolicyDetails json.RawMessage `json:"data_placement_restriction_change_policy_details,omitempty"` + // DataPlacementRestrictionSatisfyPolicyDetails : Satisfied a previously + // set restriction policy regarding the location of data centers where + // team data resides (i.e. all data have been migrated according to the + // restriction placed). + DataPlacementRestrictionSatisfyPolicyDetails json.RawMessage `json:"data_placement_restriction_satisfy_policy_details,omitempty"` + // DeviceApprovalsChangeDesktopPolicyDetails : Set or removed a limit on + // the number of computers each team member can link to their work + // Dropbox account. + DeviceApprovalsChangeDesktopPolicyDetails json.RawMessage `json:"device_approvals_change_desktop_policy_details,omitempty"` + // DeviceApprovalsChangeMobilePolicyDetails : Set or removed a limit on + // the number of mobiles devices each team member can link to their work + // Dropbox account. + DeviceApprovalsChangeMobilePolicyDetails json.RawMessage `json:"device_approvals_change_mobile_policy_details,omitempty"` + // DeviceApprovalsChangeOverageActionDetails : Changed the action taken + // when a team member is already over the limits (e.g when they join the + // team, an admin lowers limits, etc.). + DeviceApprovalsChangeOverageActionDetails json.RawMessage `json:"device_approvals_change_overage_action_details,omitempty"` + // DeviceApprovalsChangeUnlinkActionDetails : Changed the action taken + // with respect to approval limits when a team member unlinks an + // approved device. + DeviceApprovalsChangeUnlinkActionDetails json.RawMessage `json:"device_approvals_change_unlink_action_details,omitempty"` + // EmmAddExceptionDetails : Added an exception for one or more team + // members to optionally use the regular Dropbox app when EMM is + // enabled. + EmmAddExceptionDetails json.RawMessage `json:"emm_add_exception_details,omitempty"` + // EmmChangePolicyDetails : Enabled or disabled enterprise mobility + // management for team members. + EmmChangePolicyDetails json.RawMessage `json:"emm_change_policy_details,omitempty"` + // EmmRemoveExceptionDetails : Removed an exception for one or more team + // members to optionally use the regular Dropbox app when EMM is + // enabled. + EmmRemoveExceptionDetails json.RawMessage `json:"emm_remove_exception_details,omitempty"` + // ExtendedVersionHistoryChangePolicyDetails : Accepted or opted out of + // extended version history. + ExtendedVersionHistoryChangePolicyDetails json.RawMessage `json:"extended_version_history_change_policy_details,omitempty"` + // FileCommentsChangePolicyDetails : Enabled or disabled commenting on + // team files. + FileCommentsChangePolicyDetails json.RawMessage `json:"file_comments_change_policy_details,omitempty"` + // FileRequestsChangePolicyDetails : Enabled or disabled file requests. + FileRequestsChangePolicyDetails json.RawMessage `json:"file_requests_change_policy_details,omitempty"` + // FileRequestsEmailsEnabledDetails : Enabled file request emails for + // everyone. + FileRequestsEmailsEnabledDetails json.RawMessage `json:"file_requests_emails_enabled_details,omitempty"` + // FileRequestsEmailsRestrictedToTeamOnlyDetails : Allowed file request + // emails for the team. + FileRequestsEmailsRestrictedToTeamOnlyDetails json.RawMessage `json:"file_requests_emails_restricted_to_team_only_details,omitempty"` + // GoogleSsoChangePolicyDetails : Enabled or disabled Google single + // sign-on for the team. + GoogleSsoChangePolicyDetails json.RawMessage `json:"google_sso_change_policy_details,omitempty"` + // GroupUserManagementChangePolicyDetails : Changed who can create + // groups. + GroupUserManagementChangePolicyDetails json.RawMessage `json:"group_user_management_change_policy_details,omitempty"` + // MemberRequestsChangePolicyDetails : Changed whether users can find + // the team when not invited. + MemberRequestsChangePolicyDetails json.RawMessage `json:"member_requests_change_policy_details,omitempty"` + // MemberSpaceLimitsAddExceptionDetails : Added an exception for one or + // more team members to bypass space limits imposed by policy. + MemberSpaceLimitsAddExceptionDetails json.RawMessage `json:"member_space_limits_add_exception_details,omitempty"` + // MemberSpaceLimitsChangePolicyDetails : Changed the storage limits + // applied to team members by policy. + MemberSpaceLimitsChangePolicyDetails json.RawMessage `json:"member_space_limits_change_policy_details,omitempty"` + // MemberSpaceLimitsRemoveExceptionDetails : Removed an exception for + // one or more team members to bypass space limits imposed by policy. + MemberSpaceLimitsRemoveExceptionDetails json.RawMessage `json:"member_space_limits_remove_exception_details,omitempty"` + // MemberSuggestionsChangePolicyDetails : Enabled or disabled the option + // for team members to suggest new members to add to the team. + MemberSuggestionsChangePolicyDetails json.RawMessage `json:"member_suggestions_change_policy_details,omitempty"` + // MicrosoftOfficeAddinChangePolicyDetails : Enabled or disabled the + // Microsoft Office add-in, which lets team members save files to + // Dropbox directly from Microsoft Office. + MicrosoftOfficeAddinChangePolicyDetails json.RawMessage `json:"microsoft_office_addin_change_policy_details,omitempty"` + // NetworkControlChangePolicyDetails : Enabled or disabled network + // control. + NetworkControlChangePolicyDetails json.RawMessage `json:"network_control_change_policy_details,omitempty"` + // PaperChangeDeploymentPolicyDetails : Changed whether Dropbox Paper, + // when enabled, is deployed to all teams or to specific members of the + // team. + PaperChangeDeploymentPolicyDetails json.RawMessage `json:"paper_change_deployment_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. + PaperChangeMemberPolicyDetails json.RawMessage `json:"paper_change_member_policy_details,omitempty"` + // PaperChangePolicyDetails : Enabled or disabled Dropbox Paper for the + // team. + PaperChangePolicyDetails json.RawMessage `json:"paper_change_policy_details,omitempty"` + // PermanentDeleteChangePolicyDetails : Enabled or disabled the ability + // of team members to permanently delete content. + PermanentDeleteChangePolicyDetails json.RawMessage `json:"permanent_delete_change_policy_details,omitempty"` + // SharingChangeFolderJoinPolicyDetails : Changed whether team members + // can join shared folders owned externally (i.e. outside the team). + SharingChangeFolderJoinPolicyDetails json.RawMessage `json:"sharing_change_folder_join_policy_details,omitempty"` + // SharingChangeLinkPolicyDetails : Changed whether team members can + // share links externally (i.e. outside the team), and if so, whether + // links should be accessible only by team members or anyone by default. + SharingChangeLinkPolicyDetails json.RawMessage `json:"sharing_change_link_policy_details,omitempty"` + // SharingChangeMemberPolicyDetails : Changed whether team members can + // share files and folders externally (i.e. outside the team). + SharingChangeMemberPolicyDetails json.RawMessage `json:"sharing_change_member_policy_details,omitempty"` + // SmartSyncChangePolicyDetails : Changed the default Smart Sync policy + // for team members. + SmartSyncChangePolicyDetails json.RawMessage `json:"smart_sync_change_policy_details,omitempty"` + // SmartSyncNotOptOutDetails : Opted team into Smart Sync. + SmartSyncNotOptOutDetails json.RawMessage `json:"smart_sync_not_opt_out_details,omitempty"` + // SmartSyncOptOutDetails : Opted team out of Smart Sync. + SmartSyncOptOutDetails json.RawMessage `json:"smart_sync_opt_out_details,omitempty"` + // SsoChangePolicyDetails : Change the single sign-on policy for the + // team. + SsoChangePolicyDetails json.RawMessage `json:"sso_change_policy_details,omitempty"` + // TfaChangePolicyDetails : Change two-step verification policy for the + // team. + TfaChangePolicyDetails json.RawMessage `json:"tfa_change_policy_details,omitempty"` + // TwoAccountChangePolicyDetails : Enabled or disabled the option for + // team members to link a personal Dropbox account in addition to their + // work account to the same computer. + TwoAccountChangePolicyDetails json.RawMessage `json:"two_account_change_policy_details,omitempty"` + // WebSessionsChangeFixedLengthPolicyDetails : Changed how long team + // members can stay signed in to Dropbox on the web. + WebSessionsChangeFixedLengthPolicyDetails json.RawMessage `json:"web_sessions_change_fixed_length_policy_details,omitempty"` + // WebSessionsChangeIdleLengthPolicyDetails : Changed how long team + // members can be idle while signed in to Dropbox on the web. + WebSessionsChangeIdleLengthPolicyDetails json.RawMessage `json:"web_sessions_change_idle_length_policy_details,omitempty"` + // TeamProfileAddLogoDetails : Added a team logo to be displayed on + // shared link headers. + TeamProfileAddLogoDetails json.RawMessage `json:"team_profile_add_logo_details,omitempty"` + // TeamProfileChangeLogoDetails : Changed the team logo to be displayed + // on shared link headers. + TeamProfileChangeLogoDetails json.RawMessage `json:"team_profile_change_logo_details,omitempty"` + // TeamProfileChangeNameDetails : Changed the team name. + TeamProfileChangeNameDetails json.RawMessage `json:"team_profile_change_name_details,omitempty"` + // TeamProfileRemoveLogoDetails : Removed the team logo to be displayed + // on shared link headers. + TeamProfileRemoveLogoDetails json.RawMessage `json:"team_profile_remove_logo_details,omitempty"` + // TfaAddBackupPhoneDetails : Added a backup phone for two-step + // verification. + TfaAddBackupPhoneDetails json.RawMessage `json:"tfa_add_backup_phone_details,omitempty"` + // TfaAddSecurityKeyDetails : Added a security key for two-step + // verification. + TfaAddSecurityKeyDetails json.RawMessage `json:"tfa_add_security_key_details,omitempty"` + // TfaChangeBackupPhoneDetails : Changed the backup phone for two-step + // verification. + TfaChangeBackupPhoneDetails json.RawMessage `json:"tfa_change_backup_phone_details,omitempty"` + // TfaChangeStatusDetails : Enabled, disabled or changed the + // configuration for two-step verification. + TfaChangeStatusDetails json.RawMessage `json:"tfa_change_status_details,omitempty"` + // TfaRemoveBackupPhoneDetails : Removed the backup phone for two-step + // verification. + TfaRemoveBackupPhoneDetails json.RawMessage `json:"tfa_remove_backup_phone_details,omitempty"` + // TfaRemoveSecurityKeyDetails : Removed a security key for two-step + // verification. + TfaRemoveSecurityKeyDetails json.RawMessage `json:"tfa_remove_security_key_details,omitempty"` + // TfaResetDetails : Reset two-step verification for team member. + TfaResetDetails json.RawMessage `json:"tfa_reset_details,omitempty"` + // MissingDetails : Hints that this event was returned with missing + // details due to an internal error. + MissingDetails json.RawMessage `json:"missing_details,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 "member_change_membership_type_details": + err = json.Unmarshal(body, &u.MemberChangeMembershipTypeDetails) + + if err != nil { + return err + } + case "member_permanently_delete_account_contents_details": + err = json.Unmarshal(body, &u.MemberPermanentlyDeleteAccountContentsDetails) + + if err != nil { + return err + } + case "member_space_limits_change_status_details": + err = json.Unmarshal(body, &u.MemberSpaceLimitsChangeStatusDetails) + + if err != nil { + return err + } + case "member_transfer_account_contents_details": + err = json.Unmarshal(body, &u.MemberTransferAccountContentsDetails) + + if err != nil { + return err + } + case "paper_enabled_users_group_addition_details": + err = json.Unmarshal(body, &u.PaperEnabledUsersGroupAdditionDetails) + + if err != nil { + return err + } + case "paper_enabled_users_group_removal_details": + err = json.Unmarshal(body, &u.PaperEnabledUsersGroupRemovalDetails) + + if err != nil { + return err + } + case "paper_external_view_allow_details": + err = json.Unmarshal(body, &u.PaperExternalViewAllowDetails) + + if err != nil { + return err + } + case "paper_external_view_default_team_details": + err = json.Unmarshal(body, &u.PaperExternalViewDefaultTeamDetails) + + if err != nil { + return err + } + case "paper_external_view_forbid_details": + err = json.Unmarshal(body, &u.PaperExternalViewForbidDetails) + + if err != nil { + return err + } + case "sf_external_invite_warn_details": + err = json.Unmarshal(body, &u.SfExternalInviteWarnDetails) + + if err != nil { + return err + } + case "team_merge_from_details": + err = json.Unmarshal(body, &u.TeamMergeFromDetails) + + if err != nil { + return err + } + case "team_merge_to_details": + err = json.Unmarshal(body, &u.TeamMergeToDetails) + + if err != nil { + return err + } + case "app_link_team_details": + err = json.Unmarshal(body, &u.AppLinkTeamDetails) + + if err != nil { + return err + } + case "app_link_user_details": + err = json.Unmarshal(body, &u.AppLinkUserDetails) + + if err != nil { + return err + } + case "app_unlink_team_details": + err = json.Unmarshal(body, &u.AppUnlinkTeamDetails) + + if err != nil { + return err + } + case "app_unlink_user_details": + err = json.Unmarshal(body, &u.AppUnlinkUserDetails) + + if err != nil { + return err + } + case "device_change_ip_desktop_details": + err = json.Unmarshal(body, &u.DeviceChangeIpDesktopDetails) + + if err != nil { + return err + } + case "device_change_ip_mobile_details": + err = json.Unmarshal(body, &u.DeviceChangeIpMobileDetails) + + if err != nil { + return err + } + case "device_change_ip_web_details": + err = json.Unmarshal(body, &u.DeviceChangeIpWebDetails) + + if err != nil { + return err + } + case "device_delete_on_unlink_fail_details": + err = json.Unmarshal(body, &u.DeviceDeleteOnUnlinkFailDetails) + + if err != nil { + return err + } + case "device_delete_on_unlink_success_details": + err = json.Unmarshal(body, &u.DeviceDeleteOnUnlinkSuccessDetails) + + if err != nil { + return err + } + case "device_link_fail_details": + err = json.Unmarshal(body, &u.DeviceLinkFailDetails) + + if err != nil { + return err + } + case "device_link_success_details": + err = json.Unmarshal(body, &u.DeviceLinkSuccessDetails) + + if err != nil { + return err + } + case "device_management_disabled_details": + err = json.Unmarshal(body, &u.DeviceManagementDisabledDetails) + + if err != nil { + return err + } + case "device_management_enabled_details": + err = json.Unmarshal(body, &u.DeviceManagementEnabledDetails) + + if err != nil { + return err + } + case "device_unlink_details": + err = json.Unmarshal(body, &u.DeviceUnlinkDetails) + + if err != nil { + return err + } + case "emm_refresh_auth_token_details": + err = json.Unmarshal(body, &u.EmmRefreshAuthTokenDetails) + + if err != nil { + return err + } + case "account_capture_change_availability_details": + err = json.Unmarshal(body, &u.AccountCaptureChangeAvailabilityDetails) + + if err != nil { + return err + } + case "account_capture_migrate_account_details": + err = json.Unmarshal(body, &u.AccountCaptureMigrateAccountDetails) + + if err != nil { + return err + } + case "account_capture_relinquish_account_details": + err = json.Unmarshal(body, &u.AccountCaptureRelinquishAccountDetails) + + if err != nil { + return err + } + case "disabled_domain_invites_details": + err = json.Unmarshal(body, &u.DisabledDomainInvitesDetails) + + if err != nil { + return err + } + case "domain_invites_approve_request_to_join_team_details": + err = json.Unmarshal(body, &u.DomainInvitesApproveRequestToJoinTeamDetails) + + if err != nil { + return err + } + case "domain_invites_decline_request_to_join_team_details": + err = json.Unmarshal(body, &u.DomainInvitesDeclineRequestToJoinTeamDetails) + + if err != nil { + return err + } + case "domain_invites_email_existing_users_details": + err = json.Unmarshal(body, &u.DomainInvitesEmailExistingUsersDetails) + + if err != nil { + return err + } + case "domain_invites_request_to_join_team_details": + err = json.Unmarshal(body, &u.DomainInvitesRequestToJoinTeamDetails) + + if err != nil { + return err + } + case "domain_invites_set_invite_new_user_pref_to_no_details": + err = json.Unmarshal(body, &u.DomainInvitesSetInviteNewUserPrefToNoDetails) + + if err != nil { + return err + } + case "domain_invites_set_invite_new_user_pref_to_yes_details": + err = json.Unmarshal(body, &u.DomainInvitesSetInviteNewUserPrefToYesDetails) + + if err != nil { + return err + } + case "domain_verification_add_domain_fail_details": + err = json.Unmarshal(body, &u.DomainVerificationAddDomainFailDetails) + + if err != nil { + return err + } + case "domain_verification_add_domain_success_details": + err = json.Unmarshal(body, &u.DomainVerificationAddDomainSuccessDetails) + + if err != nil { + return err + } + case "domain_verification_remove_domain_details": + err = json.Unmarshal(body, &u.DomainVerificationRemoveDomainDetails) + + if err != nil { + return err + } + case "enabled_domain_invites_details": + err = json.Unmarshal(body, &u.EnabledDomainInvitesDetails) + + if err != nil { + return err + } + case "create_folder_details": + err = json.Unmarshal(body, &u.CreateFolderDetails) + + if err != nil { + return err + } + case "file_add_details": + err = json.Unmarshal(body, &u.FileAddDetails) + + if err != nil { + return err + } + case "file_copy_details": + err = json.Unmarshal(body, &u.FileCopyDetails) + + if err != nil { + return err + } + case "file_delete_details": + err = json.Unmarshal(body, &u.FileDeleteDetails) + + if err != nil { + return err + } + case "file_download_details": + err = json.Unmarshal(body, &u.FileDownloadDetails) + + if err != nil { + return err + } + case "file_edit_details": + err = json.Unmarshal(body, &u.FileEditDetails) + + if err != nil { + return err + } + case "file_get_copy_reference_details": + err = json.Unmarshal(body, &u.FileGetCopyReferenceDetails) + + if err != nil { + return err + } + case "file_move_details": + err = json.Unmarshal(body, &u.FileMoveDetails) + + if err != nil { + return err + } + case "file_permanently_delete_details": + err = json.Unmarshal(body, &u.FilePermanentlyDeleteDetails) + + if err != nil { + return err + } + case "file_preview_details": + err = json.Unmarshal(body, &u.FilePreviewDetails) + + if err != nil { + return err + } + case "file_rename_details": + err = json.Unmarshal(body, &u.FileRenameDetails) + + if err != nil { + return err + } + case "file_restore_details": + err = json.Unmarshal(body, &u.FileRestoreDetails) + + if err != nil { + return err + } + case "file_revert_details": + err = json.Unmarshal(body, &u.FileRevertDetails) + + if err != nil { + return err + } + case "file_rollback_changes_details": + err = json.Unmarshal(body, &u.FileRollbackChangesDetails) + + if err != nil { + return err + } + case "file_save_copy_reference_details": + err = json.Unmarshal(body, &u.FileSaveCopyReferenceDetails) + + if err != nil { + return err + } + case "file_request_add_deadline_details": + err = json.Unmarshal(body, &u.FileRequestAddDeadlineDetails) + + if err != nil { + return err + } + case "file_request_change_folder_details": + err = json.Unmarshal(body, &u.FileRequestChangeFolderDetails) + + if err != nil { + return err + } + case "file_request_change_title_details": + err = json.Unmarshal(body, &u.FileRequestChangeTitleDetails) + + if err != nil { + return err + } + case "file_request_close_details": + err = json.Unmarshal(body, &u.FileRequestCloseDetails) + + if err != nil { + return err + } + case "file_request_create_details": + err = json.Unmarshal(body, &u.FileRequestCreateDetails) + + if err != nil { + return err + } + case "file_request_receive_file_details": + err = json.Unmarshal(body, &u.FileRequestReceiveFileDetails) + + if err != nil { + return err + } + case "file_request_remove_deadline_details": + err = json.Unmarshal(body, &u.FileRequestRemoveDeadlineDetails) + + if err != nil { + return err + } + case "file_request_send_details": + err = json.Unmarshal(body, &u.FileRequestSendDetails) + + if err != nil { + return err + } + case "group_add_external_id_details": + err = json.Unmarshal(body, &u.GroupAddExternalIdDetails) + + if err != nil { + return err + } + case "group_add_member_details": + err = json.Unmarshal(body, &u.GroupAddMemberDetails) + + if err != nil { + return err + } + case "group_change_external_id_details": + err = json.Unmarshal(body, &u.GroupChangeExternalIdDetails) + + if err != nil { + return err + } + case "group_change_management_type_details": + err = json.Unmarshal(body, &u.GroupChangeManagementTypeDetails) + + if err != nil { + return err + } + case "group_change_member_role_details": + err = json.Unmarshal(body, &u.GroupChangeMemberRoleDetails) + + if err != nil { + return err + } + case "group_create_details": + err = json.Unmarshal(body, &u.GroupCreateDetails) + + if err != nil { + return err + } + case "group_delete_details": + err = json.Unmarshal(body, &u.GroupDeleteDetails) + + if err != nil { + return err + } + case "group_description_updated_details": + err = json.Unmarshal(body, &u.GroupDescriptionUpdatedDetails) + + if err != nil { + return err + } + case "group_join_policy_updated_details": + err = json.Unmarshal(body, &u.GroupJoinPolicyUpdatedDetails) + + if err != nil { + return err + } + case "group_moved_details": + err = json.Unmarshal(body, &u.GroupMovedDetails) + + if err != nil { + return err + } + case "group_remove_external_id_details": + err = json.Unmarshal(body, &u.GroupRemoveExternalIdDetails) + + if err != nil { + return err + } + case "group_remove_member_details": + err = json.Unmarshal(body, &u.GroupRemoveMemberDetails) + + if err != nil { + return err + } + case "group_rename_details": + err = json.Unmarshal(body, &u.GroupRenameDetails) + + if err != nil { + return err + } + case "emm_login_success_details": + err = json.Unmarshal(body, &u.EmmLoginSuccessDetails) + + if err != nil { + return err + } + case "logout_details": + err = json.Unmarshal(body, &u.LogoutDetails) + + if err != nil { + return err + } + case "password_login_fail_details": + err = json.Unmarshal(body, &u.PasswordLoginFailDetails) + + if err != nil { + return err + } + case "password_login_success_details": + err = json.Unmarshal(body, &u.PasswordLoginSuccessDetails) + + if err != nil { + return err + } + case "reseller_support_session_end_details": + err = json.Unmarshal(body, &u.ResellerSupportSessionEndDetails) + + if err != nil { + return err + } + case "reseller_support_session_start_details": + err = json.Unmarshal(body, &u.ResellerSupportSessionStartDetails) + + if err != nil { + return err + } + case "sign_in_as_session_end_details": + err = json.Unmarshal(body, &u.SignInAsSessionEndDetails) + + if err != nil { + return err + } + case "sign_in_as_session_start_details": + err = json.Unmarshal(body, &u.SignInAsSessionStartDetails) + + if err != nil { + return err + } + case "sso_login_fail_details": + err = json.Unmarshal(body, &u.SsoLoginFailDetails) + + if err != nil { + return err + } + case "member_add_name_details": + err = json.Unmarshal(body, &u.MemberAddNameDetails) + + if err != nil { + return err + } + case "member_change_admin_role_details": + err = json.Unmarshal(body, &u.MemberChangeAdminRoleDetails) + + if err != nil { + return err + } + case "member_change_email_details": + err = json.Unmarshal(body, &u.MemberChangeEmailDetails) + + if err != nil { + return err + } + case "member_change_name_details": + err = json.Unmarshal(body, &u.MemberChangeNameDetails) + + if err != nil { + return err + } + case "member_change_status_details": + err = json.Unmarshal(body, &u.MemberChangeStatusDetails) + + if err != nil { + return err + } + case "member_suggest_details": + err = json.Unmarshal(body, &u.MemberSuggestDetails) + + if err != nil { + return err + } + case "paper_content_add_member_details": + err = json.Unmarshal(body, &u.PaperContentAddMemberDetails) + + if err != nil { + return err + } + case "paper_content_add_to_folder_details": + err = json.Unmarshal(body, &u.PaperContentAddToFolderDetails) + + if err != nil { + return err + } + case "paper_content_archive_details": + err = json.Unmarshal(body, &u.PaperContentArchiveDetails) + + if err != nil { + return err + } + case "paper_content_change_subscription_details": + err = json.Unmarshal(body, &u.PaperContentChangeSubscriptionDetails) + + if err != nil { + return err + } + case "paper_content_create_details": + err = json.Unmarshal(body, &u.PaperContentCreateDetails) + + if err != nil { + return err + } + case "paper_content_permanently_delete_details": + err = json.Unmarshal(body, &u.PaperContentPermanentlyDeleteDetails) + + if err != nil { + return err + } + case "paper_content_remove_from_folder_details": + err = json.Unmarshal(body, &u.PaperContentRemoveFromFolderDetails) + + if err != nil { + return err + } + case "paper_content_remove_member_details": + err = json.Unmarshal(body, &u.PaperContentRemoveMemberDetails) + + if err != nil { + return err + } + case "paper_content_rename_details": + err = json.Unmarshal(body, &u.PaperContentRenameDetails) + + if err != nil { + return err + } + case "paper_content_restore_details": + err = json.Unmarshal(body, &u.PaperContentRestoreDetails) + + if err != nil { + return err + } + case "paper_doc_add_comment_details": + err = json.Unmarshal(body, &u.PaperDocAddCommentDetails) + + if err != nil { + return err + } + case "paper_doc_change_member_role_details": + err = json.Unmarshal(body, &u.PaperDocChangeMemberRoleDetails) + + if err != nil { + return err + } + case "paper_doc_change_sharing_policy_details": + err = json.Unmarshal(body, &u.PaperDocChangeSharingPolicyDetails) + + if err != nil { + return err + } + case "paper_doc_deleted_details": + err = json.Unmarshal(body, &u.PaperDocDeletedDetails) + + if err != nil { + return err + } + case "paper_doc_delete_comment_details": + err = json.Unmarshal(body, &u.PaperDocDeleteCommentDetails) + + if err != nil { + return err + } + case "paper_doc_download_details": + err = json.Unmarshal(body, &u.PaperDocDownloadDetails) + + if err != nil { + return err + } + case "paper_doc_edit_details": + err = json.Unmarshal(body, &u.PaperDocEditDetails) + + if err != nil { + return err + } + case "paper_doc_edit_comment_details": + err = json.Unmarshal(body, &u.PaperDocEditCommentDetails) + + if err != nil { + return err + } + case "paper_doc_followed_details": + err = json.Unmarshal(body, &u.PaperDocFollowedDetails) + + if err != nil { + return err + } + case "paper_doc_mention_details": + err = json.Unmarshal(body, &u.PaperDocMentionDetails) + + if err != nil { + return err + } + case "paper_doc_request_access_details": + err = json.Unmarshal(body, &u.PaperDocRequestAccessDetails) + + if err != nil { + return err + } + case "paper_doc_resolve_comment_details": + err = json.Unmarshal(body, &u.PaperDocResolveCommentDetails) + + if err != nil { + return err + } + case "paper_doc_revert_details": + err = json.Unmarshal(body, &u.PaperDocRevertDetails) + + if err != nil { + return err + } + case "paper_doc_slack_share_details": + err = json.Unmarshal(body, &u.PaperDocSlackShareDetails) + + if err != nil { + return err + } + case "paper_doc_team_invite_details": + err = json.Unmarshal(body, &u.PaperDocTeamInviteDetails) + + if err != nil { + return err + } + case "paper_doc_unresolve_comment_details": + err = json.Unmarshal(body, &u.PaperDocUnresolveCommentDetails) + + if err != nil { + return err + } + case "paper_doc_view_details": + err = json.Unmarshal(body, &u.PaperDocViewDetails) + + if err != nil { + return err + } + case "paper_folder_deleted_details": + err = json.Unmarshal(body, &u.PaperFolderDeletedDetails) + + if err != nil { + return err + } + case "paper_folder_followed_details": + err = json.Unmarshal(body, &u.PaperFolderFollowedDetails) + + if err != nil { + return err + } + case "paper_folder_team_invite_details": + err = json.Unmarshal(body, &u.PaperFolderTeamInviteDetails) + + if err != nil { + return err + } + case "password_change_details": + err = json.Unmarshal(body, &u.PasswordChangeDetails) + + if err != nil { + return err + } + case "password_reset_details": + err = json.Unmarshal(body, &u.PasswordResetDetails) + + if err != nil { + return err + } + case "password_reset_all_details": + err = json.Unmarshal(body, &u.PasswordResetAllDetails) + + if err != nil { + return err + } + case "emm_create_exceptions_report_details": + err = json.Unmarshal(body, &u.EmmCreateExceptionsReportDetails) + + if err != nil { + return err + } + case "emm_create_usage_report_details": + err = json.Unmarshal(body, &u.EmmCreateUsageReportDetails) + + if err != nil { + return err + } + case "smart_sync_create_admin_privilege_report_details": + err = json.Unmarshal(body, &u.SmartSyncCreateAdminPrivilegeReportDetails) + + if err != nil { + return err + } + case "team_activity_create_report_details": + err = json.Unmarshal(body, &u.TeamActivityCreateReportDetails) + + if err != nil { + return err + } + case "collection_share_details": + err = json.Unmarshal(body, &u.CollectionShareDetails) + + if err != nil { + return err + } + case "file_add_comment_details": + err = json.Unmarshal(body, &u.FileAddCommentDetails) + + if err != nil { + return err + } + case "file_like_comment_details": + err = json.Unmarshal(body, &u.FileLikeCommentDetails) + + if err != nil { + return err + } + case "file_unlike_comment_details": + err = json.Unmarshal(body, &u.FileUnlikeCommentDetails) + + if err != nil { + return err + } + case "note_acl_invite_only_details": + err = json.Unmarshal(body, &u.NoteAclInviteOnlyDetails) + + if err != nil { + return err + } + case "note_acl_link_details": + err = json.Unmarshal(body, &u.NoteAclLinkDetails) + + if err != nil { + return err + } + case "note_acl_team_link_details": + err = json.Unmarshal(body, &u.NoteAclTeamLinkDetails) + + if err != nil { + return err + } + case "note_shared_details": + err = json.Unmarshal(body, &u.NoteSharedDetails) + + if err != nil { + return err + } + case "note_share_receive_details": + err = json.Unmarshal(body, &u.NoteShareReceiveDetails) + + if err != nil { + return err + } + case "open_note_shared_details": + err = json.Unmarshal(body, &u.OpenNoteSharedDetails) + + if err != nil { + return err + } + case "sf_add_group_details": + err = json.Unmarshal(body, &u.SfAddGroupDetails) + + if err != nil { + return err + } + case "sf_allow_non_members_to_view_shared_links_details": + err = json.Unmarshal(body, &u.SfAllowNonMembersToViewSharedLinksDetails) + + if err != nil { + return err + } + case "sf_invite_group_details": + err = json.Unmarshal(body, &u.SfInviteGroupDetails) + + if err != nil { + return err + } + case "sf_nest_details": + err = json.Unmarshal(body, &u.SfNestDetails) + + if err != nil { + return err + } + case "sf_team_decline_details": + err = json.Unmarshal(body, &u.SfTeamDeclineDetails) + + if err != nil { + return err + } + case "sf_team_grant_access_details": + err = json.Unmarshal(body, &u.SfTeamGrantAccessDetails) + + if err != nil { + return err + } + case "sf_team_invite_details": + err = json.Unmarshal(body, &u.SfTeamInviteDetails) + + if err != nil { + return err + } + case "sf_team_invite_change_role_details": + err = json.Unmarshal(body, &u.SfTeamInviteChangeRoleDetails) + + if err != nil { + return err + } + case "sf_team_join_details": + err = json.Unmarshal(body, &u.SfTeamJoinDetails) + + if err != nil { + return err + } + case "sf_team_join_from_oob_link_details": + err = json.Unmarshal(body, &u.SfTeamJoinFromOobLinkDetails) + + if err != nil { + return err + } + case "sf_team_uninvite_details": + err = json.Unmarshal(body, &u.SfTeamUninviteDetails) + + if err != nil { + return err + } + case "shared_content_add_invitees_details": + err = json.Unmarshal(body, &u.SharedContentAddInviteesDetails) + + if err != nil { + return err + } + case "shared_content_add_link_expiry_details": + err = json.Unmarshal(body, &u.SharedContentAddLinkExpiryDetails) + + if err != nil { + return err + } + case "shared_content_add_link_password_details": + err = json.Unmarshal(body, &u.SharedContentAddLinkPasswordDetails) + + if err != nil { + return err + } + case "shared_content_add_member_details": + err = json.Unmarshal(body, &u.SharedContentAddMemberDetails) + + if err != nil { + return err + } + case "shared_content_change_downloads_policy_details": + err = json.Unmarshal(body, &u.SharedContentChangeDownloadsPolicyDetails) + + if err != nil { + return err + } + case "shared_content_change_invitee_role_details": + err = json.Unmarshal(body, &u.SharedContentChangeInviteeRoleDetails) + + if err != nil { + return err + } + case "shared_content_change_link_audience_details": + err = json.Unmarshal(body, &u.SharedContentChangeLinkAudienceDetails) + + if err != nil { + return err + } + case "shared_content_change_link_expiry_details": + err = json.Unmarshal(body, &u.SharedContentChangeLinkExpiryDetails) + + if err != nil { + return err + } + case "shared_content_change_link_password_details": + err = json.Unmarshal(body, &u.SharedContentChangeLinkPasswordDetails) + + if err != nil { + return err + } + case "shared_content_change_member_role_details": + err = json.Unmarshal(body, &u.SharedContentChangeMemberRoleDetails) + + if err != nil { + return err + } + case "shared_content_change_viewer_info_policy_details": + err = json.Unmarshal(body, &u.SharedContentChangeViewerInfoPolicyDetails) + + if err != nil { + return err + } + case "shared_content_claim_invitation_details": + err = json.Unmarshal(body, &u.SharedContentClaimInvitationDetails) + + if err != nil { + return err + } + case "shared_content_copy_details": + err = json.Unmarshal(body, &u.SharedContentCopyDetails) + + if err != nil { + return err + } + case "shared_content_download_details": + err = json.Unmarshal(body, &u.SharedContentDownloadDetails) + + if err != nil { + return err + } + case "shared_content_relinquish_membership_details": + err = json.Unmarshal(body, &u.SharedContentRelinquishMembershipDetails) + + if err != nil { + return err + } + case "shared_content_remove_invitee_details": + err = json.Unmarshal(body, &u.SharedContentRemoveInviteeDetails) + + if err != nil { + return err + } + case "shared_content_remove_link_expiry_details": + err = json.Unmarshal(body, &u.SharedContentRemoveLinkExpiryDetails) + + if err != nil { + return err + } + case "shared_content_remove_link_password_details": + err = json.Unmarshal(body, &u.SharedContentRemoveLinkPasswordDetails) + + if err != nil { + return err + } + case "shared_content_remove_member_details": + err = json.Unmarshal(body, &u.SharedContentRemoveMemberDetails) + + if err != nil { + return err + } + case "shared_content_request_access_details": + err = json.Unmarshal(body, &u.SharedContentRequestAccessDetails) + + if err != nil { + return err + } + case "shared_content_unshare_details": + err = json.Unmarshal(body, &u.SharedContentUnshareDetails) + + if err != nil { + return err + } + case "shared_content_view_details": + err = json.Unmarshal(body, &u.SharedContentViewDetails) + + if err != nil { + return err + } + case "shared_folder_change_confidentiality_details": + err = json.Unmarshal(body, &u.SharedFolderChangeConfidentialityDetails) + + if err != nil { + return err + } + case "shared_folder_change_link_policy_details": + err = json.Unmarshal(body, &u.SharedFolderChangeLinkPolicyDetails) + + if err != nil { + return err + } + case "shared_folder_change_member_management_policy_details": + err = json.Unmarshal(body, &u.SharedFolderChangeMemberManagementPolicyDetails) + + if err != nil { + return err + } + case "shared_folder_change_member_policy_details": + err = json.Unmarshal(body, &u.SharedFolderChangeMemberPolicyDetails) + + if err != nil { + return err + } + case "shared_folder_create_details": + err = json.Unmarshal(body, &u.SharedFolderCreateDetails) + + if err != nil { + return err + } + case "shared_folder_mount_details": + err = json.Unmarshal(body, &u.SharedFolderMountDetails) + + if err != nil { + return err + } + case "shared_folder_transfer_ownership_details": + err = json.Unmarshal(body, &u.SharedFolderTransferOwnershipDetails) + + if err != nil { + return err + } + case "shared_folder_unmount_details": + err = json.Unmarshal(body, &u.SharedFolderUnmountDetails) + + if err != nil { + return err + } + case "shared_note_opened_details": + err = json.Unmarshal(body, &u.SharedNoteOpenedDetails) + + if err != nil { + return err + } + case "shmodel_app_create_details": + err = json.Unmarshal(body, &u.ShmodelAppCreateDetails) + + if err != nil { + return err + } + case "shmodel_create_details": + err = json.Unmarshal(body, &u.ShmodelCreateDetails) + + if err != nil { + return err + } + case "shmodel_disable_details": + err = json.Unmarshal(body, &u.ShmodelDisableDetails) + + if err != nil { + return err + } + case "shmodel_fb_share_details": + err = json.Unmarshal(body, &u.ShmodelFbShareDetails) + + if err != nil { + return err + } + case "shmodel_group_share_details": + err = json.Unmarshal(body, &u.ShmodelGroupShareDetails) + + if err != nil { + return err + } + case "shmodel_remove_expiration_details": + err = json.Unmarshal(body, &u.ShmodelRemoveExpirationDetails) + + if err != nil { + return err + } + case "shmodel_set_expiration_details": + err = json.Unmarshal(body, &u.ShmodelSetExpirationDetails) + + if err != nil { + return err + } + case "shmodel_team_copy_details": + err = json.Unmarshal(body, &u.ShmodelTeamCopyDetails) + + if err != nil { + return err + } + case "shmodel_team_download_details": + err = json.Unmarshal(body, &u.ShmodelTeamDownloadDetails) + + if err != nil { + return err + } + case "shmodel_team_share_details": + err = json.Unmarshal(body, &u.ShmodelTeamShareDetails) + + if err != nil { + return err + } + case "shmodel_team_view_details": + err = json.Unmarshal(body, &u.ShmodelTeamViewDetails) + + if err != nil { + return err + } + case "shmodel_visibility_password_details": + err = json.Unmarshal(body, &u.ShmodelVisibilityPasswordDetails) + + if err != nil { + return err + } + case "shmodel_visibility_public_details": + err = json.Unmarshal(body, &u.ShmodelVisibilityPublicDetails) + + if err != nil { + return err + } + case "shmodel_visibility_team_only_details": + err = json.Unmarshal(body, &u.ShmodelVisibilityTeamOnlyDetails) + + if err != nil { + return err + } + case "remove_logout_url_details": + err = json.Unmarshal(body, &u.RemoveLogoutUrlDetails) + + if err != nil { + return err + } + case "remove_sso_url_details": + err = json.Unmarshal(body, &u.RemoveSsoUrlDetails) + + if err != nil { + return err + } + case "sso_change_cert_details": + err = json.Unmarshal(body, &u.SsoChangeCertDetails) + + if err != nil { + return err + } + case "sso_change_login_url_details": + err = json.Unmarshal(body, &u.SsoChangeLoginUrlDetails) + + if err != nil { + return err + } + case "sso_change_logout_url_details": + err = json.Unmarshal(body, &u.SsoChangeLogoutUrlDetails) + + if err != nil { + return err + } + case "sso_change_saml_identity_mode_details": + err = json.Unmarshal(body, &u.SsoChangeSamlIdentityModeDetails) + + if err != nil { + return err + } + case "team_folder_change_status_details": + err = json.Unmarshal(body, &u.TeamFolderChangeStatusDetails) + + if err != nil { + return err + } + case "team_folder_create_details": + err = json.Unmarshal(body, &u.TeamFolderCreateDetails) + + if err != nil { + return err + } + case "team_folder_downgrade_details": + err = json.Unmarshal(body, &u.TeamFolderDowngradeDetails) + + if err != nil { + return err + } + case "team_folder_permanently_delete_details": + err = json.Unmarshal(body, &u.TeamFolderPermanentlyDeleteDetails) + + if err != nil { + return err + } + case "team_folder_rename_details": + err = json.Unmarshal(body, &u.TeamFolderRenameDetails) + + if err != nil { + return err + } + case "account_capture_change_policy_details": + err = json.Unmarshal(body, &u.AccountCaptureChangePolicyDetails) + + if err != nil { + return err + } + case "allow_download_disabled_details": + err = json.Unmarshal(body, &u.AllowDownloadDisabledDetails) + + if err != nil { + return err + } + case "allow_download_enabled_details": + err = json.Unmarshal(body, &u.AllowDownloadEnabledDetails) + + if err != nil { + return err + } + case "data_placement_restriction_change_policy_details": + err = json.Unmarshal(body, &u.DataPlacementRestrictionChangePolicyDetails) + + if err != nil { + return err + } + case "data_placement_restriction_satisfy_policy_details": + err = json.Unmarshal(body, &u.DataPlacementRestrictionSatisfyPolicyDetails) + + if err != nil { + return err + } + case "device_approvals_change_desktop_policy_details": + err = json.Unmarshal(body, &u.DeviceApprovalsChangeDesktopPolicyDetails) + + if err != nil { + return err + } + case "device_approvals_change_mobile_policy_details": + err = json.Unmarshal(body, &u.DeviceApprovalsChangeMobilePolicyDetails) + + if err != nil { + return err + } + case "device_approvals_change_overage_action_details": + err = json.Unmarshal(body, &u.DeviceApprovalsChangeOverageActionDetails) + + if err != nil { + return err + } + case "device_approvals_change_unlink_action_details": + err = json.Unmarshal(body, &u.DeviceApprovalsChangeUnlinkActionDetails) + + if err != nil { + return err + } + case "emm_add_exception_details": + err = json.Unmarshal(body, &u.EmmAddExceptionDetails) + + if err != nil { + return err + } + case "emm_change_policy_details": + err = json.Unmarshal(body, &u.EmmChangePolicyDetails) + + if err != nil { + return err + } + case "emm_remove_exception_details": + err = json.Unmarshal(body, &u.EmmRemoveExceptionDetails) + + if err != nil { + return err + } + case "extended_version_history_change_policy_details": + err = json.Unmarshal(body, &u.ExtendedVersionHistoryChangePolicyDetails) + + if err != nil { + return err + } + case "file_comments_change_policy_details": + err = json.Unmarshal(body, &u.FileCommentsChangePolicyDetails) + + if err != nil { + return err + } + case "file_requests_change_policy_details": + err = json.Unmarshal(body, &u.FileRequestsChangePolicyDetails) + + if err != nil { + return err + } + case "file_requests_emails_enabled_details": + err = json.Unmarshal(body, &u.FileRequestsEmailsEnabledDetails) + + if err != nil { + return err + } + case "file_requests_emails_restricted_to_team_only_details": + err = json.Unmarshal(body, &u.FileRequestsEmailsRestrictedToTeamOnlyDetails) + + if err != nil { + return err + } + case "google_sso_change_policy_details": + err = json.Unmarshal(body, &u.GoogleSsoChangePolicyDetails) + + if err != nil { + return err + } + case "group_user_management_change_policy_details": + err = json.Unmarshal(body, &u.GroupUserManagementChangePolicyDetails) + + if err != nil { + return err + } + case "member_requests_change_policy_details": + err = json.Unmarshal(body, &u.MemberRequestsChangePolicyDetails) + + if err != nil { + return err + } + case "member_space_limits_add_exception_details": + err = json.Unmarshal(body, &u.MemberSpaceLimitsAddExceptionDetails) + + if err != nil { + return err + } + case "member_space_limits_change_policy_details": + err = json.Unmarshal(body, &u.MemberSpaceLimitsChangePolicyDetails) + + if err != nil { + return err + } + case "member_space_limits_remove_exception_details": + err = json.Unmarshal(body, &u.MemberSpaceLimitsRemoveExceptionDetails) + + if err != nil { + return err + } + case "member_suggestions_change_policy_details": + err = json.Unmarshal(body, &u.MemberSuggestionsChangePolicyDetails) + + if err != nil { + return err + } + case "microsoft_office_addin_change_policy_details": + err = json.Unmarshal(body, &u.MicrosoftOfficeAddinChangePolicyDetails) + + if err != nil { + return err + } + case "network_control_change_policy_details": + err = json.Unmarshal(body, &u.NetworkControlChangePolicyDetails) + + if err != nil { + return err + } + case "paper_change_deployment_policy_details": + err = json.Unmarshal(body, &u.PaperChangeDeploymentPolicyDetails) + + if err != nil { + return err + } + case "paper_change_member_policy_details": + err = json.Unmarshal(body, &u.PaperChangeMemberPolicyDetails) + + if err != nil { + return err + } + case "paper_change_policy_details": + err = json.Unmarshal(body, &u.PaperChangePolicyDetails) + + if err != nil { + return err + } + case "permanent_delete_change_policy_details": + err = json.Unmarshal(body, &u.PermanentDeleteChangePolicyDetails) + + if err != nil { + return err + } + case "sharing_change_folder_join_policy_details": + err = json.Unmarshal(body, &u.SharingChangeFolderJoinPolicyDetails) + + if err != nil { + return err + } + case "sharing_change_link_policy_details": + err = json.Unmarshal(body, &u.SharingChangeLinkPolicyDetails) + + if err != nil { + return err + } + case "sharing_change_member_policy_details": + err = json.Unmarshal(body, &u.SharingChangeMemberPolicyDetails) + + if err != nil { + return err + } + case "smart_sync_change_policy_details": + err = json.Unmarshal(body, &u.SmartSyncChangePolicyDetails) + + if err != nil { + return err + } + case "smart_sync_not_opt_out_details": + err = json.Unmarshal(body, &u.SmartSyncNotOptOutDetails) + + if err != nil { + return err + } + case "smart_sync_opt_out_details": + err = json.Unmarshal(body, &u.SmartSyncOptOutDetails) + + if err != nil { + return err + } + case "sso_change_policy_details": + err = json.Unmarshal(body, &u.SsoChangePolicyDetails) + + if err != nil { + return err + } + case "tfa_change_policy_details": + err = json.Unmarshal(body, &u.TfaChangePolicyDetails) + + if err != nil { + return err + } + case "two_account_change_policy_details": + err = json.Unmarshal(body, &u.TwoAccountChangePolicyDetails) + + if err != nil { + return err + } + case "web_sessions_change_fixed_length_policy_details": + err = json.Unmarshal(body, &u.WebSessionsChangeFixedLengthPolicyDetails) + + if err != nil { + return err + } + case "web_sessions_change_idle_length_policy_details": + err = json.Unmarshal(body, &u.WebSessionsChangeIdleLengthPolicyDetails) + + if err != nil { + return err + } + case "team_profile_add_logo_details": + err = json.Unmarshal(body, &u.TeamProfileAddLogoDetails) + + if err != nil { + return err + } + case "team_profile_change_logo_details": + err = json.Unmarshal(body, &u.TeamProfileChangeLogoDetails) + + if err != nil { + return err + } + case "team_profile_change_name_details": + err = json.Unmarshal(body, &u.TeamProfileChangeNameDetails) + + if err != nil { + return err + } + case "team_profile_remove_logo_details": + err = json.Unmarshal(body, &u.TeamProfileRemoveLogoDetails) + + if err != nil { + return err + } + case "tfa_add_backup_phone_details": + err = json.Unmarshal(body, &u.TfaAddBackupPhoneDetails) + + if err != nil { + return err + } + case "tfa_add_security_key_details": + err = json.Unmarshal(body, &u.TfaAddSecurityKeyDetails) + + if err != nil { + return err + } + case "tfa_change_backup_phone_details": + err = json.Unmarshal(body, &u.TfaChangeBackupPhoneDetails) + + if err != nil { + return err + } + case "tfa_change_status_details": + err = json.Unmarshal(body, &u.TfaChangeStatusDetails) + + if err != nil { + return err + } + case "tfa_remove_backup_phone_details": + err = json.Unmarshal(body, &u.TfaRemoveBackupPhoneDetails) + + if err != nil { + return err + } + case "tfa_remove_security_key_details": + err = json.Unmarshal(body, &u.TfaRemoveSecurityKeyDetails) + + if err != nil { + return err + } + case "tfa_reset_details": + err = json.Unmarshal(body, &u.TfaResetDetails) + + if err != nil { + return err + } + case "missing_details": + err = json.Unmarshal(body, &u.MissingDetails) + + if err != nil { + return err + } + } + return nil +} + +// EventType : The type of the event. +type EventType struct { + dropbox.Tagged +} + +// Valid tag values for EventType +const ( + EventTypeMemberChangeMembershipType = "member_change_membership_type" + EventTypeMemberPermanentlyDeleteAccountContents = "member_permanently_delete_account_contents" + EventTypeMemberSpaceLimitsChangeStatus = "member_space_limits_change_status" + EventTypeMemberTransferAccountContents = "member_transfer_account_contents" + EventTypePaperEnabledUsersGroupAddition = "paper_enabled_users_group_addition" + EventTypePaperEnabledUsersGroupRemoval = "paper_enabled_users_group_removal" + EventTypePaperExternalViewAllow = "paper_external_view_allow" + EventTypePaperExternalViewDefaultTeam = "paper_external_view_default_team" + EventTypePaperExternalViewForbid = "paper_external_view_forbid" + EventTypeSfExternalInviteWarn = "sf_external_invite_warn" + EventTypeTeamMergeFrom = "team_merge_from" + EventTypeTeamMergeTo = "team_merge_to" + EventTypeAppLinkTeam = "app_link_team" + EventTypeAppLinkUser = "app_link_user" + EventTypeAppUnlinkTeam = "app_unlink_team" + EventTypeAppUnlinkUser = "app_unlink_user" + EventTypeDeviceChangeIpDesktop = "device_change_ip_desktop" + EventTypeDeviceChangeIpMobile = "device_change_ip_mobile" + EventTypeDeviceChangeIpWeb = "device_change_ip_web" + EventTypeDeviceDeleteOnUnlinkFail = "device_delete_on_unlink_fail" + EventTypeDeviceDeleteOnUnlinkSuccess = "device_delete_on_unlink_success" + EventTypeDeviceLinkFail = "device_link_fail" + EventTypeDeviceLinkSuccess = "device_link_success" + EventTypeDeviceManagementDisabled = "device_management_disabled" + EventTypeDeviceManagementEnabled = "device_management_enabled" + EventTypeDeviceUnlink = "device_unlink" + EventTypeEmmRefreshAuthToken = "emm_refresh_auth_token" + EventTypeAccountCaptureChangeAvailability = "account_capture_change_availability" + EventTypeAccountCaptureMigrateAccount = "account_capture_migrate_account" + EventTypeAccountCaptureRelinquishAccount = "account_capture_relinquish_account" + EventTypeDisabledDomainInvites = "disabled_domain_invites" + EventTypeDomainInvitesApproveRequestToJoinTeam = "domain_invites_approve_request_to_join_team" + EventTypeDomainInvitesDeclineRequestToJoinTeam = "domain_invites_decline_request_to_join_team" + EventTypeDomainInvitesEmailExistingUsers = "domain_invites_email_existing_users" + EventTypeDomainInvitesRequestToJoinTeam = "domain_invites_request_to_join_team" + EventTypeDomainInvitesSetInviteNewUserPrefToNo = "domain_invites_set_invite_new_user_pref_to_no" + EventTypeDomainInvitesSetInviteNewUserPrefToYes = "domain_invites_set_invite_new_user_pref_to_yes" + EventTypeDomainVerificationAddDomainFail = "domain_verification_add_domain_fail" + EventTypeDomainVerificationAddDomainSuccess = "domain_verification_add_domain_success" + EventTypeDomainVerificationRemoveDomain = "domain_verification_remove_domain" + EventTypeEnabledDomainInvites = "enabled_domain_invites" + EventTypeCreateFolder = "create_folder" + EventTypeFileAdd = "file_add" + EventTypeFileCopy = "file_copy" + EventTypeFileDelete = "file_delete" + EventTypeFileDownload = "file_download" + EventTypeFileEdit = "file_edit" + EventTypeFileGetCopyReference = "file_get_copy_reference" + EventTypeFileMove = "file_move" + EventTypeFilePermanentlyDelete = "file_permanently_delete" + EventTypeFilePreview = "file_preview" + EventTypeFileRename = "file_rename" + EventTypeFileRestore = "file_restore" + EventTypeFileRevert = "file_revert" + EventTypeFileRollbackChanges = "file_rollback_changes" + EventTypeFileSaveCopyReference = "file_save_copy_reference" + EventTypeFileRequestAddDeadline = "file_request_add_deadline" + EventTypeFileRequestChangeFolder = "file_request_change_folder" + EventTypeFileRequestChangeTitle = "file_request_change_title" + EventTypeFileRequestClose = "file_request_close" + EventTypeFileRequestCreate = "file_request_create" + EventTypeFileRequestReceiveFile = "file_request_receive_file" + EventTypeFileRequestRemoveDeadline = "file_request_remove_deadline" + EventTypeFileRequestSend = "file_request_send" + EventTypeGroupAddExternalId = "group_add_external_id" + EventTypeGroupAddMember = "group_add_member" + EventTypeGroupChangeExternalId = "group_change_external_id" + EventTypeGroupChangeManagementType = "group_change_management_type" + EventTypeGroupChangeMemberRole = "group_change_member_role" + EventTypeGroupCreate = "group_create" + EventTypeGroupDelete = "group_delete" + EventTypeGroupDescriptionUpdated = "group_description_updated" + EventTypeGroupJoinPolicyUpdated = "group_join_policy_updated" + EventTypeGroupMoved = "group_moved" + EventTypeGroupRemoveExternalId = "group_remove_external_id" + EventTypeGroupRemoveMember = "group_remove_member" + EventTypeGroupRename = "group_rename" + EventTypeEmmLoginSuccess = "emm_login_success" + EventTypeLogout = "logout" + EventTypePasswordLoginFail = "password_login_fail" + EventTypePasswordLoginSuccess = "password_login_success" + EventTypeResellerSupportSessionEnd = "reseller_support_session_end" + EventTypeResellerSupportSessionStart = "reseller_support_session_start" + EventTypeSignInAsSessionEnd = "sign_in_as_session_end" + EventTypeSignInAsSessionStart = "sign_in_as_session_start" + EventTypeSsoLoginFail = "sso_login_fail" + EventTypeMemberAddName = "member_add_name" + EventTypeMemberChangeAdminRole = "member_change_admin_role" + EventTypeMemberChangeEmail = "member_change_email" + EventTypeMemberChangeName = "member_change_name" + EventTypeMemberChangeStatus = "member_change_status" + EventTypeMemberSuggest = "member_suggest" + EventTypePaperContentAddMember = "paper_content_add_member" + EventTypePaperContentAddToFolder = "paper_content_add_to_folder" + EventTypePaperContentArchive = "paper_content_archive" + EventTypePaperContentChangeSubscription = "paper_content_change_subscription" + EventTypePaperContentCreate = "paper_content_create" + EventTypePaperContentPermanentlyDelete = "paper_content_permanently_delete" + EventTypePaperContentRemoveFromFolder = "paper_content_remove_from_folder" + EventTypePaperContentRemoveMember = "paper_content_remove_member" + EventTypePaperContentRename = "paper_content_rename" + EventTypePaperContentRestore = "paper_content_restore" + EventTypePaperDocAddComment = "paper_doc_add_comment" + EventTypePaperDocChangeMemberRole = "paper_doc_change_member_role" + EventTypePaperDocChangeSharingPolicy = "paper_doc_change_sharing_policy" + EventTypePaperDocDeleted = "paper_doc_deleted" + EventTypePaperDocDeleteComment = "paper_doc_delete_comment" + EventTypePaperDocDownload = "paper_doc_download" + EventTypePaperDocEdit = "paper_doc_edit" + EventTypePaperDocEditComment = "paper_doc_edit_comment" + EventTypePaperDocFollowed = "paper_doc_followed" + EventTypePaperDocMention = "paper_doc_mention" + EventTypePaperDocRequestAccess = "paper_doc_request_access" + EventTypePaperDocResolveComment = "paper_doc_resolve_comment" + EventTypePaperDocRevert = "paper_doc_revert" + EventTypePaperDocSlackShare = "paper_doc_slack_share" + EventTypePaperDocTeamInvite = "paper_doc_team_invite" + EventTypePaperDocUnresolveComment = "paper_doc_unresolve_comment" + EventTypePaperDocView = "paper_doc_view" + EventTypePaperFolderDeleted = "paper_folder_deleted" + EventTypePaperFolderFollowed = "paper_folder_followed" + EventTypePaperFolderTeamInvite = "paper_folder_team_invite" + EventTypePasswordChange = "password_change" + EventTypePasswordReset = "password_reset" + EventTypePasswordResetAll = "password_reset_all" + EventTypeEmmCreateExceptionsReport = "emm_create_exceptions_report" + EventTypeEmmCreateUsageReport = "emm_create_usage_report" + EventTypeSmartSyncCreateAdminPrivilegeReport = "smart_sync_create_admin_privilege_report" + EventTypeTeamActivityCreateReport = "team_activity_create_report" + EventTypeCollectionShare = "collection_share" + EventTypeFileAddComment = "file_add_comment" + EventTypeFileLikeComment = "file_like_comment" + EventTypeFileUnlikeComment = "file_unlike_comment" + EventTypeNoteAclInviteOnly = "note_acl_invite_only" + EventTypeNoteAclLink = "note_acl_link" + EventTypeNoteAclTeamLink = "note_acl_team_link" + EventTypeNoteShared = "note_shared" + EventTypeNoteShareReceive = "note_share_receive" + EventTypeOpenNoteShared = "open_note_shared" + EventTypeSfAddGroup = "sf_add_group" + EventTypeSfAllowNonMembersToViewSharedLinks = "sf_allow_non_members_to_view_shared_links" + EventTypeSfInviteGroup = "sf_invite_group" + EventTypeSfNest = "sf_nest" + EventTypeSfTeamDecline = "sf_team_decline" + EventTypeSfTeamGrantAccess = "sf_team_grant_access" + EventTypeSfTeamInvite = "sf_team_invite" + EventTypeSfTeamInviteChangeRole = "sf_team_invite_change_role" + EventTypeSfTeamJoin = "sf_team_join" + EventTypeSfTeamJoinFromOobLink = "sf_team_join_from_oob_link" + EventTypeSfTeamUninvite = "sf_team_uninvite" + EventTypeSharedContentAddInvitees = "shared_content_add_invitees" + EventTypeSharedContentAddLinkExpiry = "shared_content_add_link_expiry" + EventTypeSharedContentAddLinkPassword = "shared_content_add_link_password" + EventTypeSharedContentAddMember = "shared_content_add_member" + EventTypeSharedContentChangeDownloadsPolicy = "shared_content_change_downloads_policy" + EventTypeSharedContentChangeInviteeRole = "shared_content_change_invitee_role" + EventTypeSharedContentChangeLinkAudience = "shared_content_change_link_audience" + EventTypeSharedContentChangeLinkExpiry = "shared_content_change_link_expiry" + EventTypeSharedContentChangeLinkPassword = "shared_content_change_link_password" + EventTypeSharedContentChangeMemberRole = "shared_content_change_member_role" + EventTypeSharedContentChangeViewerInfoPolicy = "shared_content_change_viewer_info_policy" + EventTypeSharedContentClaimInvitation = "shared_content_claim_invitation" + EventTypeSharedContentCopy = "shared_content_copy" + EventTypeSharedContentDownload = "shared_content_download" + EventTypeSharedContentRelinquishMembership = "shared_content_relinquish_membership" + EventTypeSharedContentRemoveInvitee = "shared_content_remove_invitee" + EventTypeSharedContentRemoveLinkExpiry = "shared_content_remove_link_expiry" + EventTypeSharedContentRemoveLinkPassword = "shared_content_remove_link_password" + EventTypeSharedContentRemoveMember = "shared_content_remove_member" + EventTypeSharedContentRequestAccess = "shared_content_request_access" + EventTypeSharedContentUnshare = "shared_content_unshare" + EventTypeSharedContentView = "shared_content_view" + EventTypeSharedFolderChangeConfidentiality = "shared_folder_change_confidentiality" + EventTypeSharedFolderChangeLinkPolicy = "shared_folder_change_link_policy" + EventTypeSharedFolderChangeMemberManagementPolicy = "shared_folder_change_member_management_policy" + EventTypeSharedFolderChangeMemberPolicy = "shared_folder_change_member_policy" + EventTypeSharedFolderCreate = "shared_folder_create" + EventTypeSharedFolderMount = "shared_folder_mount" + EventTypeSharedFolderTransferOwnership = "shared_folder_transfer_ownership" + EventTypeSharedFolderUnmount = "shared_folder_unmount" + EventTypeSharedNoteOpened = "shared_note_opened" + EventTypeShmodelAppCreate = "shmodel_app_create" + EventTypeShmodelCreate = "shmodel_create" + EventTypeShmodelDisable = "shmodel_disable" + EventTypeShmodelFbShare = "shmodel_fb_share" + EventTypeShmodelGroupShare = "shmodel_group_share" + EventTypeShmodelRemoveExpiration = "shmodel_remove_expiration" + EventTypeShmodelSetExpiration = "shmodel_set_expiration" + EventTypeShmodelTeamCopy = "shmodel_team_copy" + EventTypeShmodelTeamDownload = "shmodel_team_download" + EventTypeShmodelTeamShare = "shmodel_team_share" + EventTypeShmodelTeamView = "shmodel_team_view" + EventTypeShmodelVisibilityPassword = "shmodel_visibility_password" + EventTypeShmodelVisibilityPublic = "shmodel_visibility_public" + EventTypeShmodelVisibilityTeamOnly = "shmodel_visibility_team_only" + EventTypeRemoveLogoutUrl = "remove_logout_url" + EventTypeRemoveSsoUrl = "remove_sso_url" + EventTypeSsoChangeCert = "sso_change_cert" + EventTypeSsoChangeLoginUrl = "sso_change_login_url" + EventTypeSsoChangeLogoutUrl = "sso_change_logout_url" + EventTypeSsoChangeSamlIdentityMode = "sso_change_saml_identity_mode" + EventTypeTeamFolderChangeStatus = "team_folder_change_status" + EventTypeTeamFolderCreate = "team_folder_create" + EventTypeTeamFolderDowngrade = "team_folder_downgrade" + EventTypeTeamFolderPermanentlyDelete = "team_folder_permanently_delete" + EventTypeTeamFolderRename = "team_folder_rename" + EventTypeAccountCaptureChangePolicy = "account_capture_change_policy" + EventTypeAllowDownloadDisabled = "allow_download_disabled" + EventTypeAllowDownloadEnabled = "allow_download_enabled" + EventTypeDataPlacementRestrictionChangePolicy = "data_placement_restriction_change_policy" + EventTypeDataPlacementRestrictionSatisfyPolicy = "data_placement_restriction_satisfy_policy" + EventTypeDeviceApprovalsChangeDesktopPolicy = "device_approvals_change_desktop_policy" + EventTypeDeviceApprovalsChangeMobilePolicy = "device_approvals_change_mobile_policy" + EventTypeDeviceApprovalsChangeOverageAction = "device_approvals_change_overage_action" + EventTypeDeviceApprovalsChangeUnlinkAction = "device_approvals_change_unlink_action" + EventTypeEmmAddException = "emm_add_exception" + EventTypeEmmChangePolicy = "emm_change_policy" + EventTypeEmmRemoveException = "emm_remove_exception" + EventTypeExtendedVersionHistoryChangePolicy = "extended_version_history_change_policy" + EventTypeFileCommentsChangePolicy = "file_comments_change_policy" + EventTypeFileRequestsChangePolicy = "file_requests_change_policy" + EventTypeFileRequestsEmailsEnabled = "file_requests_emails_enabled" + EventTypeFileRequestsEmailsRestrictedToTeamOnly = "file_requests_emails_restricted_to_team_only" + EventTypeGoogleSsoChangePolicy = "google_sso_change_policy" + EventTypeGroupUserManagementChangePolicy = "group_user_management_change_policy" + EventTypeMemberRequestsChangePolicy = "member_requests_change_policy" + EventTypeMemberSpaceLimitsAddException = "member_space_limits_add_exception" + EventTypeMemberSpaceLimitsChangePolicy = "member_space_limits_change_policy" + EventTypeMemberSpaceLimitsRemoveException = "member_space_limits_remove_exception" + EventTypeMemberSuggestionsChangePolicy = "member_suggestions_change_policy" + EventTypeMicrosoftOfficeAddinChangePolicy = "microsoft_office_addin_change_policy" + EventTypeNetworkControlChangePolicy = "network_control_change_policy" + EventTypePaperChangeDeploymentPolicy = "paper_change_deployment_policy" + EventTypePaperChangeMemberPolicy = "paper_change_member_policy" + EventTypePaperChangePolicy = "paper_change_policy" + EventTypePermanentDeleteChangePolicy = "permanent_delete_change_policy" + EventTypeSharingChangeFolderJoinPolicy = "sharing_change_folder_join_policy" + EventTypeSharingChangeLinkPolicy = "sharing_change_link_policy" + EventTypeSharingChangeMemberPolicy = "sharing_change_member_policy" + EventTypeSmartSyncChangePolicy = "smart_sync_change_policy" + EventTypeSmartSyncNotOptOut = "smart_sync_not_opt_out" + EventTypeSmartSyncOptOut = "smart_sync_opt_out" + EventTypeSsoChangePolicy = "sso_change_policy" + EventTypeTfaChangePolicy = "tfa_change_policy" + EventTypeTwoAccountChangePolicy = "two_account_change_policy" + EventTypeWebSessionsChangeFixedLengthPolicy = "web_sessions_change_fixed_length_policy" + EventTypeWebSessionsChangeIdleLengthPolicy = "web_sessions_change_idle_length_policy" + EventTypeTeamProfileAddLogo = "team_profile_add_logo" + EventTypeTeamProfileChangeLogo = "team_profile_change_logo" + EventTypeTeamProfileChangeName = "team_profile_change_name" + EventTypeTeamProfileRemoveLogo = "team_profile_remove_logo" + EventTypeTfaAddBackupPhone = "tfa_add_backup_phone" + EventTypeTfaAddSecurityKey = "tfa_add_security_key" + EventTypeTfaChangeBackupPhone = "tfa_change_backup_phone" + EventTypeTfaChangeStatus = "tfa_change_status" + EventTypeTfaRemoveBackupPhone = "tfa_remove_backup_phone" + EventTypeTfaRemoveSecurityKey = "tfa_remove_security_key" + EventTypeTfaReset = "tfa_reset" + EventTypeOther = "other" +) + +// ExtendedVersionHistoryChangePolicyDetails : Accepted or opted out of extended +// version history. +type ExtendedVersionHistoryChangePolicyDetails struct { + // NewValue : New extended version history policy. + NewValue *ExtendedVersionHistoryPolicy `json:"new_value"` + // PreviousValue : Previous extended version history policy. Might be + // missing due to historical data gap. + PreviousValue *ExtendedVersionHistoryPolicy `json:"previous_value,omitempty"` +} + +// NewExtendedVersionHistoryChangePolicyDetails returns a new ExtendedVersionHistoryChangePolicyDetails instance +func NewExtendedVersionHistoryChangePolicyDetails(NewValue *ExtendedVersionHistoryPolicy) *ExtendedVersionHistoryChangePolicyDetails { + s := new(ExtendedVersionHistoryChangePolicyDetails) + s.NewValue = NewValue + return s +} + +// ExtendedVersionHistoryPolicy : has no documentation (yet) +type ExtendedVersionHistoryPolicy struct { + dropbox.Tagged +} + +// Valid tag values for ExtendedVersionHistoryPolicy +const ( + ExtendedVersionHistoryPolicyLimited = "limited" + ExtendedVersionHistoryPolicyUnlimited = "unlimited" + ExtendedVersionHistoryPolicyOther = "other" +) + +// FailureDetailsLogInfo : Provides details about a failure +type FailureDetailsLogInfo struct { + // UserFriendlyMessage : A user friendly explanation of the error. Might be + // missing due to historical data gap. + UserFriendlyMessage string `json:"user_friendly_message,omitempty"` + // TechnicalErrorMessage : A technical explanation of the error. This is + // relevant for some errors. + TechnicalErrorMessage string `json:"technical_error_message,omitempty"` +} + +// NewFailureDetailsLogInfo returns a new FailureDetailsLogInfo instance +func NewFailureDetailsLogInfo() *FailureDetailsLogInfo { + s := new(FailureDetailsLogInfo) + return s +} + +// FileAddCommentDetails : Added a file comment. +type FileAddCommentDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // CommentText : Comment text. Might be missing due to historical data gap. + CommentText string `json:"comment_text,omitempty"` +} + +// NewFileAddCommentDetails returns a new FileAddCommentDetails instance +func NewFileAddCommentDetails(TargetIndex int64) *FileAddCommentDetails { + s := new(FileAddCommentDetails) + s.TargetIndex = TargetIndex + return s +} + +// FileAddDetails : Added files and/or folders. +type FileAddDetails struct { +} + +// NewFileAddDetails returns a new FileAddDetails instance +func NewFileAddDetails() *FileAddDetails { + s := new(FileAddDetails) + return s +} + +// FileCommentsChangePolicyDetails : Enabled or disabled commenting on team +// files. +type FileCommentsChangePolicyDetails struct { + // NewValue : New commenting on team files policy. + NewValue *FileCommentsPolicy `json:"new_value"` + // PreviousValue : Previous commenting on team files policy. Might be + // missing due to historical data gap. + PreviousValue *FileCommentsPolicy `json:"previous_value,omitempty"` +} + +// NewFileCommentsChangePolicyDetails returns a new FileCommentsChangePolicyDetails instance +func NewFileCommentsChangePolicyDetails(NewValue *FileCommentsPolicy) *FileCommentsChangePolicyDetails { + s := new(FileCommentsChangePolicyDetails) + s.NewValue = NewValue + return s +} + +// FileCommentsPolicy : File comments policy +type FileCommentsPolicy struct { + dropbox.Tagged +} + +// Valid tag values for FileCommentsPolicy +const ( + FileCommentsPolicyDisabled = "disabled" + FileCommentsPolicyEnabled = "enabled" + FileCommentsPolicyOther = "other" +) + +// FileCopyDetails : Copied files and/or folders. +type FileCopyDetails struct { + // RelocateActionDetails : Relocate action details. + RelocateActionDetails []*RelocateAssetReferencesLogInfo `json:"relocate_action_details"` +} + +// NewFileCopyDetails returns a new FileCopyDetails instance +func NewFileCopyDetails(RelocateActionDetails []*RelocateAssetReferencesLogInfo) *FileCopyDetails { + s := new(FileCopyDetails) + s.RelocateActionDetails = RelocateActionDetails + return s +} + +// FileDeleteDetails : Deleted files and/or folders. +type FileDeleteDetails struct { +} + +// NewFileDeleteDetails returns a new FileDeleteDetails instance +func NewFileDeleteDetails() *FileDeleteDetails { + s := new(FileDeleteDetails) + return s +} + +// FileDownloadDetails : Downloaded files and/or folders. +type FileDownloadDetails struct { +} + +// NewFileDownloadDetails returns a new FileDownloadDetails instance +func NewFileDownloadDetails() *FileDownloadDetails { + s := new(FileDownloadDetails) + return s +} + +// FileEditDetails : Edited files. +type FileEditDetails struct { +} + +// NewFileEditDetails returns a new FileEditDetails instance +func NewFileEditDetails() *FileEditDetails { + s := new(FileEditDetails) + return s +} + +// FileGetCopyReferenceDetails : Create a copy reference to a file or folder. +type FileGetCopyReferenceDetails struct { +} + +// NewFileGetCopyReferenceDetails returns a new FileGetCopyReferenceDetails instance +func NewFileGetCopyReferenceDetails() *FileGetCopyReferenceDetails { + s := new(FileGetCopyReferenceDetails) + return s +} + +// FileLikeCommentDetails : Liked a file comment. +type FileLikeCommentDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // CommentText : Comment text. Might be missing due to historical data gap. + CommentText string `json:"comment_text,omitempty"` +} + +// NewFileLikeCommentDetails returns a new FileLikeCommentDetails instance +func NewFileLikeCommentDetails(TargetIndex int64) *FileLikeCommentDetails { + s := new(FileLikeCommentDetails) + s.TargetIndex = TargetIndex + return s +} + +// FileOrFolderLogInfo : Generic information relevant both for files and folders +type FileOrFolderLogInfo struct { + // Path : Path relative to event context. + Path *PathLogInfo `json:"path"` + // DisplayName : Display name. Might be missing due to historical data gap. + DisplayName string `json:"display_name,omitempty"` + // FileId : Unique ID. Might be missing due to historical data gap. + FileId string `json:"file_id,omitempty"` +} + +// NewFileOrFolderLogInfo returns a new FileOrFolderLogInfo instance +func NewFileOrFolderLogInfo(Path *PathLogInfo) *FileOrFolderLogInfo { + s := new(FileOrFolderLogInfo) + s.Path = Path + return s +} + +// FileLogInfo : File's logged information. +type FileLogInfo struct { + FileOrFolderLogInfo +} + +// NewFileLogInfo returns a new FileLogInfo instance +func NewFileLogInfo(Path *PathLogInfo) *FileLogInfo { + s := new(FileLogInfo) + s.Path = Path + return s +} + +// FileMoveDetails : Moved files and/or folders. +type FileMoveDetails struct { + // RelocateActionDetails : Relocate action details. + RelocateActionDetails []*RelocateAssetReferencesLogInfo `json:"relocate_action_details"` +} + +// NewFileMoveDetails returns a new FileMoveDetails instance +func NewFileMoveDetails(RelocateActionDetails []*RelocateAssetReferencesLogInfo) *FileMoveDetails { + s := new(FileMoveDetails) + s.RelocateActionDetails = RelocateActionDetails + return s +} + +// FilePermanentlyDeleteDetails : Permanently deleted files and/or folders. +type FilePermanentlyDeleteDetails struct { +} + +// NewFilePermanentlyDeleteDetails returns a new FilePermanentlyDeleteDetails instance +func NewFilePermanentlyDeleteDetails() *FilePermanentlyDeleteDetails { + s := new(FilePermanentlyDeleteDetails) + return s +} + +// FilePreviewDetails : Previewed files and/or folders. +type FilePreviewDetails struct { +} + +// NewFilePreviewDetails returns a new FilePreviewDetails instance +func NewFilePreviewDetails() *FilePreviewDetails { + s := new(FilePreviewDetails) + return s +} + +// FileRenameDetails : Renamed files and/or folders. +type FileRenameDetails struct { + // RelocateActionDetails : Relocate action details. + RelocateActionDetails []*RelocateAssetReferencesLogInfo `json:"relocate_action_details"` +} + +// NewFileRenameDetails returns a new FileRenameDetails instance +func NewFileRenameDetails(RelocateActionDetails []*RelocateAssetReferencesLogInfo) *FileRenameDetails { + s := new(FileRenameDetails) + s.RelocateActionDetails = RelocateActionDetails + return s +} + +// FileRequestAddDeadlineDetails : Added a deadline to a file request. +type FileRequestAddDeadlineDetails struct { + // RequestTitle : File request title. + RequestTitle string `json:"request_title"` +} + +// NewFileRequestAddDeadlineDetails returns a new FileRequestAddDeadlineDetails instance +func NewFileRequestAddDeadlineDetails(RequestTitle string) *FileRequestAddDeadlineDetails { + s := new(FileRequestAddDeadlineDetails) + s.RequestTitle = RequestTitle + return s +} + +// FileRequestChangeFolderDetails : Changed the file request folder. +type FileRequestChangeFolderDetails struct { + // RequestTitle : File request title. + RequestTitle string `json:"request_title"` +} + +// NewFileRequestChangeFolderDetails returns a new FileRequestChangeFolderDetails instance +func NewFileRequestChangeFolderDetails(RequestTitle string) *FileRequestChangeFolderDetails { + s := new(FileRequestChangeFolderDetails) + s.RequestTitle = RequestTitle + return s +} + +// FileRequestChangeTitleDetails : Change the file request title. +type FileRequestChangeTitleDetails struct { + // RequestTitle : File request title. + RequestTitle string `json:"request_title"` +} + +// NewFileRequestChangeTitleDetails returns a new FileRequestChangeTitleDetails instance +func NewFileRequestChangeTitleDetails(RequestTitle string) *FileRequestChangeTitleDetails { + s := new(FileRequestChangeTitleDetails) + s.RequestTitle = RequestTitle + return s +} + +// FileRequestCloseDetails : Closed a file request. +type FileRequestCloseDetails struct { + // RequestTitle : File request title. + RequestTitle string `json:"request_title"` +} + +// NewFileRequestCloseDetails returns a new FileRequestCloseDetails instance +func NewFileRequestCloseDetails(RequestTitle string) *FileRequestCloseDetails { + s := new(FileRequestCloseDetails) + s.RequestTitle = RequestTitle + return s +} + +// FileRequestCreateDetails : Created a file request. +type FileRequestCreateDetails struct { + // RequestTitle : File request title. + RequestTitle string `json:"request_title"` +} + +// NewFileRequestCreateDetails returns a new FileRequestCreateDetails instance +func NewFileRequestCreateDetails(RequestTitle string) *FileRequestCreateDetails { + s := new(FileRequestCreateDetails) + s.RequestTitle = RequestTitle + return s +} + +// FileRequestReceiveFileDetails : Received files for a file request. +type FileRequestReceiveFileDetails struct { + // RequestTitle : File request title. + RequestTitle string `json:"request_title"` + // SubmittedFileNames : Submitted file names. + SubmittedFileNames []string `json:"submitted_file_names"` +} + +// NewFileRequestReceiveFileDetails returns a new FileRequestReceiveFileDetails instance +func NewFileRequestReceiveFileDetails(RequestTitle string, SubmittedFileNames []string) *FileRequestReceiveFileDetails { + s := new(FileRequestReceiveFileDetails) + s.RequestTitle = RequestTitle + s.SubmittedFileNames = SubmittedFileNames + return s +} + +// FileRequestRemoveDeadlineDetails : Removed the file request deadline. +type FileRequestRemoveDeadlineDetails struct { + // RequestTitle : File request title. + RequestTitle string `json:"request_title"` +} + +// NewFileRequestRemoveDeadlineDetails returns a new FileRequestRemoveDeadlineDetails instance +func NewFileRequestRemoveDeadlineDetails(RequestTitle string) *FileRequestRemoveDeadlineDetails { + s := new(FileRequestRemoveDeadlineDetails) + s.RequestTitle = RequestTitle + return s +} + +// FileRequestSendDetails : Sent file request to users via email. +type FileRequestSendDetails struct { + // RequestTitle : File request title. + RequestTitle string `json:"request_title"` +} + +// NewFileRequestSendDetails returns a new FileRequestSendDetails instance +func NewFileRequestSendDetails(RequestTitle string) *FileRequestSendDetails { + s := new(FileRequestSendDetails) + s.RequestTitle = RequestTitle + return s +} + +// FileRequestsChangePolicyDetails : Enabled or disabled file requests. +type FileRequestsChangePolicyDetails struct { + // NewValue : New file requests policy. + NewValue *FileRequestsPolicy `json:"new_value"` + // PreviousValue : Previous file requests policy. Might be missing due to + // historical data gap. + PreviousValue *FileRequestsPolicy `json:"previous_value,omitempty"` +} + +// NewFileRequestsChangePolicyDetails returns a new FileRequestsChangePolicyDetails instance +func NewFileRequestsChangePolicyDetails(NewValue *FileRequestsPolicy) *FileRequestsChangePolicyDetails { + s := new(FileRequestsChangePolicyDetails) + s.NewValue = NewValue + return s +} + +// FileRequestsEmailsEnabledDetails : Enabled file request emails for everyone. +type FileRequestsEmailsEnabledDetails struct { +} + +// NewFileRequestsEmailsEnabledDetails returns a new FileRequestsEmailsEnabledDetails instance +func NewFileRequestsEmailsEnabledDetails() *FileRequestsEmailsEnabledDetails { + s := new(FileRequestsEmailsEnabledDetails) + return s +} + +// FileRequestsEmailsRestrictedToTeamOnlyDetails : Allowed file request emails +// for the team. +type FileRequestsEmailsRestrictedToTeamOnlyDetails struct { +} + +// NewFileRequestsEmailsRestrictedToTeamOnlyDetails returns a new FileRequestsEmailsRestrictedToTeamOnlyDetails instance +func NewFileRequestsEmailsRestrictedToTeamOnlyDetails() *FileRequestsEmailsRestrictedToTeamOnlyDetails { + s := new(FileRequestsEmailsRestrictedToTeamOnlyDetails) + return s +} + +// FileRequestsPolicy : File requests policy +type FileRequestsPolicy struct { + dropbox.Tagged +} + +// Valid tag values for FileRequestsPolicy +const ( + FileRequestsPolicyDisabled = "disabled" + FileRequestsPolicyEnabled = "enabled" + FileRequestsPolicyOther = "other" +) + +// FileRestoreDetails : Restored deleted files and/or folders. +type FileRestoreDetails struct { +} + +// NewFileRestoreDetails returns a new FileRestoreDetails instance +func NewFileRestoreDetails() *FileRestoreDetails { + s := new(FileRestoreDetails) + return s +} + +// FileRevertDetails : Reverted files to a previous version. +type FileRevertDetails struct { +} + +// NewFileRevertDetails returns a new FileRevertDetails instance +func NewFileRevertDetails() *FileRevertDetails { + s := new(FileRevertDetails) + return s +} + +// FileRollbackChangesDetails : Rolled back file change location changes. +type FileRollbackChangesDetails struct { +} + +// NewFileRollbackChangesDetails returns a new FileRollbackChangesDetails instance +func NewFileRollbackChangesDetails() *FileRollbackChangesDetails { + s := new(FileRollbackChangesDetails) + return s +} + +// FileSaveCopyReferenceDetails : Save a file or folder using a copy reference. +type FileSaveCopyReferenceDetails struct { + // RelocateActionDetails : Relocate action details. + RelocateActionDetails []*RelocateAssetReferencesLogInfo `json:"relocate_action_details"` +} + +// NewFileSaveCopyReferenceDetails returns a new FileSaveCopyReferenceDetails instance +func NewFileSaveCopyReferenceDetails(RelocateActionDetails []*RelocateAssetReferencesLogInfo) *FileSaveCopyReferenceDetails { + s := new(FileSaveCopyReferenceDetails) + s.RelocateActionDetails = RelocateActionDetails + return s +} + +// FileUnlikeCommentDetails : Unliked a file comment. +type FileUnlikeCommentDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // CommentText : Comment text. Might be missing due to historical data gap. + CommentText string `json:"comment_text,omitempty"` +} + +// NewFileUnlikeCommentDetails returns a new FileUnlikeCommentDetails instance +func NewFileUnlikeCommentDetails(TargetIndex int64) *FileUnlikeCommentDetails { + s := new(FileUnlikeCommentDetails) + s.TargetIndex = TargetIndex + return s +} + +// FolderLogInfo : Folder's logged information. +type FolderLogInfo struct { + FileOrFolderLogInfo +} + +// NewFolderLogInfo returns a new FolderLogInfo instance +func NewFolderLogInfo(Path *PathLogInfo) *FolderLogInfo { + s := new(FolderLogInfo) + s.Path = Path + return s +} + +// GeoLocationLogInfo : Geographic location details. +type GeoLocationLogInfo struct { + // City : City name. + City string `json:"city,omitempty"` + // Region : Region name. + Region string `json:"region,omitempty"` + // Country : Country code. + Country string `json:"country,omitempty"` + // IpAddress : IP address. + IpAddress string `json:"ip_address"` +} + +// NewGeoLocationLogInfo returns a new GeoLocationLogInfo instance +func NewGeoLocationLogInfo(IpAddress string) *GeoLocationLogInfo { + s := new(GeoLocationLogInfo) + s.IpAddress = IpAddress + return s +} + +// GetTeamEventsArg : has no documentation (yet) +type GetTeamEventsArg struct { + // Limit : Number of results to return per call. + Limit uint32 `json:"limit"` + // AccountId : Filter the events by account ID. Return ony events with this + // account_id as either Actor, Context, or Participants. + AccountId string `json:"account_id,omitempty"` + // Time : Filter by time range. + Time *team_common.TimeRange `json:"time,omitempty"` + // Category : Filter the returned events to a single category. + Category *EventCategory `json:"category,omitempty"` +} + +// NewGetTeamEventsArg returns a new GetTeamEventsArg instance +func NewGetTeamEventsArg() *GetTeamEventsArg { + s := new(GetTeamEventsArg) + s.Limit = 1000 + return s +} + +// GetTeamEventsContinueArg : has no documentation (yet) +type GetTeamEventsContinueArg struct { + // Cursor : Indicates from what point to get the next set of events. + Cursor string `json:"cursor"` +} + +// NewGetTeamEventsContinueArg returns a new GetTeamEventsContinueArg instance +func NewGetTeamEventsContinueArg(Cursor string) *GetTeamEventsContinueArg { + s := new(GetTeamEventsContinueArg) + s.Cursor = Cursor + return s +} + +// GetTeamEventsContinueError : Errors that can be raised when calling +// `getEventsContinue`. +type GetTeamEventsContinueError struct { + dropbox.Tagged +} + +// Valid tag values for GetTeamEventsContinueError +const ( + GetTeamEventsContinueErrorBadCursor = "bad_cursor" + GetTeamEventsContinueErrorOther = "other" +) + +// GetTeamEventsError : Errors that can be raised when calling `getEvents`. +type GetTeamEventsError struct { + dropbox.Tagged +} + +// Valid tag values for GetTeamEventsError +const ( + GetTeamEventsErrorAccountIdNotFound = "account_id_not_found" + GetTeamEventsErrorInvalidTimeRange = "invalid_time_range" + GetTeamEventsErrorOther = "other" +) + +// GetTeamEventsResult : has no documentation (yet) +type GetTeamEventsResult struct { + // Events : List of events. + Events []*TeamEvent `json:"events"` + // Cursor : Pass the cursor into `getEventsContinue` to obtain additional + // events. + Cursor string `json:"cursor"` + // HasMore : Is true if there are additional events that have not been + // returned yet. An additional call to `getEventsContinue` can retrieve + // them. + HasMore bool `json:"has_more"` +} + +// NewGetTeamEventsResult returns a new GetTeamEventsResult instance +func NewGetTeamEventsResult(Events []*TeamEvent, Cursor string, HasMore bool) *GetTeamEventsResult { + s := new(GetTeamEventsResult) + s.Events = Events + s.Cursor = Cursor + s.HasMore = HasMore + return s +} + +// GoogleSsoChangePolicyDetails : Enabled or disabled Google single sign-on for +// the team. +type GoogleSsoChangePolicyDetails struct { + // NewValue : New Google single sign-on policy. + NewValue *GoogleSsoPolicy `json:"new_value"` + // PreviousValue : Previous Google single sign-on policy. Might be missing + // due to historical data gap. + PreviousValue *GoogleSsoPolicy `json:"previous_value,omitempty"` +} + +// NewGoogleSsoChangePolicyDetails returns a new GoogleSsoChangePolicyDetails instance +func NewGoogleSsoChangePolicyDetails(NewValue *GoogleSsoPolicy) *GoogleSsoChangePolicyDetails { + s := new(GoogleSsoChangePolicyDetails) + s.NewValue = NewValue + return s +} + +// GoogleSsoPolicy : Google SSO policy +type GoogleSsoPolicy struct { + dropbox.Tagged +} + +// Valid tag values for GoogleSsoPolicy +const ( + GoogleSsoPolicyDisabled = "disabled" + GoogleSsoPolicyEnabled = "enabled" + GoogleSsoPolicyOther = "other" +) + +// GroupAddExternalIdDetails : Added an external ID for group. +type GroupAddExternalIdDetails struct { + // NewValue : Current external id. + NewValue string `json:"new_value"` +} + +// NewGroupAddExternalIdDetails returns a new GroupAddExternalIdDetails instance +func NewGroupAddExternalIdDetails(NewValue string) *GroupAddExternalIdDetails { + s := new(GroupAddExternalIdDetails) + s.NewValue = NewValue + return s +} + +// GroupAddMemberDetails : Added team members to a group. +type GroupAddMemberDetails struct { + // IsGroupOwner : Is group owner. + IsGroupOwner bool `json:"is_group_owner"` +} + +// NewGroupAddMemberDetails returns a new GroupAddMemberDetails instance +func NewGroupAddMemberDetails(IsGroupOwner bool) *GroupAddMemberDetails { + s := new(GroupAddMemberDetails) + s.IsGroupOwner = IsGroupOwner + return s +} + +// GroupChangeExternalIdDetails : Changed the external ID for group. +type GroupChangeExternalIdDetails struct { + // NewValue : Current external id. + NewValue string `json:"new_value"` + // PreviousValue : Old external id. + PreviousValue string `json:"previous_value"` +} + +// NewGroupChangeExternalIdDetails returns a new GroupChangeExternalIdDetails instance +func NewGroupChangeExternalIdDetails(NewValue string, PreviousValue string) *GroupChangeExternalIdDetails { + s := new(GroupChangeExternalIdDetails) + s.NewValue = NewValue + s.PreviousValue = PreviousValue + return s +} + +// GroupChangeManagementTypeDetails : Changed group management type. +type GroupChangeManagementTypeDetails struct { + // NewValue : New group management type. + NewValue *GroupManagementType `json:"new_value"` + // PreviousValue : Previous group management type. Might be missing due to + // historical data gap. + PreviousValue *GroupManagementType `json:"previous_value,omitempty"` +} + +// NewGroupChangeManagementTypeDetails returns a new GroupChangeManagementTypeDetails instance +func NewGroupChangeManagementTypeDetails(NewValue *GroupManagementType) *GroupChangeManagementTypeDetails { + s := new(GroupChangeManagementTypeDetails) + s.NewValue = NewValue + return s +} + +// GroupChangeMemberRoleDetails : Changed the manager permissions belonging to a +// group member. +type GroupChangeMemberRoleDetails struct { + // IsGroupOwner : Is group owner. + IsGroupOwner bool `json:"is_group_owner"` +} + +// NewGroupChangeMemberRoleDetails returns a new GroupChangeMemberRoleDetails instance +func NewGroupChangeMemberRoleDetails(IsGroupOwner bool) *GroupChangeMemberRoleDetails { + s := new(GroupChangeMemberRoleDetails) + s.IsGroupOwner = IsGroupOwner + return s +} + +// GroupCreateDetails : Created a group. +type GroupCreateDetails struct { + // IsAdminManaged : Is admin managed group. Might be missing due to + // historical data gap. + IsAdminManaged bool `json:"is_admin_managed,omitempty"` + // JoinPolicy : Group join policy. + JoinPolicy *GroupJoinPolicy `json:"join_policy"` +} + +// NewGroupCreateDetails returns a new GroupCreateDetails instance +func NewGroupCreateDetails(JoinPolicy *GroupJoinPolicy) *GroupCreateDetails { + s := new(GroupCreateDetails) + s.JoinPolicy = JoinPolicy + return s +} + +// GroupDeleteDetails : Deleted a group. +type GroupDeleteDetails struct { + // IsAdminManaged : Is admin managed group. Might be missing due to + // historical data gap. + IsAdminManaged bool `json:"is_admin_managed,omitempty"` +} + +// NewGroupDeleteDetails returns a new GroupDeleteDetails instance +func NewGroupDeleteDetails() *GroupDeleteDetails { + s := new(GroupDeleteDetails) + return s +} + +// GroupDescriptionUpdatedDetails : Updated a group. +type GroupDescriptionUpdatedDetails struct { +} + +// NewGroupDescriptionUpdatedDetails returns a new GroupDescriptionUpdatedDetails instance +func NewGroupDescriptionUpdatedDetails() *GroupDescriptionUpdatedDetails { + s := new(GroupDescriptionUpdatedDetails) + return s +} + +// GroupJoinPolicy : has no documentation (yet) +type GroupJoinPolicy struct { + dropbox.Tagged +} + +// Valid tag values for GroupJoinPolicy +const ( + GroupJoinPolicyOpen = "open" + GroupJoinPolicyRequestToJoin = "request_to_join" + GroupJoinPolicyOther = "other" +) + +// GroupJoinPolicyUpdatedDetails : Updated a group join policy. +type GroupJoinPolicyUpdatedDetails struct { + // IsAdminManaged : Is admin managed group. Might be missing due to + // historical data gap. + IsAdminManaged bool `json:"is_admin_managed,omitempty"` + // JoinPolicy : Group join policy. + JoinPolicy *GroupJoinPolicy `json:"join_policy"` +} + +// NewGroupJoinPolicyUpdatedDetails returns a new GroupJoinPolicyUpdatedDetails instance +func NewGroupJoinPolicyUpdatedDetails(JoinPolicy *GroupJoinPolicy) *GroupJoinPolicyUpdatedDetails { + s := new(GroupJoinPolicyUpdatedDetails) + s.JoinPolicy = JoinPolicy + return s +} + +// GroupLogInfo : Group's logged information. +type GroupLogInfo struct { + // GroupId : The unique id of this group. Might be missing due to historical + // data gap. + GroupId string `json:"group_id,omitempty"` + // DisplayName : The name of this group. + DisplayName string `json:"display_name"` + // ExternalId : External group ID. Might be missing due to historical data + // gap. + ExternalId string `json:"external_id,omitempty"` +} + +// NewGroupLogInfo returns a new GroupLogInfo instance +func NewGroupLogInfo(DisplayName string) *GroupLogInfo { + s := new(GroupLogInfo) + s.DisplayName = DisplayName + return s +} + +// GroupManagementType : has no documentation (yet) +type GroupManagementType struct { + dropbox.Tagged +} + +// Valid tag values for GroupManagementType +const ( + GroupManagementTypeAdminManagementGroup = "admin_management_group" + GroupManagementTypeMemberManagementGroup = "member_management_group" + GroupManagementTypeOther = "other" +) + +// GroupMovedDetails : Moved a group. +type GroupMovedDetails struct { +} + +// NewGroupMovedDetails returns a new GroupMovedDetails instance +func NewGroupMovedDetails() *GroupMovedDetails { + s := new(GroupMovedDetails) + return s +} + +// GroupRemoveExternalIdDetails : Removed the external ID for group. +type GroupRemoveExternalIdDetails struct { + // PreviousValue : Old external id. + PreviousValue string `json:"previous_value"` +} + +// NewGroupRemoveExternalIdDetails returns a new GroupRemoveExternalIdDetails instance +func NewGroupRemoveExternalIdDetails(PreviousValue string) *GroupRemoveExternalIdDetails { + s := new(GroupRemoveExternalIdDetails) + s.PreviousValue = PreviousValue + return s +} + +// GroupRemoveMemberDetails : Removed team members from a group. +type GroupRemoveMemberDetails struct { +} + +// NewGroupRemoveMemberDetails returns a new GroupRemoveMemberDetails instance +func NewGroupRemoveMemberDetails() *GroupRemoveMemberDetails { + s := new(GroupRemoveMemberDetails) + return s +} + +// GroupRenameDetails : Renamed a group. +type GroupRenameDetails struct { + // PreviousValue : Previous display name. + PreviousValue string `json:"previous_value"` +} + +// NewGroupRenameDetails returns a new GroupRenameDetails instance +func NewGroupRenameDetails(PreviousValue string) *GroupRenameDetails { + s := new(GroupRenameDetails) + s.PreviousValue = PreviousValue + return s +} + +// GroupUserManagementChangePolicyDetails : Changed who can create groups. +type GroupUserManagementChangePolicyDetails struct { + // NewValue : New group users management policy. + NewValue *GroupUserManagementPolicy `json:"new_value"` + // PreviousValue : Previous group users management policy. Might be missing + // due to historical data gap. + PreviousValue *GroupUserManagementPolicy `json:"previous_value,omitempty"` +} + +// NewGroupUserManagementChangePolicyDetails returns a new GroupUserManagementChangePolicyDetails instance +func NewGroupUserManagementChangePolicyDetails(NewValue *GroupUserManagementPolicy) *GroupUserManagementChangePolicyDetails { + s := new(GroupUserManagementChangePolicyDetails) + s.NewValue = NewValue + return s +} + +// GroupUserManagementPolicy : has no documentation (yet) +type GroupUserManagementPolicy struct { + dropbox.Tagged +} + +// Valid tag values for GroupUserManagementPolicy +const ( + GroupUserManagementPolicyAllUsers = "all_users" + GroupUserManagementPolicyOnlyAdmins = "only_admins" + GroupUserManagementPolicyOther = "other" +) + +// HostLogInfo : Host details. +type HostLogInfo struct { + // HostId : Host ID. Might be missing due to historical data gap. + HostId uint64 `json:"host_id,omitempty"` + // HostName : Host name. Might be missing due to historical data gap. + HostName string `json:"host_name,omitempty"` +} + +// NewHostLogInfo returns a new HostLogInfo instance +func NewHostLogInfo() *HostLogInfo { + s := new(HostLogInfo) + return s +} + +// JoinTeamDetails : Additional information relevant when a new member joins the +// team. +type JoinTeamDetails struct { + // LinkedApps : Linked applications. + LinkedApps []IsAppLogInfo `json:"linked_apps"` + // LinkedDevices : Linked devices. + LinkedDevices []*DeviceLogInfo `json:"linked_devices"` + // LinkedSharedFolders : Linked shared folders. + LinkedSharedFolders []*FolderLogInfo `json:"linked_shared_folders"` +} + +// NewJoinTeamDetails returns a new JoinTeamDetails instance +func NewJoinTeamDetails(LinkedApps []IsAppLogInfo, LinkedDevices []*DeviceLogInfo, LinkedSharedFolders []*FolderLogInfo) *JoinTeamDetails { + s := new(JoinTeamDetails) + s.LinkedApps = LinkedApps + s.LinkedDevices = LinkedDevices + s.LinkedSharedFolders = LinkedSharedFolders + return s +} + +// LinkAudience : has no documentation (yet) +type LinkAudience struct { + dropbox.Tagged +} + +// Valid tag values for LinkAudience +const ( + LinkAudiencePublic = "public" + LinkAudienceTeam = "team" + LinkAudienceMembers = "members" + LinkAudienceOther = "other" +) + +// LogoutDetails : Signed out. +type LogoutDetails struct { +} + +// NewLogoutDetails returns a new LogoutDetails instance +func NewLogoutDetails() *LogoutDetails { + s := new(LogoutDetails) + return s +} + +// MemberAddNameDetails : Set team member name when joining team. +type MemberAddNameDetails struct { + // Value : User's name. + Value *UserNameLogInfo `json:"value"` +} + +// NewMemberAddNameDetails returns a new MemberAddNameDetails instance +func NewMemberAddNameDetails(Value *UserNameLogInfo) *MemberAddNameDetails { + s := new(MemberAddNameDetails) + s.Value = Value + return s +} + +// MemberChangeAdminRoleDetails : Change the admin role belonging to team +// member. +type MemberChangeAdminRoleDetails struct { + // NewValue : New admin role. This field is relevant when the admin role is + // changed or whenthe user role changes from no admin rights to with admin + // rights. + NewValue *AdminRole `json:"new_value,omitempty"` + // PreviousValue : Previous admin role. This field is relevant when the + // admin role is changed or when the admin role is removed. + PreviousValue *AdminRole `json:"previous_value,omitempty"` +} + +// NewMemberChangeAdminRoleDetails returns a new MemberChangeAdminRoleDetails instance +func NewMemberChangeAdminRoleDetails() *MemberChangeAdminRoleDetails { + s := new(MemberChangeAdminRoleDetails) + return s +} + +// MemberChangeEmailDetails : Changed team member email address. +type MemberChangeEmailDetails struct { + // NewValue : New email. + NewValue string `json:"new_value"` + // PreviousValue : Previous email. Might be missing due to historical data + // gap. + PreviousValue string `json:"previous_value,omitempty"` +} + +// NewMemberChangeEmailDetails returns a new MemberChangeEmailDetails instance +func NewMemberChangeEmailDetails(NewValue string) *MemberChangeEmailDetails { + s := new(MemberChangeEmailDetails) + s.NewValue = NewValue + return s +} + +// MemberChangeMembershipTypeDetails : Changed the membership type (limited vs +// full) for team member. +type MemberChangeMembershipTypeDetails struct { + // PrevValue : Previous membership type. + PrevValue *TeamMembershipType `json:"prev_value"` + // NewValue : New membership type. + NewValue *TeamMembershipType `json:"new_value"` +} + +// NewMemberChangeMembershipTypeDetails returns a new MemberChangeMembershipTypeDetails instance +func NewMemberChangeMembershipTypeDetails(PrevValue *TeamMembershipType, NewValue *TeamMembershipType) *MemberChangeMembershipTypeDetails { + s := new(MemberChangeMembershipTypeDetails) + s.PrevValue = PrevValue + s.NewValue = NewValue + return s +} + +// MemberChangeNameDetails : Changed team member name. +type MemberChangeNameDetails struct { + // NewValue : New user's name. + NewValue *UserNameLogInfo `json:"new_value"` + // PreviousValue : Previous user's name. + PreviousValue *UserNameLogInfo `json:"previous_value"` +} + +// NewMemberChangeNameDetails returns a new MemberChangeNameDetails instance +func NewMemberChangeNameDetails(NewValue *UserNameLogInfo, PreviousValue *UserNameLogInfo) *MemberChangeNameDetails { + s := new(MemberChangeNameDetails) + s.NewValue = NewValue + s.PreviousValue = PreviousValue + return s +} + +// MemberChangeStatusDetails : Changed the membership status of a team member. +type MemberChangeStatusDetails struct { + // PreviousValue : Previous member status. Might be missing due to + // historical data gap. + PreviousValue *MemberStatus `json:"previous_value,omitempty"` + // NewValue : New member status. + NewValue *MemberStatus `json:"new_value"` + // TeamJoinDetails : Additional information relevant when a new member joins + // the team. + TeamJoinDetails *JoinTeamDetails `json:"team_join_details,omitempty"` +} + +// NewMemberChangeStatusDetails returns a new MemberChangeStatusDetails instance +func NewMemberChangeStatusDetails(NewValue *MemberStatus) *MemberChangeStatusDetails { + s := new(MemberChangeStatusDetails) + s.NewValue = NewValue + return s +} + +// MemberPermanentlyDeleteAccountContentsDetails : Permanently deleted contents +// of a removed team member account. +type MemberPermanentlyDeleteAccountContentsDetails struct { +} + +// NewMemberPermanentlyDeleteAccountContentsDetails returns a new MemberPermanentlyDeleteAccountContentsDetails instance +func NewMemberPermanentlyDeleteAccountContentsDetails() *MemberPermanentlyDeleteAccountContentsDetails { + s := new(MemberPermanentlyDeleteAccountContentsDetails) + return s +} + +// MemberRequestsChangePolicyDetails : Changed whether users can find the team +// when not invited. +type MemberRequestsChangePolicyDetails struct { + // NewValue : New member change requests policy. + NewValue *MemberRequestsPolicy `json:"new_value"` + // PreviousValue : Previous member change requests policy. Might be missing + // due to historical data gap. + PreviousValue *MemberRequestsPolicy `json:"previous_value,omitempty"` +} + +// NewMemberRequestsChangePolicyDetails returns a new MemberRequestsChangePolicyDetails instance +func NewMemberRequestsChangePolicyDetails(NewValue *MemberRequestsPolicy) *MemberRequestsChangePolicyDetails { + s := new(MemberRequestsChangePolicyDetails) + s.NewValue = NewValue + return s +} + +// MemberRequestsPolicy : has no documentation (yet) +type MemberRequestsPolicy struct { + dropbox.Tagged +} + +// Valid tag values for MemberRequestsPolicy +const ( + MemberRequestsPolicyDisabled = "disabled" + MemberRequestsPolicyRequireApproval = "require_approval" + MemberRequestsPolicyAutoApproval = "auto_approval" + MemberRequestsPolicyOther = "other" +) + +// MemberSpaceLimitsAddExceptionDetails : Added an exception for one or more +// team members to bypass space limits imposed by policy. +type MemberSpaceLimitsAddExceptionDetails struct { +} + +// NewMemberSpaceLimitsAddExceptionDetails returns a new MemberSpaceLimitsAddExceptionDetails instance +func NewMemberSpaceLimitsAddExceptionDetails() *MemberSpaceLimitsAddExceptionDetails { + s := new(MemberSpaceLimitsAddExceptionDetails) + return s +} + +// MemberSpaceLimitsChangePolicyDetails : Changed the storage limits applied to +// team members by policy. +type MemberSpaceLimitsChangePolicyDetails struct { + // PreviousValue : Previous storage limits policy. + PreviousValue *SpaceLimitsLevel `json:"previous_value"` + // NewValue : New storage limits policy. + NewValue *SpaceLimitsLevel `json:"new_value"` +} + +// NewMemberSpaceLimitsChangePolicyDetails returns a new MemberSpaceLimitsChangePolicyDetails instance +func NewMemberSpaceLimitsChangePolicyDetails(PreviousValue *SpaceLimitsLevel, NewValue *SpaceLimitsLevel) *MemberSpaceLimitsChangePolicyDetails { + s := new(MemberSpaceLimitsChangePolicyDetails) + s.PreviousValue = PreviousValue + s.NewValue = NewValue + return s +} + +// MemberSpaceLimitsChangeStatusDetails : Changed the status with respect to +// whether the team member is under or over storage quota specified by policy. +type MemberSpaceLimitsChangeStatusDetails struct { + // PreviousValue : Previous storage quota status. + PreviousValue *SpaceLimitsStatus `json:"previous_value"` + // NewValue : New storage quota status. + NewValue *SpaceLimitsStatus `json:"new_value"` +} + +// NewMemberSpaceLimitsChangeStatusDetails returns a new MemberSpaceLimitsChangeStatusDetails instance +func NewMemberSpaceLimitsChangeStatusDetails(PreviousValue *SpaceLimitsStatus, NewValue *SpaceLimitsStatus) *MemberSpaceLimitsChangeStatusDetails { + s := new(MemberSpaceLimitsChangeStatusDetails) + s.PreviousValue = PreviousValue + s.NewValue = NewValue + return s +} + +// MemberSpaceLimitsRemoveExceptionDetails : Removed an exception for one or +// more team members to bypass space limits imposed by policy. +type MemberSpaceLimitsRemoveExceptionDetails struct { +} + +// NewMemberSpaceLimitsRemoveExceptionDetails returns a new MemberSpaceLimitsRemoveExceptionDetails instance +func NewMemberSpaceLimitsRemoveExceptionDetails() *MemberSpaceLimitsRemoveExceptionDetails { + s := new(MemberSpaceLimitsRemoveExceptionDetails) + return s +} + +// MemberStatus : has no documentation (yet) +type MemberStatus struct { + dropbox.Tagged +} + +// Valid tag values for MemberStatus +const ( + MemberStatusNotJoined = "not_joined" + MemberStatusInvited = "invited" + MemberStatusActive = "active" + MemberStatusSuspended = "suspended" + MemberStatusRemoved = "removed" + MemberStatusOther = "other" +) + +// MemberSuggestDetails : Suggested a new team member to be added to the team. +type MemberSuggestDetails struct { +} + +// NewMemberSuggestDetails returns a new MemberSuggestDetails instance +func NewMemberSuggestDetails() *MemberSuggestDetails { + s := new(MemberSuggestDetails) + return s +} + +// MemberSuggestionsChangePolicyDetails : Enabled or disabled the option for +// team members to suggest new members to add to the team. +type MemberSuggestionsChangePolicyDetails struct { + // NewValue : New team member suggestions policy. + NewValue *MemberSuggestionsPolicy `json:"new_value"` + // PreviousValue : Previous team member suggestions policy. Might be missing + // due to historical data gap. + PreviousValue *MemberSuggestionsPolicy `json:"previous_value,omitempty"` +} + +// NewMemberSuggestionsChangePolicyDetails returns a new MemberSuggestionsChangePolicyDetails instance +func NewMemberSuggestionsChangePolicyDetails(NewValue *MemberSuggestionsPolicy) *MemberSuggestionsChangePolicyDetails { + s := new(MemberSuggestionsChangePolicyDetails) + s.NewValue = NewValue + return s +} + +// MemberSuggestionsPolicy : Member suggestions policy +type MemberSuggestionsPolicy struct { + dropbox.Tagged +} + +// Valid tag values for MemberSuggestionsPolicy +const ( + MemberSuggestionsPolicyDisabled = "disabled" + MemberSuggestionsPolicyEnabled = "enabled" + MemberSuggestionsPolicyOther = "other" +) + +// MemberTransferAccountContentsDetails : Transferred contents of a removed team +// member account to another member. +type MemberTransferAccountContentsDetails struct { + // SrcIndex : Source asset index. + SrcIndex int64 `json:"src_index"` + // DestIndex : Destination asset index. + DestIndex int64 `json:"dest_index"` +} + +// NewMemberTransferAccountContentsDetails returns a new MemberTransferAccountContentsDetails instance +func NewMemberTransferAccountContentsDetails(SrcIndex int64, DestIndex int64) *MemberTransferAccountContentsDetails { + s := new(MemberTransferAccountContentsDetails) + s.SrcIndex = SrcIndex + s.DestIndex = DestIndex + return s +} + +// MicrosoftOfficeAddinChangePolicyDetails : Enabled or disabled the Microsoft +// Office add-in, which lets team members save files to Dropbox directly from +// Microsoft Office. +type MicrosoftOfficeAddinChangePolicyDetails struct { + // NewValue : New Microsoft Office addin policy. + NewValue *MicrosoftOfficeAddinPolicy `json:"new_value"` + // PreviousValue : Previous Microsoft Office addin policy. Might be missing + // due to historical data gap. + PreviousValue *MicrosoftOfficeAddinPolicy `json:"previous_value,omitempty"` +} + +// NewMicrosoftOfficeAddinChangePolicyDetails returns a new MicrosoftOfficeAddinChangePolicyDetails instance +func NewMicrosoftOfficeAddinChangePolicyDetails(NewValue *MicrosoftOfficeAddinPolicy) *MicrosoftOfficeAddinChangePolicyDetails { + s := new(MicrosoftOfficeAddinChangePolicyDetails) + s.NewValue = NewValue + return s +} + +// MicrosoftOfficeAddinPolicy : Microsoft Office addin policy +type MicrosoftOfficeAddinPolicy struct { + dropbox.Tagged +} + +// Valid tag values for MicrosoftOfficeAddinPolicy +const ( + MicrosoftOfficeAddinPolicyDisabled = "disabled" + MicrosoftOfficeAddinPolicyEnabled = "enabled" + MicrosoftOfficeAddinPolicyOther = "other" +) + +// MissingDetails : An indication that an event was returned with missing +// details +type MissingDetails struct { +} + +// NewMissingDetails returns a new MissingDetails instance +func NewMissingDetails() *MissingDetails { + s := new(MissingDetails) + return s +} + +// MobileSessionLogInfo : Mobile session. +type MobileSessionLogInfo struct { + SessionLogInfo +} + +// NewMobileSessionLogInfo returns a new MobileSessionLogInfo instance +func NewMobileSessionLogInfo() *MobileSessionLogInfo { + s := new(MobileSessionLogInfo) + return s +} + +// NamespaceRelativePathLogInfo : Namespace relative path details. +type NamespaceRelativePathLogInfo struct { + // NsId : Namespace ID. Might be missing due to historical data gap. + NsId string `json:"ns_id,omitempty"` + // RelativePath : A path relative to the specified namespace ID. Might be + // missing due to historical data gap. + RelativePath string `json:"relative_path,omitempty"` +} + +// NewNamespaceRelativePathLogInfo returns a new NamespaceRelativePathLogInfo instance +func NewNamespaceRelativePathLogInfo() *NamespaceRelativePathLogInfo { + s := new(NamespaceRelativePathLogInfo) + return s +} + +// NetworkControlChangePolicyDetails : Enabled or disabled network control. +type NetworkControlChangePolicyDetails struct { + // NewValue : New network control policy. + NewValue *NetworkControlPolicy `json:"new_value"` + // PreviousValue : Previous network control policy. Might be missing due to + // historical data gap. + PreviousValue *NetworkControlPolicy `json:"previous_value,omitempty"` +} + +// NewNetworkControlChangePolicyDetails returns a new NetworkControlChangePolicyDetails instance +func NewNetworkControlChangePolicyDetails(NewValue *NetworkControlPolicy) *NetworkControlChangePolicyDetails { + s := new(NetworkControlChangePolicyDetails) + s.NewValue = NewValue + return s +} + +// NetworkControlPolicy : Network control policy +type NetworkControlPolicy struct { + dropbox.Tagged +} + +// Valid tag values for NetworkControlPolicy +const ( + NetworkControlPolicyDisabled = "disabled" + NetworkControlPolicyEnabled = "enabled" + NetworkControlPolicyOther = "other" +) + +// UserLogInfo : User's logged information. +type UserLogInfo struct { + // AccountId : User unique ID. Might be missing due to historical data gap. + AccountId string `json:"account_id,omitempty"` + // DisplayName : User display name. Might be missing due to historical data + // gap. + DisplayName string `json:"display_name,omitempty"` + // Email : User email address. Might be missing due to historical data gap. + Email string `json:"email,omitempty"` +} + +// NewUserLogInfo returns a new UserLogInfo instance +func NewUserLogInfo() *UserLogInfo { + s := new(UserLogInfo) + return s +} + +// IsUserLogInfo is the interface type for UserLogInfo and its subtypes +type IsUserLogInfo interface { + IsUserLogInfo() +} + +// IsUserLogInfo implements the IsUserLogInfo interface +func (u *UserLogInfo) IsUserLogInfo() {} + +type userLogInfoUnion struct { + dropbox.Tagged + // TeamMember : has no documentation (yet) + TeamMember *TeamMemberLogInfo `json:"team_member,omitempty"` + // NonTeamMember : has no documentation (yet) + NonTeamMember *NonTeamMemberLogInfo `json:"non_team_member,omitempty"` +} + +// Valid tag values for UserLogInfo +const ( + UserLogInfoTeamMember = "team_member" + UserLogInfoNonTeamMember = "non_team_member" +) + +// UnmarshalJSON deserializes into a userLogInfoUnion instance +func (u *userLogInfoUnion) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // TeamMember : has no documentation (yet) + TeamMember json.RawMessage `json:"team_member,omitempty"` + // NonTeamMember : has no documentation (yet) + NonTeamMember json.RawMessage `json:"non_team_member,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 "team_member": + err = json.Unmarshal(body, &u.TeamMember) + + if err != nil { + return err + } + case "non_team_member": + err = json.Unmarshal(body, &u.NonTeamMember) + + if err != nil { + return err + } + } + return nil +} + +// IsUserLogInfoFromJSON converts JSON to a concrete IsUserLogInfo instance +func IsUserLogInfoFromJSON(data []byte) (IsUserLogInfo, error) { + var t userLogInfoUnion + if err := json.Unmarshal(data, &t); err != nil { + return nil, err + } + switch t.Tag { + case "team_member": + return t.TeamMember, nil + + case "non_team_member": + return t.NonTeamMember, nil + + } + return nil, nil +} + +// NonTeamMemberLogInfo : Non team member's logged information. +type NonTeamMemberLogInfo struct { + UserLogInfo +} + +// NewNonTeamMemberLogInfo returns a new NonTeamMemberLogInfo instance +func NewNonTeamMemberLogInfo() *NonTeamMemberLogInfo { + s := new(NonTeamMemberLogInfo) + return s +} + +// NoteAclInviteOnlyDetails : Changed a Paper document to be invite-only. +type NoteAclInviteOnlyDetails struct { +} + +// NewNoteAclInviteOnlyDetails returns a new NoteAclInviteOnlyDetails instance +func NewNoteAclInviteOnlyDetails() *NoteAclInviteOnlyDetails { + s := new(NoteAclInviteOnlyDetails) + return s +} + +// NoteAclLinkDetails : Changed a Paper document to be link accessible. +type NoteAclLinkDetails struct { +} + +// NewNoteAclLinkDetails returns a new NoteAclLinkDetails instance +func NewNoteAclLinkDetails() *NoteAclLinkDetails { + s := new(NoteAclLinkDetails) + return s +} + +// NoteAclTeamLinkDetails : Changed a Paper document to be link accessible for +// the team. +type NoteAclTeamLinkDetails struct { +} + +// NewNoteAclTeamLinkDetails returns a new NoteAclTeamLinkDetails instance +func NewNoteAclTeamLinkDetails() *NoteAclTeamLinkDetails { + s := new(NoteAclTeamLinkDetails) + return s +} + +// NoteShareReceiveDetails : Shared Paper document received. +type NoteShareReceiveDetails struct { +} + +// NewNoteShareReceiveDetails returns a new NoteShareReceiveDetails instance +func NewNoteShareReceiveDetails() *NoteShareReceiveDetails { + s := new(NoteShareReceiveDetails) + return s +} + +// NoteSharedDetails : Shared a Paper doc. +type NoteSharedDetails struct { +} + +// NewNoteSharedDetails returns a new NoteSharedDetails instance +func NewNoteSharedDetails() *NoteSharedDetails { + s := new(NoteSharedDetails) + return s +} + +// OpenNoteSharedDetails : Opened a shared Paper doc. +type OpenNoteSharedDetails struct { +} + +// NewOpenNoteSharedDetails returns a new OpenNoteSharedDetails instance +func NewOpenNoteSharedDetails() *OpenNoteSharedDetails { + s := new(OpenNoteSharedDetails) + return s +} + +// OriginLogInfo : The origin from which the actor performed the action. +type OriginLogInfo struct { + // GeoLocation : Geographic location details. + GeoLocation *GeoLocationLogInfo `json:"geo_location,omitempty"` + // Host : Host details. + Host *HostLogInfo `json:"host,omitempty"` + // AccessMethod : The method that was used to perform the action. + AccessMethod *AccessMethodLogInfo `json:"access_method"` +} + +// NewOriginLogInfo returns a new OriginLogInfo instance +func NewOriginLogInfo(AccessMethod *AccessMethodLogInfo) *OriginLogInfo { + s := new(OriginLogInfo) + s.AccessMethod = AccessMethod + return s +} + +// PaperAccessType : has no documentation (yet) +type PaperAccessType struct { + dropbox.Tagged +} + +// Valid tag values for PaperAccessType +const ( + PaperAccessTypeViewer = "viewer" + PaperAccessTypeCommenter = "commenter" + PaperAccessTypeEditor = "editor" + PaperAccessTypeOther = "other" +) + +// PaperChangeDeploymentPolicyDetails : Changed whether Dropbox Paper, when +// enabled, is deployed to all teams or to specific members of the team. +type PaperChangeDeploymentPolicyDetails struct { + // NewValue : New Dropbox Paper deployment policy. + NewValue *PaperDeploymentPolicy `json:"new_value"` + // PreviousValue : Previous Dropbox Paper deployment policy. Might be + // missing due to historical data gap. + PreviousValue *PaperDeploymentPolicy `json:"previous_value,omitempty"` +} + +// NewPaperChangeDeploymentPolicyDetails returns a new PaperChangeDeploymentPolicyDetails instance +func NewPaperChangeDeploymentPolicyDetails(NewValue *PaperDeploymentPolicy) *PaperChangeDeploymentPolicyDetails { + s := new(PaperChangeDeploymentPolicyDetails) + 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. +type PaperChangeMemberPolicyDetails struct { + // NewValue : New paper external accessibility policy. + NewValue *PaperMemberPolicy `json:"new_value"` + // PreviousValue : Previous paper external accessibility policy. Might be + // missing due to historical data gap. + PreviousValue *PaperMemberPolicy `json:"previous_value,omitempty"` +} + +// NewPaperChangeMemberPolicyDetails returns a new PaperChangeMemberPolicyDetails instance +func NewPaperChangeMemberPolicyDetails(NewValue *PaperMemberPolicy) *PaperChangeMemberPolicyDetails { + s := new(PaperChangeMemberPolicyDetails) + s.NewValue = NewValue + return s +} + +// PaperChangePolicyDetails : Enabled or disabled Dropbox Paper for the team. +type PaperChangePolicyDetails struct { + // NewValue : New Dropbox Paper policy. + NewValue *PaperPolicy `json:"new_value"` + // PreviousValue : Previous Dropbox Paper policy. Might be missing due to + // historical data gap. + PreviousValue *PaperPolicy `json:"previous_value,omitempty"` +} + +// NewPaperChangePolicyDetails returns a new PaperChangePolicyDetails instance +func NewPaperChangePolicyDetails(NewValue *PaperPolicy) *PaperChangePolicyDetails { + s := new(PaperChangePolicyDetails) + s.NewValue = NewValue + return s +} + +// PaperContentAddMemberDetails : Added users to the membership of a Paper doc +// or folder. +type PaperContentAddMemberDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` +} + +// NewPaperContentAddMemberDetails returns a new PaperContentAddMemberDetails instance +func NewPaperContentAddMemberDetails(EventUuid string) *PaperContentAddMemberDetails { + s := new(PaperContentAddMemberDetails) + s.EventUuid = EventUuid + return s +} + +// PaperContentAddToFolderDetails : Added Paper doc or folder to a folder. +type PaperContentAddToFolderDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // ParentIndex : Parent asset index. + ParentIndex int64 `json:"parent_index"` +} + +// NewPaperContentAddToFolderDetails returns a new PaperContentAddToFolderDetails instance +func NewPaperContentAddToFolderDetails(EventUuid string, TargetIndex int64, ParentIndex int64) *PaperContentAddToFolderDetails { + s := new(PaperContentAddToFolderDetails) + s.EventUuid = EventUuid + s.TargetIndex = TargetIndex + s.ParentIndex = ParentIndex + return s +} + +// PaperContentArchiveDetails : Archived Paper doc or folder. +type PaperContentArchiveDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` +} + +// NewPaperContentArchiveDetails returns a new PaperContentArchiveDetails instance +func NewPaperContentArchiveDetails(EventUuid string) *PaperContentArchiveDetails { + s := new(PaperContentArchiveDetails) + s.EventUuid = EventUuid + return s +} + +// PaperContentChangeSubscriptionDetails : Followed or unfollowed a Paper doc or +// folder. +type PaperContentChangeSubscriptionDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` + // NewSubscriptionLevel : New subscription level. + NewSubscriptionLevel *PaperTaggedValue `json:"new_subscription_level"` + // PreviousSubscriptionLevel : Previous subscription level. Might be missing + // due to historical data gap. + PreviousSubscriptionLevel *PaperTaggedValue `json:"previous_subscription_level,omitempty"` +} + +// NewPaperContentChangeSubscriptionDetails returns a new PaperContentChangeSubscriptionDetails instance +func NewPaperContentChangeSubscriptionDetails(EventUuid string, NewSubscriptionLevel *PaperTaggedValue) *PaperContentChangeSubscriptionDetails { + s := new(PaperContentChangeSubscriptionDetails) + s.EventUuid = EventUuid + s.NewSubscriptionLevel = NewSubscriptionLevel + return s +} + +// PaperContentCreateDetails : Created a Paper doc or folder. +type PaperContentCreateDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` +} + +// NewPaperContentCreateDetails returns a new PaperContentCreateDetails instance +func NewPaperContentCreateDetails(EventUuid string) *PaperContentCreateDetails { + s := new(PaperContentCreateDetails) + s.EventUuid = EventUuid + return s +} + +// PaperContentPermanentlyDeleteDetails : Permanently deleted a Paper doc or +// folder. +type PaperContentPermanentlyDeleteDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` +} + +// NewPaperContentPermanentlyDeleteDetails returns a new PaperContentPermanentlyDeleteDetails instance +func NewPaperContentPermanentlyDeleteDetails(EventUuid string) *PaperContentPermanentlyDeleteDetails { + s := new(PaperContentPermanentlyDeleteDetails) + s.EventUuid = EventUuid + return s +} + +// PaperContentRemoveFromFolderDetails : Removed Paper doc or folder from a +// folder. +type PaperContentRemoveFromFolderDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` +} + +// NewPaperContentRemoveFromFolderDetails returns a new PaperContentRemoveFromFolderDetails instance +func NewPaperContentRemoveFromFolderDetails(EventUuid string) *PaperContentRemoveFromFolderDetails { + s := new(PaperContentRemoveFromFolderDetails) + s.EventUuid = EventUuid + return s +} + +// PaperContentRemoveMemberDetails : Removed a user from the membership of a +// Paper doc or folder. +type PaperContentRemoveMemberDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` +} + +// NewPaperContentRemoveMemberDetails returns a new PaperContentRemoveMemberDetails instance +func NewPaperContentRemoveMemberDetails(EventUuid string) *PaperContentRemoveMemberDetails { + s := new(PaperContentRemoveMemberDetails) + s.EventUuid = EventUuid + return s +} + +// PaperContentRenameDetails : Renamed Paper doc or folder. +type PaperContentRenameDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` +} + +// NewPaperContentRenameDetails returns a new PaperContentRenameDetails instance +func NewPaperContentRenameDetails(EventUuid string) *PaperContentRenameDetails { + s := new(PaperContentRenameDetails) + s.EventUuid = EventUuid + return s +} + +// PaperContentRestoreDetails : Restored an archived Paper doc or folder. +type PaperContentRestoreDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` +} + +// NewPaperContentRestoreDetails returns a new PaperContentRestoreDetails instance +func NewPaperContentRestoreDetails(EventUuid string) *PaperContentRestoreDetails { + s := new(PaperContentRestoreDetails) + s.EventUuid = EventUuid + return s +} + +// PaperDeploymentPolicy : has no documentation (yet) +type PaperDeploymentPolicy struct { + dropbox.Tagged +} + +// Valid tag values for PaperDeploymentPolicy +const ( + PaperDeploymentPolicyPartial = "partial" + PaperDeploymentPolicyFull = "full" + PaperDeploymentPolicyOther = "other" +) + +// PaperDocAddCommentDetails : Added a Paper doc comment. +type PaperDocAddCommentDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` + // CommentText : Comment text. Might be missing due to historical data gap. + CommentText string `json:"comment_text,omitempty"` +} + +// NewPaperDocAddCommentDetails returns a new PaperDocAddCommentDetails instance +func NewPaperDocAddCommentDetails(EventUuid string) *PaperDocAddCommentDetails { + s := new(PaperDocAddCommentDetails) + s.EventUuid = EventUuid + return s +} + +// PaperDocChangeMemberRoleDetails : Changed the access type of a Paper doc +// member. +type PaperDocChangeMemberRoleDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` + // AccessType : Paper doc access type. + AccessType *PaperAccessType `json:"access_type"` +} + +// NewPaperDocChangeMemberRoleDetails returns a new PaperDocChangeMemberRoleDetails instance +func NewPaperDocChangeMemberRoleDetails(EventUuid string, AccessType *PaperAccessType) *PaperDocChangeMemberRoleDetails { + s := new(PaperDocChangeMemberRoleDetails) + s.EventUuid = EventUuid + s.AccessType = AccessType + return s +} + +// PaperDocChangeSharingPolicyDetails : Changed the sharing policy for Paper +// doc. +type PaperDocChangeSharingPolicyDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` + // PublicSharingPolicy : Sharing policy with external users. Might be + // missing due to historical data gap. + PublicSharingPolicy string `json:"public_sharing_policy,omitempty"` + // TeamSharingPolicy : Sharing policy with team. Might be missing due to + // historical data gap. + TeamSharingPolicy string `json:"team_sharing_policy,omitempty"` +} + +// NewPaperDocChangeSharingPolicyDetails returns a new PaperDocChangeSharingPolicyDetails instance +func NewPaperDocChangeSharingPolicyDetails(EventUuid string) *PaperDocChangeSharingPolicyDetails { + s := new(PaperDocChangeSharingPolicyDetails) + s.EventUuid = EventUuid + return s +} + +// PaperDocDeleteCommentDetails : Deleted a Paper doc comment. +type PaperDocDeleteCommentDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` + // CommentText : Comment text. Might be missing due to historical data gap. + CommentText string `json:"comment_text,omitempty"` +} + +// NewPaperDocDeleteCommentDetails returns a new PaperDocDeleteCommentDetails instance +func NewPaperDocDeleteCommentDetails(EventUuid string) *PaperDocDeleteCommentDetails { + s := new(PaperDocDeleteCommentDetails) + s.EventUuid = EventUuid + return s +} + +// PaperDocDeletedDetails : Paper doc archived. +type PaperDocDeletedDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` +} + +// NewPaperDocDeletedDetails returns a new PaperDocDeletedDetails instance +func NewPaperDocDeletedDetails(EventUuid string) *PaperDocDeletedDetails { + s := new(PaperDocDeletedDetails) + s.EventUuid = EventUuid + return s +} + +// PaperDocDownloadDetails : Downloaded a Paper doc in a particular output +// format. +type PaperDocDownloadDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` + // ExportFileFormat : Export file format. + ExportFileFormat *PaperDownloadFormat `json:"export_file_format"` +} + +// NewPaperDocDownloadDetails returns a new PaperDocDownloadDetails instance +func NewPaperDocDownloadDetails(EventUuid string, ExportFileFormat *PaperDownloadFormat) *PaperDocDownloadDetails { + s := new(PaperDocDownloadDetails) + s.EventUuid = EventUuid + s.ExportFileFormat = ExportFileFormat + return s +} + +// PaperDocEditCommentDetails : Edited a Paper doc comment. +type PaperDocEditCommentDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` + // CommentText : Comment text. Might be missing due to historical data gap. + CommentText string `json:"comment_text,omitempty"` +} + +// NewPaperDocEditCommentDetails returns a new PaperDocEditCommentDetails instance +func NewPaperDocEditCommentDetails(EventUuid string) *PaperDocEditCommentDetails { + s := new(PaperDocEditCommentDetails) + s.EventUuid = EventUuid + return s +} + +// PaperDocEditDetails : Edited a Paper doc. +type PaperDocEditDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` +} + +// NewPaperDocEditDetails returns a new PaperDocEditDetails instance +func NewPaperDocEditDetails(EventUuid string) *PaperDocEditDetails { + s := new(PaperDocEditDetails) + s.EventUuid = EventUuid + return s +} + +// PaperDocFollowedDetails : Followed a Paper doc. +type PaperDocFollowedDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` +} + +// NewPaperDocFollowedDetails returns a new PaperDocFollowedDetails instance +func NewPaperDocFollowedDetails(EventUuid string) *PaperDocFollowedDetails { + s := new(PaperDocFollowedDetails) + s.EventUuid = EventUuid + return s +} + +// PaperDocMentionDetails : Mentioned a member in a Paper doc. +type PaperDocMentionDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` +} + +// NewPaperDocMentionDetails returns a new PaperDocMentionDetails instance +func NewPaperDocMentionDetails(EventUuid string) *PaperDocMentionDetails { + s := new(PaperDocMentionDetails) + s.EventUuid = EventUuid + return s +} + +// PaperDocRequestAccessDetails : Requested to be a member on a Paper doc. +type PaperDocRequestAccessDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` +} + +// NewPaperDocRequestAccessDetails returns a new PaperDocRequestAccessDetails instance +func NewPaperDocRequestAccessDetails(EventUuid string) *PaperDocRequestAccessDetails { + s := new(PaperDocRequestAccessDetails) + s.EventUuid = EventUuid + return s +} + +// PaperDocResolveCommentDetails : Paper doc comment resolved. +type PaperDocResolveCommentDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` + // CommentText : Comment text. Might be missing due to historical data gap. + CommentText string `json:"comment_text,omitempty"` +} + +// NewPaperDocResolveCommentDetails returns a new PaperDocResolveCommentDetails instance +func NewPaperDocResolveCommentDetails(EventUuid string) *PaperDocResolveCommentDetails { + s := new(PaperDocResolveCommentDetails) + s.EventUuid = EventUuid + return s +} + +// PaperDocRevertDetails : Restored a Paper doc to previous revision. +type PaperDocRevertDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` +} + +// NewPaperDocRevertDetails returns a new PaperDocRevertDetails instance +func NewPaperDocRevertDetails(EventUuid string) *PaperDocRevertDetails { + s := new(PaperDocRevertDetails) + s.EventUuid = EventUuid + return s +} + +// PaperDocSlackShareDetails : Paper doc link shared via slack. +type PaperDocSlackShareDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` +} + +// NewPaperDocSlackShareDetails returns a new PaperDocSlackShareDetails instance +func NewPaperDocSlackShareDetails(EventUuid string) *PaperDocSlackShareDetails { + s := new(PaperDocSlackShareDetails) + s.EventUuid = EventUuid + return s +} + +// PaperDocTeamInviteDetails : Paper doc shared with team member. +type PaperDocTeamInviteDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` +} + +// NewPaperDocTeamInviteDetails returns a new PaperDocTeamInviteDetails instance +func NewPaperDocTeamInviteDetails(EventUuid string) *PaperDocTeamInviteDetails { + s := new(PaperDocTeamInviteDetails) + s.EventUuid = EventUuid + return s +} + +// PaperDocUnresolveCommentDetails : Unresolved a Paper doc comment. +type PaperDocUnresolveCommentDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` + // CommentText : Comment text. Might be missing due to historical data gap. + CommentText string `json:"comment_text,omitempty"` +} + +// NewPaperDocUnresolveCommentDetails returns a new PaperDocUnresolveCommentDetails instance +func NewPaperDocUnresolveCommentDetails(EventUuid string) *PaperDocUnresolveCommentDetails { + s := new(PaperDocUnresolveCommentDetails) + s.EventUuid = EventUuid + return s +} + +// PaperDocViewDetails : Viewed Paper doc. +type PaperDocViewDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` +} + +// NewPaperDocViewDetails returns a new PaperDocViewDetails instance +func NewPaperDocViewDetails(EventUuid string) *PaperDocViewDetails { + s := new(PaperDocViewDetails) + s.EventUuid = EventUuid + return s +} + +// PaperDocumentLogInfo : Paper document's logged information. +type PaperDocumentLogInfo struct { + // DocId : Papers document Id. + DocId string `json:"doc_id"` + // DocTitle : Paper document title. + DocTitle string `json:"doc_title"` +} + +// NewPaperDocumentLogInfo returns a new PaperDocumentLogInfo instance +func NewPaperDocumentLogInfo(DocId string, DocTitle string) *PaperDocumentLogInfo { + s := new(PaperDocumentLogInfo) + s.DocId = DocId + s.DocTitle = DocTitle + return s +} + +// PaperDownloadFormat : has no documentation (yet) +type PaperDownloadFormat struct { + dropbox.Tagged +} + +// Valid tag values for PaperDownloadFormat +const ( + PaperDownloadFormatDocx = "docx" + PaperDownloadFormatHtml = "html" + PaperDownloadFormatMarkdown = "markdown" + PaperDownloadFormatOther = "other" +) + +// PaperEnabledUsersGroupAdditionDetails : Users added to Paper enabled users +// list. +type PaperEnabledUsersGroupAdditionDetails struct { +} + +// NewPaperEnabledUsersGroupAdditionDetails returns a new PaperEnabledUsersGroupAdditionDetails instance +func NewPaperEnabledUsersGroupAdditionDetails() *PaperEnabledUsersGroupAdditionDetails { + s := new(PaperEnabledUsersGroupAdditionDetails) + return s +} + +// PaperEnabledUsersGroupRemovalDetails : Users removed from Paper enabled users +// list. +type PaperEnabledUsersGroupRemovalDetails struct { +} + +// NewPaperEnabledUsersGroupRemovalDetails returns a new PaperEnabledUsersGroupRemovalDetails instance +func NewPaperEnabledUsersGroupRemovalDetails() *PaperEnabledUsersGroupRemovalDetails { + s := new(PaperEnabledUsersGroupRemovalDetails) + return s +} + +// PaperExternalViewAllowDetails : Paper external sharing policy changed: +// anyone. +type PaperExternalViewAllowDetails struct { +} + +// NewPaperExternalViewAllowDetails returns a new PaperExternalViewAllowDetails instance +func NewPaperExternalViewAllowDetails() *PaperExternalViewAllowDetails { + s := new(PaperExternalViewAllowDetails) + return s +} + +// PaperExternalViewDefaultTeamDetails : Paper external sharing policy changed: +// default team. +type PaperExternalViewDefaultTeamDetails struct { +} + +// NewPaperExternalViewDefaultTeamDetails returns a new PaperExternalViewDefaultTeamDetails instance +func NewPaperExternalViewDefaultTeamDetails() *PaperExternalViewDefaultTeamDetails { + s := new(PaperExternalViewDefaultTeamDetails) + return s +} + +// PaperExternalViewForbidDetails : Paper external sharing policy changed: +// team-only. +type PaperExternalViewForbidDetails struct { +} + +// NewPaperExternalViewForbidDetails returns a new PaperExternalViewForbidDetails instance +func NewPaperExternalViewForbidDetails() *PaperExternalViewForbidDetails { + s := new(PaperExternalViewForbidDetails) + return s +} + +// PaperFolderDeletedDetails : Paper folder archived. +type PaperFolderDeletedDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` +} + +// NewPaperFolderDeletedDetails returns a new PaperFolderDeletedDetails instance +func NewPaperFolderDeletedDetails(EventUuid string) *PaperFolderDeletedDetails { + s := new(PaperFolderDeletedDetails) + s.EventUuid = EventUuid + return s +} + +// PaperFolderFollowedDetails : Followed a Paper folder. +type PaperFolderFollowedDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` +} + +// NewPaperFolderFollowedDetails returns a new PaperFolderFollowedDetails instance +func NewPaperFolderFollowedDetails(EventUuid string) *PaperFolderFollowedDetails { + s := new(PaperFolderFollowedDetails) + s.EventUuid = EventUuid + return s +} + +// PaperFolderLogInfo : Paper folder's logged information. +type PaperFolderLogInfo struct { + // FolderId : Papers folder Id. + FolderId string `json:"folder_id"` + // FolderName : Paper folder name. + FolderName string `json:"folder_name"` +} + +// NewPaperFolderLogInfo returns a new PaperFolderLogInfo instance +func NewPaperFolderLogInfo(FolderId string, FolderName string) *PaperFolderLogInfo { + s := new(PaperFolderLogInfo) + s.FolderId = FolderId + s.FolderName = FolderName + return s +} + +// PaperFolderTeamInviteDetails : Paper folder shared with team member. +type PaperFolderTeamInviteDetails struct { + // EventUuid : Event unique identifier. + EventUuid string `json:"event_uuid"` +} + +// NewPaperFolderTeamInviteDetails returns a new PaperFolderTeamInviteDetails instance +func NewPaperFolderTeamInviteDetails(EventUuid string) *PaperFolderTeamInviteDetails { + s := new(PaperFolderTeamInviteDetails) + s.EventUuid = EventUuid + return s +} + +// PaperMemberPolicy : Policy for controlling if team members can share Paper +// documents externally. +type PaperMemberPolicy struct { + dropbox.Tagged +} + +// Valid tag values for PaperMemberPolicy +const ( + PaperMemberPolicyTeamOnly = "team_only" + PaperMemberPolicyDefaultTeamOnly = "default_team_only" + PaperMemberPolicyDefaultAnyone = "default_anyone" + PaperMemberPolicyOther = "other" +) + +// PaperPolicy : Policy for enabling or disabling Dropbox Paper for the team. +type PaperPolicy struct { + dropbox.Tagged +} + +// Valid tag values for PaperPolicy +const ( + PaperPolicyDisabled = "disabled" + PaperPolicyEnabled = "enabled" + PaperPolicyOther = "other" +) + +// PaperTaggedValue : Paper tagged value. +type PaperTaggedValue struct { + // Tag : Tag. + Tag string `json:"tag"` +} + +// NewPaperTaggedValue returns a new PaperTaggedValue instance +func NewPaperTaggedValue(Tag string) *PaperTaggedValue { + s := new(PaperTaggedValue) + s.Tag = Tag + return s +} + +// ParticipantLogInfo : A user or group +type ParticipantLogInfo struct { + dropbox.Tagged + // User : User details. + User IsUserLogInfo `json:"user,omitempty"` + // Group : Group details. + Group *GroupLogInfo `json:"group,omitempty"` +} + +// Valid tag values for ParticipantLogInfo +const ( + ParticipantLogInfoUser = "user" + ParticipantLogInfoGroup = "group" + ParticipantLogInfoOther = "other" +) + +// UnmarshalJSON deserializes into a ParticipantLogInfo instance +func (u *ParticipantLogInfo) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // User : User details. + User json.RawMessage `json:"user,omitempty"` + // Group : Group details. + Group json.RawMessage `json:"group,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 "user": + u.User, err = IsUserLogInfoFromJSON(body) + + if err != nil { + return err + } + case "group": + err = json.Unmarshal(body, &u.Group) + + if err != nil { + return err + } + } + return nil +} + +// PasswordChangeDetails : Changed password. +type PasswordChangeDetails struct { +} + +// NewPasswordChangeDetails returns a new PasswordChangeDetails instance +func NewPasswordChangeDetails() *PasswordChangeDetails { + s := new(PasswordChangeDetails) + return s +} + +// PasswordLoginFailDetails : Failed to sign in using a password. +type PasswordLoginFailDetails struct { + // ErrorDetails : Login failure details. + ErrorDetails *FailureDetailsLogInfo `json:"error_details"` +} + +// NewPasswordLoginFailDetails returns a new PasswordLoginFailDetails instance +func NewPasswordLoginFailDetails(ErrorDetails *FailureDetailsLogInfo) *PasswordLoginFailDetails { + s := new(PasswordLoginFailDetails) + s.ErrorDetails = ErrorDetails + return s +} + +// PasswordLoginSuccessDetails : Signed in using a password. +type PasswordLoginSuccessDetails struct { +} + +// NewPasswordLoginSuccessDetails returns a new PasswordLoginSuccessDetails instance +func NewPasswordLoginSuccessDetails() *PasswordLoginSuccessDetails { + s := new(PasswordLoginSuccessDetails) + return s +} + +// PasswordResetAllDetails : Reset all team member passwords. +type PasswordResetAllDetails struct { +} + +// NewPasswordResetAllDetails returns a new PasswordResetAllDetails instance +func NewPasswordResetAllDetails() *PasswordResetAllDetails { + s := new(PasswordResetAllDetails) + return s +} + +// PasswordResetDetails : Reset password. +type PasswordResetDetails struct { +} + +// NewPasswordResetDetails returns a new PasswordResetDetails instance +func NewPasswordResetDetails() *PasswordResetDetails { + s := new(PasswordResetDetails) + return s +} + +// PathLogInfo : Path's details. +type PathLogInfo struct { + // Contextual : Fully qualified path relative to event's context. Might be + // missing due to historical data gap. + Contextual string `json:"contextual,omitempty"` + // NamespaceRelative : Path relative to the namespace containing the + // content. + NamespaceRelative *NamespaceRelativePathLogInfo `json:"namespace_relative"` +} + +// NewPathLogInfo returns a new PathLogInfo instance +func NewPathLogInfo(NamespaceRelative *NamespaceRelativePathLogInfo) *PathLogInfo { + s := new(PathLogInfo) + s.NamespaceRelative = NamespaceRelative + return s +} + +// PermanentDeleteChangePolicyDetails : Enabled or disabled the ability of team +// members to permanently delete content. +type PermanentDeleteChangePolicyDetails struct { + // NewValue : New permanent delete content policy. + NewValue *ContentPermanentDeletePolicy `json:"new_value"` + // PreviousValue : Previous permanent delete content policy. Might be + // missing due to historical data gap. + PreviousValue *ContentPermanentDeletePolicy `json:"previous_value,omitempty"` +} + +// NewPermanentDeleteChangePolicyDetails returns a new PermanentDeleteChangePolicyDetails instance +func NewPermanentDeleteChangePolicyDetails(NewValue *ContentPermanentDeletePolicy) *PermanentDeleteChangePolicyDetails { + s := new(PermanentDeleteChangePolicyDetails) + s.NewValue = NewValue + return s +} + +// PlacementRestriction : has no documentation (yet) +type PlacementRestriction struct { + dropbox.Tagged +} + +// Valid tag values for PlacementRestriction +const ( + PlacementRestrictionEuropeOnly = "europe_only" + PlacementRestrictionNone = "none" + PlacementRestrictionOther = "other" +) + +// RelocateAssetReferencesLogInfo : Provides the indices of the source asset and +// the destination asset for a relocate action. +type RelocateAssetReferencesLogInfo struct { + // SrcIndex : Source asset index. + SrcIndex int64 `json:"src_index"` + // DestIndex : Destination asset index. + DestIndex int64 `json:"dest_index"` +} + +// NewRelocateAssetReferencesLogInfo returns a new RelocateAssetReferencesLogInfo instance +func NewRelocateAssetReferencesLogInfo(SrcIndex int64, DestIndex int64) *RelocateAssetReferencesLogInfo { + s := new(RelocateAssetReferencesLogInfo) + s.SrcIndex = SrcIndex + s.DestIndex = DestIndex + return s +} + +// RemoveLogoutUrlDetails : Removed single sign-on logout URL. +type RemoveLogoutUrlDetails struct { + // PreviousValue : Previous single sign-on logout URL. + PreviousValue string `json:"previous_value"` + // NewValue : New single sign-on logout URL. Might be missing due to + // historical data gap. + NewValue string `json:"new_value,omitempty"` +} + +// NewRemoveLogoutUrlDetails returns a new RemoveLogoutUrlDetails instance +func NewRemoveLogoutUrlDetails(PreviousValue string) *RemoveLogoutUrlDetails { + s := new(RemoveLogoutUrlDetails) + s.PreviousValue = PreviousValue + return s +} + +// RemoveSsoUrlDetails : Changed the sign-out URL for SSO. +type RemoveSsoUrlDetails struct { + // PreviousValue : Previous single sign-on logout URL. + PreviousValue string `json:"previous_value"` +} + +// NewRemoveSsoUrlDetails returns a new RemoveSsoUrlDetails instance +func NewRemoveSsoUrlDetails(PreviousValue string) *RemoveSsoUrlDetails { + s := new(RemoveSsoUrlDetails) + s.PreviousValue = PreviousValue + return s +} + +// ResellerLogInfo : Reseller information. +type ResellerLogInfo struct { + // ResellerName : Reseller name. + ResellerName string `json:"reseller_name"` + // ResellerId : Reseller ID. + ResellerId string `json:"reseller_id"` +} + +// NewResellerLogInfo returns a new ResellerLogInfo instance +func NewResellerLogInfo(ResellerName string, ResellerId string) *ResellerLogInfo { + s := new(ResellerLogInfo) + s.ResellerName = ResellerName + s.ResellerId = ResellerId + return s +} + +// ResellerSupportSessionEndDetails : Ended reseller support session. +type ResellerSupportSessionEndDetails struct { +} + +// NewResellerSupportSessionEndDetails returns a new ResellerSupportSessionEndDetails instance +func NewResellerSupportSessionEndDetails() *ResellerSupportSessionEndDetails { + s := new(ResellerSupportSessionEndDetails) + return s +} + +// ResellerSupportSessionStartDetails : Started reseller support session. +type ResellerSupportSessionStartDetails struct { +} + +// NewResellerSupportSessionStartDetails returns a new ResellerSupportSessionStartDetails instance +func NewResellerSupportSessionStartDetails() *ResellerSupportSessionStartDetails { + s := new(ResellerSupportSessionStartDetails) + return s +} + +// SfAddGroupDetails : Added the team to a shared folder. +type SfAddGroupDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name"` + // SharingPermission : Sharing permission. Might be missing due to + // historical data gap. + SharingPermission string `json:"sharing_permission,omitempty"` + // TeamName : Team name. + TeamName string `json:"team_name"` +} + +// NewSfAddGroupDetails returns a new SfAddGroupDetails instance +func NewSfAddGroupDetails(TargetIndex int64, OriginalFolderName string, TeamName string) *SfAddGroupDetails { + s := new(SfAddGroupDetails) + s.TargetIndex = TargetIndex + s.OriginalFolderName = OriginalFolderName + s.TeamName = TeamName + return s +} + +// SfAllowNonMembersToViewSharedLinksDetails : Allowed non collaborators to view +// links to files in a shared folder. +type SfAllowNonMembersToViewSharedLinksDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name"` + // SharedFolderType : Shared folder type. Might be missing due to historical + // data gap. + SharedFolderType string `json:"shared_folder_type,omitempty"` +} + +// NewSfAllowNonMembersToViewSharedLinksDetails returns a new SfAllowNonMembersToViewSharedLinksDetails instance +func NewSfAllowNonMembersToViewSharedLinksDetails(TargetIndex int64, OriginalFolderName string) *SfAllowNonMembersToViewSharedLinksDetails { + s := new(SfAllowNonMembersToViewSharedLinksDetails) + s.TargetIndex = TargetIndex + s.OriginalFolderName = OriginalFolderName + return s +} + +// SfExternalInviteWarnDetails : Admin settings: team members see a warning +// before sharing folders outside the team (DEPRECATED FEATURE). +type SfExternalInviteWarnDetails struct { +} + +// NewSfExternalInviteWarnDetails returns a new SfExternalInviteWarnDetails instance +func NewSfExternalInviteWarnDetails() *SfExternalInviteWarnDetails { + s := new(SfExternalInviteWarnDetails) + return s +} + +// SfInviteGroupDetails : Invited a group to a shared folder. +type SfInviteGroupDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` +} + +// NewSfInviteGroupDetails returns a new SfInviteGroupDetails instance +func NewSfInviteGroupDetails(TargetIndex int64) *SfInviteGroupDetails { + s := new(SfInviteGroupDetails) + s.TargetIndex = TargetIndex + return s +} + +// SfNestDetails : Changed parent of shared folder. +type SfNestDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name"` + // PrevParentNsId : Previous parent namespace ID. Might be missing due to + // historical data gap. + PrevParentNsId string `json:"prev_parent_ns_id,omitempty"` + // NewParentNsId : New parent namespace ID. Might be missing due to + // historical data gap. + NewParentNsId string `json:"new_parent_ns_id,omitempty"` +} + +// NewSfNestDetails returns a new SfNestDetails instance +func NewSfNestDetails(TargetIndex int64, OriginalFolderName string) *SfNestDetails { + s := new(SfNestDetails) + s.TargetIndex = TargetIndex + s.OriginalFolderName = OriginalFolderName + return s +} + +// SfTeamDeclineDetails : Declined a team member's invitation to a shared +// folder. +type SfTeamDeclineDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name"` +} + +// NewSfTeamDeclineDetails returns a new SfTeamDeclineDetails instance +func NewSfTeamDeclineDetails(TargetIndex int64, OriginalFolderName string) *SfTeamDeclineDetails { + s := new(SfTeamDeclineDetails) + s.TargetIndex = TargetIndex + s.OriginalFolderName = OriginalFolderName + return s +} + +// SfTeamGrantAccessDetails : Granted access to a shared folder. +type SfTeamGrantAccessDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name"` +} + +// NewSfTeamGrantAccessDetails returns a new SfTeamGrantAccessDetails instance +func NewSfTeamGrantAccessDetails(TargetIndex int64, OriginalFolderName string) *SfTeamGrantAccessDetails { + s := new(SfTeamGrantAccessDetails) + s.TargetIndex = TargetIndex + s.OriginalFolderName = OriginalFolderName + return s +} + +// SfTeamInviteChangeRoleDetails : Changed a team member's role in a shared +// folder. +type SfTeamInviteChangeRoleDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name"` + // NewSharingPermission : New sharing permission. Might be missing due to + // historical data gap. + NewSharingPermission string `json:"new_sharing_permission,omitempty"` + // PreviousSharingPermission : Previous sharing permission. Might be missing + // due to historical data gap. + PreviousSharingPermission string `json:"previous_sharing_permission,omitempty"` +} + +// NewSfTeamInviteChangeRoleDetails returns a new SfTeamInviteChangeRoleDetails instance +func NewSfTeamInviteChangeRoleDetails(TargetIndex int64, OriginalFolderName string) *SfTeamInviteChangeRoleDetails { + s := new(SfTeamInviteChangeRoleDetails) + s.TargetIndex = TargetIndex + s.OriginalFolderName = OriginalFolderName + return s +} + +// SfTeamInviteDetails : Invited team members to a shared folder. +type SfTeamInviteDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name"` + // SharingPermission : Sharing permission. Might be missing due to + // historical data gap. + SharingPermission string `json:"sharing_permission,omitempty"` +} + +// NewSfTeamInviteDetails returns a new SfTeamInviteDetails instance +func NewSfTeamInviteDetails(TargetIndex int64, OriginalFolderName string) *SfTeamInviteDetails { + s := new(SfTeamInviteDetails) + s.TargetIndex = TargetIndex + s.OriginalFolderName = OriginalFolderName + return s +} + +// SfTeamJoinDetails : Joined a team member's shared folder. +type SfTeamJoinDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name"` +} + +// NewSfTeamJoinDetails returns a new SfTeamJoinDetails instance +func NewSfTeamJoinDetails(TargetIndex int64, OriginalFolderName string) *SfTeamJoinDetails { + s := new(SfTeamJoinDetails) + s.TargetIndex = TargetIndex + s.OriginalFolderName = OriginalFolderName + return s +} + +// SfTeamJoinFromOobLinkDetails : Joined a team member's shared folder from a +// link. +type SfTeamJoinFromOobLinkDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name"` + // TokenKey : Shared link token key. + TokenKey string `json:"token_key,omitempty"` + // SharingPermission : Sharing permission. Might be missing due to + // historical data gap. + SharingPermission string `json:"sharing_permission,omitempty"` +} + +// NewSfTeamJoinFromOobLinkDetails returns a new SfTeamJoinFromOobLinkDetails instance +func NewSfTeamJoinFromOobLinkDetails(TargetIndex int64, OriginalFolderName string) *SfTeamJoinFromOobLinkDetails { + s := new(SfTeamJoinFromOobLinkDetails) + s.TargetIndex = TargetIndex + s.OriginalFolderName = OriginalFolderName + return s +} + +// SfTeamUninviteDetails : Unshared a folder with a team member. +type SfTeamUninviteDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name"` +} + +// NewSfTeamUninviteDetails returns a new SfTeamUninviteDetails instance +func NewSfTeamUninviteDetails(TargetIndex int64, OriginalFolderName string) *SfTeamUninviteDetails { + s := new(SfTeamUninviteDetails) + s.TargetIndex = TargetIndex + s.OriginalFolderName = OriginalFolderName + return s +} + +// SharedContentAddInviteesDetails : Sent an email invitation to the membership +// of a shared file or folder. +type SharedContentAddInviteesDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name,omitempty"` + // SharingPermission : Sharing permission. Might be missing due to + // historical data gap. + SharingPermission string `json:"sharing_permission,omitempty"` +} + +// NewSharedContentAddInviteesDetails returns a new SharedContentAddInviteesDetails instance +func NewSharedContentAddInviteesDetails(TargetIndex int64) *SharedContentAddInviteesDetails { + s := new(SharedContentAddInviteesDetails) + s.TargetIndex = TargetIndex + return s +} + +// SharedContentAddLinkExpiryDetails : Added an expiry to the link for the +// shared file or folder. +type SharedContentAddLinkExpiryDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name,omitempty"` + // SharedFolderType : Shared folder type. Might be missing due to historical + // data gap. + SharedFolderType string `json:"shared_folder_type,omitempty"` + // ExpirationStartDate : Expiration starting date. + ExpirationStartDate string `json:"expiration_start_date"` + // ExpirationDays : The number of days from the starting expiration date + // after which the link will expire. + ExpirationDays int64 `json:"expiration_days"` +} + +// NewSharedContentAddLinkExpiryDetails returns a new SharedContentAddLinkExpiryDetails instance +func NewSharedContentAddLinkExpiryDetails(TargetIndex int64, ExpirationStartDate string, ExpirationDays int64) *SharedContentAddLinkExpiryDetails { + s := new(SharedContentAddLinkExpiryDetails) + s.TargetIndex = TargetIndex + s.ExpirationStartDate = ExpirationStartDate + s.ExpirationDays = ExpirationDays + return s +} + +// SharedContentAddLinkPasswordDetails : Added a password to the link for the +// shared file or folder. +type SharedContentAddLinkPasswordDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name,omitempty"` + // SharedFolderType : Shared folder type. Might be missing due to historical + // data gap. + SharedFolderType string `json:"shared_folder_type,omitempty"` +} + +// NewSharedContentAddLinkPasswordDetails returns a new SharedContentAddLinkPasswordDetails instance +func NewSharedContentAddLinkPasswordDetails(TargetIndex int64) *SharedContentAddLinkPasswordDetails { + s := new(SharedContentAddLinkPasswordDetails) + s.TargetIndex = TargetIndex + return s +} + +// SharedContentAddMemberDetails : Added users and/or groups to the membership +// of a shared file or folder. +type SharedContentAddMemberDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name,omitempty"` + // SharingPermission : Sharing permission. Might be missing due to + // historical data gap. + SharingPermission string `json:"sharing_permission,omitempty"` + // SharedFolderType : Shared folder type. Might be missing due to historical + // data gap. + SharedFolderType string `json:"shared_folder_type,omitempty"` +} + +// NewSharedContentAddMemberDetails returns a new SharedContentAddMemberDetails instance +func NewSharedContentAddMemberDetails(TargetIndex int64) *SharedContentAddMemberDetails { + s := new(SharedContentAddMemberDetails) + s.TargetIndex = TargetIndex + return s +} + +// SharedContentChangeDownloadsPolicyDetails : Changed whether members can +// download the shared file or folder. +type SharedContentChangeDownloadsPolicyDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name,omitempty"` + // SharedFolderType : Shared folder type. Might be missing due to historical + // data gap. + SharedFolderType string `json:"shared_folder_type,omitempty"` + // NewValue : New downlaod policy. + NewValue *SharedContentDownloadsPolicy `json:"new_value"` + // PreviousValue : Previous downlaod policy. Might be missing due to + // historical data gap. + PreviousValue *SharedContentDownloadsPolicy `json:"previous_value,omitempty"` +} + +// NewSharedContentChangeDownloadsPolicyDetails returns a new SharedContentChangeDownloadsPolicyDetails instance +func NewSharedContentChangeDownloadsPolicyDetails(TargetIndex int64, NewValue *SharedContentDownloadsPolicy) *SharedContentChangeDownloadsPolicyDetails { + s := new(SharedContentChangeDownloadsPolicyDetails) + s.TargetIndex = TargetIndex + s.NewValue = NewValue + return s +} + +// SharedContentChangeInviteeRoleDetails : Changed the access type of an invitee +// to a shared file or folder before the invitation was claimed. +type SharedContentChangeInviteeRoleDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name"` + // NewSharingPermission : New sharing permission. Might be missing due to + // historical data gap. + NewSharingPermission string `json:"new_sharing_permission,omitempty"` + // PreviousSharingPermission : Previous sharing permission. Might be missing + // due to historical data gap. + PreviousSharingPermission string `json:"previous_sharing_permission,omitempty"` +} + +// NewSharedContentChangeInviteeRoleDetails returns a new SharedContentChangeInviteeRoleDetails instance +func NewSharedContentChangeInviteeRoleDetails(TargetIndex int64, OriginalFolderName string) *SharedContentChangeInviteeRoleDetails { + s := new(SharedContentChangeInviteeRoleDetails) + s.TargetIndex = TargetIndex + s.OriginalFolderName = OriginalFolderName + return s +} + +// SharedContentChangeLinkAudienceDetails : Changed the audience of the link for +// a shared file or folder. +type SharedContentChangeLinkAudienceDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name,omitempty"` + // SharedFolderType : Shared folder type. Might be missing due to historical + // data gap. + SharedFolderType string `json:"shared_folder_type,omitempty"` + // NewValue : New link audience value. + NewValue *LinkAudience `json:"new_value"` + // PreviousValue : Previous link audience value. Might be missing due to + // historical data gap. + PreviousValue *LinkAudience `json:"previous_value,omitempty"` +} + +// NewSharedContentChangeLinkAudienceDetails returns a new SharedContentChangeLinkAudienceDetails instance +func NewSharedContentChangeLinkAudienceDetails(TargetIndex int64, NewValue *LinkAudience) *SharedContentChangeLinkAudienceDetails { + s := new(SharedContentChangeLinkAudienceDetails) + s.TargetIndex = TargetIndex + s.NewValue = NewValue + return s +} + +// SharedContentChangeLinkExpiryDetails : Changed the expiry of the link for the +// shared file or folder. +type SharedContentChangeLinkExpiryDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name,omitempty"` + // SharedFolderType : Shared folder type. Might be missing due to historical + // data gap. + SharedFolderType string `json:"shared_folder_type,omitempty"` + // ExpirationStartDate : Expiration starting date. + ExpirationStartDate string `json:"expiration_start_date"` + // ExpirationDays : The number of days from the starting expiration date + // after which the link will expire. + ExpirationDays int64 `json:"expiration_days"` +} + +// NewSharedContentChangeLinkExpiryDetails returns a new SharedContentChangeLinkExpiryDetails instance +func NewSharedContentChangeLinkExpiryDetails(TargetIndex int64, ExpirationStartDate string, ExpirationDays int64) *SharedContentChangeLinkExpiryDetails { + s := new(SharedContentChangeLinkExpiryDetails) + s.TargetIndex = TargetIndex + s.ExpirationStartDate = ExpirationStartDate + s.ExpirationDays = ExpirationDays + return s +} + +// SharedContentChangeLinkPasswordDetails : Changed the password on the link for +// the shared file or folder. +type SharedContentChangeLinkPasswordDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name,omitempty"` + // SharedFolderType : Shared folder type. Might be missing due to historical + // data gap. + SharedFolderType string `json:"shared_folder_type,omitempty"` +} + +// NewSharedContentChangeLinkPasswordDetails returns a new SharedContentChangeLinkPasswordDetails instance +func NewSharedContentChangeLinkPasswordDetails(TargetIndex int64) *SharedContentChangeLinkPasswordDetails { + s := new(SharedContentChangeLinkPasswordDetails) + s.TargetIndex = TargetIndex + return s +} + +// SharedContentChangeMemberRoleDetails : Changed the access type of a shared +// file or folder member. +type SharedContentChangeMemberRoleDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name,omitempty"` + // NewSharingPermission : New sharing permission. Might be missing due to + // historical data gap. + NewSharingPermission string `json:"new_sharing_permission,omitempty"` + // PreviousSharingPermission : Previous sharing permission. Might be missing + // due to historical data gap. + PreviousSharingPermission string `json:"previous_sharing_permission,omitempty"` + // SharedFolderType : Shared folder type. Might be missing due to historical + // data gap. + SharedFolderType string `json:"shared_folder_type,omitempty"` +} + +// NewSharedContentChangeMemberRoleDetails returns a new SharedContentChangeMemberRoleDetails instance +func NewSharedContentChangeMemberRoleDetails(TargetIndex int64) *SharedContentChangeMemberRoleDetails { + s := new(SharedContentChangeMemberRoleDetails) + s.TargetIndex = TargetIndex + return s +} + +// SharedContentChangeViewerInfoPolicyDetails : Changed whether members can see +// who viewed the shared file or folder. +type SharedContentChangeViewerInfoPolicyDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name,omitempty"` + // SharedFolderType : Shared folder type. Might be missing due to historical + // data gap. + SharedFolderType string `json:"shared_folder_type,omitempty"` + // NewValue : New viewer info policy. + NewValue *SharedContentViewerInfoPolicy `json:"new_value"` + // PreviousValue : Previous view info policy. Might be missing due to + // historical data gap. + PreviousValue *SharedContentViewerInfoPolicy `json:"previous_value,omitempty"` +} + +// NewSharedContentChangeViewerInfoPolicyDetails returns a new SharedContentChangeViewerInfoPolicyDetails instance +func NewSharedContentChangeViewerInfoPolicyDetails(TargetIndex int64, NewValue *SharedContentViewerInfoPolicy) *SharedContentChangeViewerInfoPolicyDetails { + s := new(SharedContentChangeViewerInfoPolicyDetails) + s.TargetIndex = TargetIndex + s.NewValue = NewValue + return s +} + +// SharedContentClaimInvitationDetails : Claimed membership to a team member's +// shared folder. +type SharedContentClaimInvitationDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name,omitempty"` + // SharedContentLink : Shared content link. + SharedContentLink string `json:"shared_content_link,omitempty"` +} + +// NewSharedContentClaimInvitationDetails returns a new SharedContentClaimInvitationDetails instance +func NewSharedContentClaimInvitationDetails(TargetIndex int64) *SharedContentClaimInvitationDetails { + s := new(SharedContentClaimInvitationDetails) + s.TargetIndex = TargetIndex + return s +} + +// SharedContentCopyDetails : Copied the shared file or folder to own Dropbox. +type SharedContentCopyDetails struct { + // SharedContentLink : Shared content link. + SharedContentLink string `json:"shared_content_link"` + // SharingPermission : Sharing permission. Might be missing due to + // historical data gap. + SharingPermission string `json:"sharing_permission,omitempty"` + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // RelocateActionDetails : Specifies the source and destination indices in + // the assets list. + RelocateActionDetails *RelocateAssetReferencesLogInfo `json:"relocate_action_details"` +} + +// NewSharedContentCopyDetails returns a new SharedContentCopyDetails instance +func NewSharedContentCopyDetails(SharedContentLink string, TargetIndex int64, RelocateActionDetails *RelocateAssetReferencesLogInfo) *SharedContentCopyDetails { + s := new(SharedContentCopyDetails) + s.SharedContentLink = SharedContentLink + s.TargetIndex = TargetIndex + s.RelocateActionDetails = RelocateActionDetails + return s +} + +// SharedContentDownloadDetails : Downloaded the shared file or folder. +type SharedContentDownloadDetails struct { + // SharedContentLink : Shared content link. + SharedContentLink string `json:"shared_content_link"` + // SharingPermission : Sharing permission. Might be missing due to + // historical data gap. + SharingPermission string `json:"sharing_permission,omitempty"` + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` +} + +// NewSharedContentDownloadDetails returns a new SharedContentDownloadDetails instance +func NewSharedContentDownloadDetails(SharedContentLink string, TargetIndex int64) *SharedContentDownloadDetails { + s := new(SharedContentDownloadDetails) + s.SharedContentLink = SharedContentLink + s.TargetIndex = TargetIndex + return s +} + +// SharedContentDownloadsPolicy : Shared content downloads policy +type SharedContentDownloadsPolicy struct { + dropbox.Tagged +} + +// Valid tag values for SharedContentDownloadsPolicy +const ( + SharedContentDownloadsPolicyDisabled = "disabled" + SharedContentDownloadsPolicyEnabled = "enabled" + SharedContentDownloadsPolicyOther = "other" +) + +// SharedContentRelinquishMembershipDetails : Left the membership of a shared +// file or folder. +type SharedContentRelinquishMembershipDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name"` +} + +// NewSharedContentRelinquishMembershipDetails returns a new SharedContentRelinquishMembershipDetails instance +func NewSharedContentRelinquishMembershipDetails(TargetIndex int64, OriginalFolderName string) *SharedContentRelinquishMembershipDetails { + s := new(SharedContentRelinquishMembershipDetails) + s.TargetIndex = TargetIndex + s.OriginalFolderName = OriginalFolderName + return s +} + +// SharedContentRemoveInviteeDetails : Removed an invitee from the membership of +// a shared file or folder before it was claimed. +type SharedContentRemoveInviteeDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name"` +} + +// NewSharedContentRemoveInviteeDetails returns a new SharedContentRemoveInviteeDetails instance +func NewSharedContentRemoveInviteeDetails(TargetIndex int64, OriginalFolderName string) *SharedContentRemoveInviteeDetails { + s := new(SharedContentRemoveInviteeDetails) + s.TargetIndex = TargetIndex + s.OriginalFolderName = OriginalFolderName + return s +} + +// SharedContentRemoveLinkExpiryDetails : Removed the expiry of the link for the +// shared file or folder. +type SharedContentRemoveLinkExpiryDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name,omitempty"` + // SharedFolderType : Shared folder type. Might be missing due to historical + // data gap. + SharedFolderType string `json:"shared_folder_type,omitempty"` +} + +// NewSharedContentRemoveLinkExpiryDetails returns a new SharedContentRemoveLinkExpiryDetails instance +func NewSharedContentRemoveLinkExpiryDetails(TargetIndex int64) *SharedContentRemoveLinkExpiryDetails { + s := new(SharedContentRemoveLinkExpiryDetails) + s.TargetIndex = TargetIndex + return s +} + +// SharedContentRemoveLinkPasswordDetails : Removed the password on the link for +// the shared file or folder. +type SharedContentRemoveLinkPasswordDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name,omitempty"` + // SharedFolderType : Shared folder type. Might be missing due to historical + // data gap. + SharedFolderType string `json:"shared_folder_type,omitempty"` +} + +// NewSharedContentRemoveLinkPasswordDetails returns a new SharedContentRemoveLinkPasswordDetails instance +func NewSharedContentRemoveLinkPasswordDetails(TargetIndex int64) *SharedContentRemoveLinkPasswordDetails { + s := new(SharedContentRemoveLinkPasswordDetails) + s.TargetIndex = TargetIndex + return s +} + +// SharedContentRemoveMemberDetails : Removed a user or a group from the +// membership of a shared file or folder. +type SharedContentRemoveMemberDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name,omitempty"` + // SharingPermission : Sharing permission. Might be missing due to + // historical data gap. + SharingPermission string `json:"sharing_permission,omitempty"` + // SharedFolderType : Shared folder type. Might be missing due to historical + // data gap. + SharedFolderType string `json:"shared_folder_type,omitempty"` +} + +// NewSharedContentRemoveMemberDetails returns a new SharedContentRemoveMemberDetails instance +func NewSharedContentRemoveMemberDetails(TargetIndex int64) *SharedContentRemoveMemberDetails { + s := new(SharedContentRemoveMemberDetails) + s.TargetIndex = TargetIndex + return s +} + +// SharedContentRequestAccessDetails : Requested to be on the membership of a +// shared file or folder. +type SharedContentRequestAccessDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name,omitempty"` + // SharedContentLink : Shared content link. + SharedContentLink string `json:"shared_content_link,omitempty"` +} + +// NewSharedContentRequestAccessDetails returns a new SharedContentRequestAccessDetails instance +func NewSharedContentRequestAccessDetails(TargetIndex int64) *SharedContentRequestAccessDetails { + s := new(SharedContentRequestAccessDetails) + s.TargetIndex = TargetIndex + return s +} + +// SharedContentUnshareDetails : Unshared a shared file or folder by clearing +// its membership and turning off its link. +type SharedContentUnshareDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name,omitempty"` +} + +// NewSharedContentUnshareDetails returns a new SharedContentUnshareDetails instance +func NewSharedContentUnshareDetails(TargetIndex int64) *SharedContentUnshareDetails { + s := new(SharedContentUnshareDetails) + s.TargetIndex = TargetIndex + return s +} + +// SharedContentViewDetails : Previewed the shared file or folder. +type SharedContentViewDetails struct { + // SharedContentLink : Shared content link. + SharedContentLink string `json:"shared_content_link"` + // SharingPermission : Sharing permission. Might be missing due to + // historical data gap. + SharingPermission string `json:"sharing_permission,omitempty"` + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` +} + +// NewSharedContentViewDetails returns a new SharedContentViewDetails instance +func NewSharedContentViewDetails(SharedContentLink string, TargetIndex int64) *SharedContentViewDetails { + s := new(SharedContentViewDetails) + s.SharedContentLink = SharedContentLink + s.TargetIndex = TargetIndex + return s +} + +// SharedContentViewerInfoPolicy : Shared content viewer info policy +type SharedContentViewerInfoPolicy struct { + dropbox.Tagged +} + +// Valid tag values for SharedContentViewerInfoPolicy +const ( + SharedContentViewerInfoPolicyDisabled = "disabled" + SharedContentViewerInfoPolicyEnabled = "enabled" + SharedContentViewerInfoPolicyOther = "other" +) + +// SharedFolderChangeConfidentialityDetails : Set or unset the confidential flag +// on a shared folder. +type SharedFolderChangeConfidentialityDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name"` + // NewValue : New confidentiality value. + NewValue *Confidentiality `json:"new_value"` + // PreviousValue : Previous confidentiality value. Might be missing due to + // historical data gap. + PreviousValue *Confidentiality `json:"previous_value,omitempty"` +} + +// NewSharedFolderChangeConfidentialityDetails returns a new SharedFolderChangeConfidentialityDetails instance +func NewSharedFolderChangeConfidentialityDetails(TargetIndex int64, OriginalFolderName string, NewValue *Confidentiality) *SharedFolderChangeConfidentialityDetails { + s := new(SharedFolderChangeConfidentialityDetails) + s.TargetIndex = TargetIndex + s.OriginalFolderName = OriginalFolderName + s.NewValue = NewValue + return s +} + +// SharedFolderChangeLinkPolicyDetails : Changed who can access the shared +// folder via a link. +type SharedFolderChangeLinkPolicyDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name"` + // SharedFolderType : Shared folder type. Might be missing due to historical + // data gap. + SharedFolderType string `json:"shared_folder_type,omitempty"` + // NewValue : New shared folder link policy. + NewValue *SharedFolderLinkPolicy `json:"new_value"` + // PreviousValue : Previous shared folder link policy. Might be missing due + // to historical data gap. + PreviousValue *SharedFolderLinkPolicy `json:"previous_value,omitempty"` +} + +// NewSharedFolderChangeLinkPolicyDetails returns a new SharedFolderChangeLinkPolicyDetails instance +func NewSharedFolderChangeLinkPolicyDetails(TargetIndex int64, OriginalFolderName string, NewValue *SharedFolderLinkPolicy) *SharedFolderChangeLinkPolicyDetails { + s := new(SharedFolderChangeLinkPolicyDetails) + s.TargetIndex = TargetIndex + s.OriginalFolderName = OriginalFolderName + s.NewValue = NewValue + return s +} + +// SharedFolderChangeMemberManagementPolicyDetails : Changed who can manage the +// membership of a shared folder. +type SharedFolderChangeMemberManagementPolicyDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name"` + // SharedFolderType : Shared folder type. Might be missing due to historical + // data gap. + SharedFolderType string `json:"shared_folder_type,omitempty"` + // NewValue : New membership management policy. + NewValue *SharedFolderMembershipManagementPolicy `json:"new_value"` + // PreviousValue : Previous membership management policy. Might be missing + // due to historical data gap. + PreviousValue *SharedFolderMembershipManagementPolicy `json:"previous_value,omitempty"` +} + +// NewSharedFolderChangeMemberManagementPolicyDetails returns a new SharedFolderChangeMemberManagementPolicyDetails instance +func NewSharedFolderChangeMemberManagementPolicyDetails(TargetIndex int64, OriginalFolderName string, NewValue *SharedFolderMembershipManagementPolicy) *SharedFolderChangeMemberManagementPolicyDetails { + s := new(SharedFolderChangeMemberManagementPolicyDetails) + s.TargetIndex = TargetIndex + s.OriginalFolderName = OriginalFolderName + s.NewValue = NewValue + return s +} + +// SharedFolderChangeMemberPolicyDetails : Changed who can become a member of +// the shared folder. +type SharedFolderChangeMemberPolicyDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name"` + // SharedFolderType : Shared folder type. Might be missing due to historical + // data gap. + SharedFolderType string `json:"shared_folder_type,omitempty"` + // NewValue : New external invite policy. + NewValue *SharedFolderMemberPolicy `json:"new_value"` + // PreviousValue : Previous external invite policy. Might be missing due to + // historical data gap. + PreviousValue *SharedFolderMemberPolicy `json:"previous_value,omitempty"` +} + +// NewSharedFolderChangeMemberPolicyDetails returns a new SharedFolderChangeMemberPolicyDetails instance +func NewSharedFolderChangeMemberPolicyDetails(TargetIndex int64, OriginalFolderName string, NewValue *SharedFolderMemberPolicy) *SharedFolderChangeMemberPolicyDetails { + s := new(SharedFolderChangeMemberPolicyDetails) + s.TargetIndex = TargetIndex + s.OriginalFolderName = OriginalFolderName + s.NewValue = NewValue + return s +} + +// SharedFolderCreateDetails : Created a shared folder. +type SharedFolderCreateDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // ParentNsId : Parent namespace ID. Might be missing due to historical data + // gap. + ParentNsId string `json:"parent_ns_id,omitempty"` +} + +// NewSharedFolderCreateDetails returns a new SharedFolderCreateDetails instance +func NewSharedFolderCreateDetails(TargetIndex int64) *SharedFolderCreateDetails { + s := new(SharedFolderCreateDetails) + s.TargetIndex = TargetIndex + return s +} + +// SharedFolderLinkPolicy : has no documentation (yet) +type SharedFolderLinkPolicy struct { + dropbox.Tagged +} + +// Valid tag values for SharedFolderLinkPolicy +const ( + SharedFolderLinkPolicyMembersOnly = "members_only" + SharedFolderLinkPolicyMembersAndTeam = "members_and_team" + SharedFolderLinkPolicyAnyone = "anyone" + SharedFolderLinkPolicyOther = "other" +) + +// SharedFolderMemberPolicy : Policy for controlling who can become a member of +// a shared folder +type SharedFolderMemberPolicy struct { + dropbox.Tagged +} + +// Valid tag values for SharedFolderMemberPolicy +const ( + SharedFolderMemberPolicyTeamOnly = "team_only" + SharedFolderMemberPolicyAnyone = "anyone" + SharedFolderMemberPolicyOther = "other" +) + +// SharedFolderMembershipManagementPolicy : has no documentation (yet) +type SharedFolderMembershipManagementPolicy struct { + dropbox.Tagged +} + +// Valid tag values for SharedFolderMembershipManagementPolicy +const ( + SharedFolderMembershipManagementPolicyOwner = "owner" + SharedFolderMembershipManagementPolicyEditors = "editors" + SharedFolderMembershipManagementPolicyOther = "other" +) + +// SharedFolderMountDetails : Added a shared folder to own Dropbox. +type SharedFolderMountDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name"` +} + +// NewSharedFolderMountDetails returns a new SharedFolderMountDetails instance +func NewSharedFolderMountDetails(TargetIndex int64, OriginalFolderName string) *SharedFolderMountDetails { + s := new(SharedFolderMountDetails) + s.TargetIndex = TargetIndex + s.OriginalFolderName = OriginalFolderName + return s +} + +// SharedFolderTransferOwnershipDetails : Transferred the ownership of a shared +// folder to another member. +type SharedFolderTransferOwnershipDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name"` +} + +// NewSharedFolderTransferOwnershipDetails returns a new SharedFolderTransferOwnershipDetails instance +func NewSharedFolderTransferOwnershipDetails(TargetIndex int64, OriginalFolderName string) *SharedFolderTransferOwnershipDetails { + s := new(SharedFolderTransferOwnershipDetails) + s.TargetIndex = TargetIndex + s.OriginalFolderName = OriginalFolderName + return s +} + +// SharedFolderUnmountDetails : Deleted a shared folder from Dropbox. +type SharedFolderUnmountDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` + // OriginalFolderName : Original shared folder name. + OriginalFolderName string `json:"original_folder_name"` +} + +// NewSharedFolderUnmountDetails returns a new SharedFolderUnmountDetails instance +func NewSharedFolderUnmountDetails(TargetIndex int64, OriginalFolderName string) *SharedFolderUnmountDetails { + s := new(SharedFolderUnmountDetails) + s.TargetIndex = TargetIndex + s.OriginalFolderName = OriginalFolderName + return s +} + +// SharedNoteOpenedDetails : Shared Paper document was opened. +type SharedNoteOpenedDetails struct { +} + +// NewSharedNoteOpenedDetails returns a new SharedNoteOpenedDetails instance +func NewSharedNoteOpenedDetails() *SharedNoteOpenedDetails { + s := new(SharedNoteOpenedDetails) + return s +} + +// SharingChangeFolderJoinPolicyDetails : Changed whether team members can join +// shared folders owned externally (i.e. outside the team). +type SharingChangeFolderJoinPolicyDetails struct { + // NewValue : New external join policy. + NewValue *SharingFolderJoinPolicy `json:"new_value"` + // PreviousValue : Previous external join policy. Might be missing due to + // historical data gap. + PreviousValue *SharingFolderJoinPolicy `json:"previous_value,omitempty"` +} + +// NewSharingChangeFolderJoinPolicyDetails returns a new SharingChangeFolderJoinPolicyDetails instance +func NewSharingChangeFolderJoinPolicyDetails(NewValue *SharingFolderJoinPolicy) *SharingChangeFolderJoinPolicyDetails { + s := new(SharingChangeFolderJoinPolicyDetails) + s.NewValue = NewValue + return s +} + +// SharingChangeLinkPolicyDetails : Changed whether team members can share links +// externally (i.e. outside the team), and if so, whether links should be +// accessible only by team members or anyone by default. +type SharingChangeLinkPolicyDetails struct { + // NewValue : New external link accessibility policy. + NewValue *SharingLinkPolicy `json:"new_value"` + // PreviousValue : Previous external link accessibility policy. Might be + // missing due to historical data gap. + PreviousValue *SharingLinkPolicy `json:"previous_value,omitempty"` +} + +// NewSharingChangeLinkPolicyDetails returns a new SharingChangeLinkPolicyDetails instance +func NewSharingChangeLinkPolicyDetails(NewValue *SharingLinkPolicy) *SharingChangeLinkPolicyDetails { + s := new(SharingChangeLinkPolicyDetails) + s.NewValue = NewValue + return s +} + +// SharingChangeMemberPolicyDetails : Changed whether team members can share +// files and folders externally (i.e. outside the team). +type SharingChangeMemberPolicyDetails struct { + // NewValue : New external invite policy. + NewValue *SharingMemberPolicy `json:"new_value"` + // PreviousValue : Previous external invite policy. Might be missing due to + // historical data gap. + PreviousValue *SharingMemberPolicy `json:"previous_value,omitempty"` +} + +// NewSharingChangeMemberPolicyDetails returns a new SharingChangeMemberPolicyDetails instance +func NewSharingChangeMemberPolicyDetails(NewValue *SharingMemberPolicy) *SharingChangeMemberPolicyDetails { + s := new(SharingChangeMemberPolicyDetails) + s.NewValue = NewValue + return s +} + +// SharingFolderJoinPolicy : Policy for controlling if team members can join +// shared folders owned by non team members. +type SharingFolderJoinPolicy struct { + dropbox.Tagged +} + +// Valid tag values for SharingFolderJoinPolicy +const ( + SharingFolderJoinPolicyTeamOnly = "team_only" + SharingFolderJoinPolicyAnyone = "anyone" + SharingFolderJoinPolicyOther = "other" +) + +// SharingLinkPolicy : Policy for controlling if team members can share links +// externally +type SharingLinkPolicy struct { + dropbox.Tagged +} + +// Valid tag values for SharingLinkPolicy +const ( + SharingLinkPolicyTeamOnly = "team_only" + SharingLinkPolicyDefaultTeamOnly = "default_team_only" + SharingLinkPolicyDefaultAnyone = "default_anyone" + SharingLinkPolicyOther = "other" +) + +// SharingMemberPolicy : External sharing policy +type SharingMemberPolicy struct { + dropbox.Tagged +} + +// Valid tag values for SharingMemberPolicy +const ( + SharingMemberPolicyTeamOnly = "team_only" + SharingMemberPolicyAnyone = "anyone" + SharingMemberPolicyOther = "other" +) + +// ShmodelAppCreateDetails : Created a link to a file using an app. +type ShmodelAppCreateDetails struct { + // SharingPermission : Sharing permission. Might be missing due to + // historical data gap. + SharingPermission string `json:"sharing_permission,omitempty"` + // TokenKey : Shared link token key. + TokenKey string `json:"token_key,omitempty"` +} + +// NewShmodelAppCreateDetails returns a new ShmodelAppCreateDetails instance +func NewShmodelAppCreateDetails() *ShmodelAppCreateDetails { + s := new(ShmodelAppCreateDetails) + return s +} + +// ShmodelCreateDetails : Created a new link. +type ShmodelCreateDetails struct { + // SharingPermission : Sharing permission. Might be missing due to + // historical data gap. + SharingPermission string `json:"sharing_permission,omitempty"` + // TokenKey : Shared link token key. + TokenKey string `json:"token_key,omitempty"` +} + +// NewShmodelCreateDetails returns a new ShmodelCreateDetails instance +func NewShmodelCreateDetails() *ShmodelCreateDetails { + s := new(ShmodelCreateDetails) + return s +} + +// ShmodelDisableDetails : Removed a link. +type ShmodelDisableDetails struct { + // SharingPermission : Sharing permission. Might be missing due to + // historical data gap. + SharingPermission string `json:"sharing_permission,omitempty"` + // TokenKey : Shared link token key. + TokenKey string `json:"token_key,omitempty"` +} + +// NewShmodelDisableDetails returns a new ShmodelDisableDetails instance +func NewShmodelDisableDetails() *ShmodelDisableDetails { + s := new(ShmodelDisableDetails) + return s +} + +// ShmodelFbShareDetails : Shared a link with Facebook users. +type ShmodelFbShareDetails struct { + // SharingNonMemberRecipients : Sharing non member recipients. + SharingNonMemberRecipients []*NonTeamMemberLogInfo `json:"sharing_non_member_recipients"` +} + +// NewShmodelFbShareDetails returns a new ShmodelFbShareDetails instance +func NewShmodelFbShareDetails(SharingNonMemberRecipients []*NonTeamMemberLogInfo) *ShmodelFbShareDetails { + s := new(ShmodelFbShareDetails) + s.SharingNonMemberRecipients = SharingNonMemberRecipients + return s +} + +// ShmodelGroupShareDetails : Shared a link with a group. +type ShmodelGroupShareDetails struct { +} + +// NewShmodelGroupShareDetails returns a new ShmodelGroupShareDetails instance +func NewShmodelGroupShareDetails() *ShmodelGroupShareDetails { + s := new(ShmodelGroupShareDetails) + return s +} + +// ShmodelRemoveExpirationDetails : Removed the expiration date from a link. +type ShmodelRemoveExpirationDetails struct { +} + +// NewShmodelRemoveExpirationDetails returns a new ShmodelRemoveExpirationDetails instance +func NewShmodelRemoveExpirationDetails() *ShmodelRemoveExpirationDetails { + s := new(ShmodelRemoveExpirationDetails) + return s +} + +// ShmodelSetExpirationDetails : Added an expiration date to a link. +type ShmodelSetExpirationDetails struct { + // ExpirationStartDate : Expiration starting date. + ExpirationStartDate string `json:"expiration_start_date"` + // ExpirationDays : The number of days from the starting expiration date + // after which the link will expire. + ExpirationDays int64 `json:"expiration_days"` +} + +// NewShmodelSetExpirationDetails returns a new ShmodelSetExpirationDetails instance +func NewShmodelSetExpirationDetails(ExpirationStartDate string, ExpirationDays int64) *ShmodelSetExpirationDetails { + s := new(ShmodelSetExpirationDetails) + s.ExpirationStartDate = ExpirationStartDate + s.ExpirationDays = ExpirationDays + return s +} + +// ShmodelTeamCopyDetails : Added a team member's file/folder to their Dropbox +// from a link. +type ShmodelTeamCopyDetails struct { +} + +// NewShmodelTeamCopyDetails returns a new ShmodelTeamCopyDetails instance +func NewShmodelTeamCopyDetails() *ShmodelTeamCopyDetails { + s := new(ShmodelTeamCopyDetails) + return s +} + +// ShmodelTeamDownloadDetails : Downloaded a team member's file/folder from a +// link. +type ShmodelTeamDownloadDetails struct { +} + +// NewShmodelTeamDownloadDetails returns a new ShmodelTeamDownloadDetails instance +func NewShmodelTeamDownloadDetails() *ShmodelTeamDownloadDetails { + s := new(ShmodelTeamDownloadDetails) + return s +} + +// ShmodelTeamShareDetails : Shared a link with team members. +type ShmodelTeamShareDetails struct { +} + +// NewShmodelTeamShareDetails returns a new ShmodelTeamShareDetails instance +func NewShmodelTeamShareDetails() *ShmodelTeamShareDetails { + s := new(ShmodelTeamShareDetails) + return s +} + +// ShmodelTeamViewDetails : Opened a team member's link. +type ShmodelTeamViewDetails struct { +} + +// NewShmodelTeamViewDetails returns a new ShmodelTeamViewDetails instance +func NewShmodelTeamViewDetails() *ShmodelTeamViewDetails { + s := new(ShmodelTeamViewDetails) + return s +} + +// ShmodelVisibilityPasswordDetails : Password-protected a link. +type ShmodelVisibilityPasswordDetails struct { +} + +// NewShmodelVisibilityPasswordDetails returns a new ShmodelVisibilityPasswordDetails instance +func NewShmodelVisibilityPasswordDetails() *ShmodelVisibilityPasswordDetails { + s := new(ShmodelVisibilityPasswordDetails) + return s +} + +// ShmodelVisibilityPublicDetails : Made a file/folder visible to anyone with +// the link. +type ShmodelVisibilityPublicDetails struct { +} + +// NewShmodelVisibilityPublicDetails returns a new ShmodelVisibilityPublicDetails instance +func NewShmodelVisibilityPublicDetails() *ShmodelVisibilityPublicDetails { + s := new(ShmodelVisibilityPublicDetails) + return s +} + +// ShmodelVisibilityTeamOnlyDetails : Made a file/folder visible only to team +// members with the link. +type ShmodelVisibilityTeamOnlyDetails struct { +} + +// NewShmodelVisibilityTeamOnlyDetails returns a new ShmodelVisibilityTeamOnlyDetails instance +func NewShmodelVisibilityTeamOnlyDetails() *ShmodelVisibilityTeamOnlyDetails { + s := new(ShmodelVisibilityTeamOnlyDetails) + return s +} + +// SignInAsSessionEndDetails : Ended admin sign-in-as session. +type SignInAsSessionEndDetails struct { +} + +// NewSignInAsSessionEndDetails returns a new SignInAsSessionEndDetails instance +func NewSignInAsSessionEndDetails() *SignInAsSessionEndDetails { + s := new(SignInAsSessionEndDetails) + return s +} + +// SignInAsSessionStartDetails : Started admin sign-in-as session. +type SignInAsSessionStartDetails struct { +} + +// NewSignInAsSessionStartDetails returns a new SignInAsSessionStartDetails instance +func NewSignInAsSessionStartDetails() *SignInAsSessionStartDetails { + s := new(SignInAsSessionStartDetails) + return s +} + +// SmartSyncChangePolicyDetails : Changed the default Smart Sync policy for team +// members. +type SmartSyncChangePolicyDetails struct { + // NewValue : New smart sync policy. + NewValue *SmartSyncPolicy `json:"new_value"` + // PreviousValue : Previous smart sync policy. Might be missing due to + // historical data gap. + PreviousValue *SmartSyncPolicy `json:"previous_value,omitempty"` +} + +// NewSmartSyncChangePolicyDetails returns a new SmartSyncChangePolicyDetails instance +func NewSmartSyncChangePolicyDetails(NewValue *SmartSyncPolicy) *SmartSyncChangePolicyDetails { + s := new(SmartSyncChangePolicyDetails) + s.NewValue = NewValue + return s +} + +// SmartSyncCreateAdminPrivilegeReportDetails : Smart Sync non-admin devices +// report created. +type SmartSyncCreateAdminPrivilegeReportDetails struct { +} + +// NewSmartSyncCreateAdminPrivilegeReportDetails returns a new SmartSyncCreateAdminPrivilegeReportDetails instance +func NewSmartSyncCreateAdminPrivilegeReportDetails() *SmartSyncCreateAdminPrivilegeReportDetails { + s := new(SmartSyncCreateAdminPrivilegeReportDetails) + return s +} + +// SmartSyncNotOptOutDetails : Opted team into Smart Sync. +type SmartSyncNotOptOutDetails struct { + // PreviousValue : Previous Smart Sync opt out policy. + PreviousValue *SmartSyncOptOutPolicy `json:"previous_value"` + // NewValue : New Smart Sync opt out policy. + NewValue *SmartSyncOptOutPolicy `json:"new_value"` +} + +// NewSmartSyncNotOptOutDetails returns a new SmartSyncNotOptOutDetails instance +func NewSmartSyncNotOptOutDetails(PreviousValue *SmartSyncOptOutPolicy, NewValue *SmartSyncOptOutPolicy) *SmartSyncNotOptOutDetails { + s := new(SmartSyncNotOptOutDetails) + s.PreviousValue = PreviousValue + s.NewValue = NewValue + return s +} + +// SmartSyncOptOutDetails : Opted team out of Smart Sync. +type SmartSyncOptOutDetails struct { + // PreviousValue : Previous Smart Sync opt out policy. + PreviousValue *SmartSyncOptOutPolicy `json:"previous_value"` + // NewValue : New Smart Sync opt out policy. + NewValue *SmartSyncOptOutPolicy `json:"new_value"` +} + +// NewSmartSyncOptOutDetails returns a new SmartSyncOptOutDetails instance +func NewSmartSyncOptOutDetails(PreviousValue *SmartSyncOptOutPolicy, NewValue *SmartSyncOptOutPolicy) *SmartSyncOptOutDetails { + s := new(SmartSyncOptOutDetails) + s.PreviousValue = PreviousValue + s.NewValue = NewValue + return s +} + +// SmartSyncOptOutPolicy : has no documentation (yet) +type SmartSyncOptOutPolicy struct { + dropbox.Tagged +} + +// Valid tag values for SmartSyncOptOutPolicy +const ( + SmartSyncOptOutPolicyOptedOut = "opted_out" + SmartSyncOptOutPolicyDefault = "default" + SmartSyncOptOutPolicyOther = "other" +) + +// SmartSyncPolicy : has no documentation (yet) +type SmartSyncPolicy struct { + dropbox.Tagged +} + +// Valid tag values for SmartSyncPolicy +const ( + SmartSyncPolicyLocalOnly = "local_only" + SmartSyncPolicySynced = "synced" + SmartSyncPolicyOther = "other" +) + +// SpaceLimitsLevel : has no documentation (yet) +type SpaceLimitsLevel struct { + dropbox.Tagged +} + +// Valid tag values for SpaceLimitsLevel +const ( + SpaceLimitsLevelGenerous = "generous" + SpaceLimitsLevelModerate = "moderate" + SpaceLimitsLevelNoLimit = "no_limit" + SpaceLimitsLevelStrict = "strict" + SpaceLimitsLevelOther = "other" +) + +// SpaceLimitsStatus : has no documentation (yet) +type SpaceLimitsStatus struct { + dropbox.Tagged +} + +// Valid tag values for SpaceLimitsStatus +const ( + SpaceLimitsStatusWithinQuota = "within_quota" + SpaceLimitsStatusNearQuota = "near_quota" + SpaceLimitsStatusOverQuota = "over_quota" + SpaceLimitsStatusOther = "other" +) + +// SsoChangeCertDetails : Changed the X.509 certificate for SSO. +type SsoChangeCertDetails struct { + // CertificateDetails : SSO certificate details. + CertificateDetails *Certificate `json:"certificate_details"` +} + +// NewSsoChangeCertDetails returns a new SsoChangeCertDetails instance +func NewSsoChangeCertDetails(CertificateDetails *Certificate) *SsoChangeCertDetails { + s := new(SsoChangeCertDetails) + s.CertificateDetails = CertificateDetails + return s +} + +// SsoChangeLoginUrlDetails : Changed the sign-in URL for SSO. +type SsoChangeLoginUrlDetails struct { + // PreviousValue : Previous single sign-on login URL. + PreviousValue string `json:"previous_value"` + // NewValue : New single sign-on login URL. + NewValue string `json:"new_value"` +} + +// NewSsoChangeLoginUrlDetails returns a new SsoChangeLoginUrlDetails instance +func NewSsoChangeLoginUrlDetails(PreviousValue string, NewValue string) *SsoChangeLoginUrlDetails { + s := new(SsoChangeLoginUrlDetails) + s.PreviousValue = PreviousValue + s.NewValue = NewValue + return s +} + +// SsoChangeLogoutUrlDetails : Changed the sign-out URL for SSO. +type SsoChangeLogoutUrlDetails struct { + // PreviousValue : Previous single sign-on logout URL. + PreviousValue string `json:"previous_value"` + // NewValue : New single sign-on logout URL. Might be missing due to + // historical data gap. + NewValue string `json:"new_value,omitempty"` +} + +// NewSsoChangeLogoutUrlDetails returns a new SsoChangeLogoutUrlDetails instance +func NewSsoChangeLogoutUrlDetails(PreviousValue string) *SsoChangeLogoutUrlDetails { + s := new(SsoChangeLogoutUrlDetails) + s.PreviousValue = PreviousValue + return s +} + +// SsoChangePolicyDetails : Change the single sign-on policy for the team. +type SsoChangePolicyDetails struct { + // NewValue : New single sign-on policy. + NewValue *SsoPolicy `json:"new_value"` + // PreviousValue : Previous single sign-on policy. Might be missing due to + // historical data gap. + PreviousValue *SsoPolicy `json:"previous_value,omitempty"` +} + +// NewSsoChangePolicyDetails returns a new SsoChangePolicyDetails instance +func NewSsoChangePolicyDetails(NewValue *SsoPolicy) *SsoChangePolicyDetails { + s := new(SsoChangePolicyDetails) + s.NewValue = NewValue + return s +} + +// SsoChangeSamlIdentityModeDetails : Changed the SAML identity mode for SSO. +type SsoChangeSamlIdentityModeDetails struct { + // PreviousValue : Previous single sign-on identity mode. + PreviousValue int64 `json:"previous_value"` + // NewValue : New single sign-on identity mode. + NewValue int64 `json:"new_value"` +} + +// NewSsoChangeSamlIdentityModeDetails returns a new SsoChangeSamlIdentityModeDetails instance +func NewSsoChangeSamlIdentityModeDetails(PreviousValue int64, NewValue int64) *SsoChangeSamlIdentityModeDetails { + s := new(SsoChangeSamlIdentityModeDetails) + s.PreviousValue = PreviousValue + s.NewValue = NewValue + return s +} + +// SsoLoginFailDetails : Failed to sign in using SSO. +type SsoLoginFailDetails struct { + // ErrorDetails : Login failure details. + ErrorDetails *FailureDetailsLogInfo `json:"error_details"` +} + +// NewSsoLoginFailDetails returns a new SsoLoginFailDetails instance +func NewSsoLoginFailDetails(ErrorDetails *FailureDetailsLogInfo) *SsoLoginFailDetails { + s := new(SsoLoginFailDetails) + s.ErrorDetails = ErrorDetails + return s +} + +// SsoPolicy : SSO policy +type SsoPolicy struct { + dropbox.Tagged +} + +// Valid tag values for SsoPolicy +const ( + SsoPolicyDisabled = "disabled" + SsoPolicyOptional = "optional" + SsoPolicyRequired = "required" + SsoPolicyOther = "other" +) + +// TeamActivityCreateReportDetails : Created a team activity report. +type TeamActivityCreateReportDetails struct { + // StartDate : Report start date. + StartDate time.Time `json:"start_date"` + // EndDate : Report end date. + EndDate time.Time `json:"end_date"` +} + +// NewTeamActivityCreateReportDetails returns a new TeamActivityCreateReportDetails instance +func NewTeamActivityCreateReportDetails(StartDate time.Time, EndDate time.Time) *TeamActivityCreateReportDetails { + s := new(TeamActivityCreateReportDetails) + s.StartDate = StartDate + s.EndDate = EndDate + return s +} + +// TeamEvent : An audit log event. +type TeamEvent struct { + // Timestamp : The Dropbox timestamp representing when the action was taken. + Timestamp time.Time `json:"timestamp"` + // EventCategory : The category that this type of action belongs to. + EventCategory *EventCategory `json:"event_category"` + // Actor : The entity who actually performed the action. + Actor *ActorLogInfo `json:"actor"` + // Origin : The origin from which the actor performed the action including + // information about host, ip address, location, session, etc. If the action + // was performed programmatically via the API the origin represents the API + // client. + Origin *OriginLogInfo `json:"origin,omitempty"` + // Participants : Zero or more users and/or groups that are affected by the + // action. Note that this list doesn't include any actors or users in + // context. + Participants []*ParticipantLogInfo `json:"participants,omitempty"` + // Assets : Zero or more content assets involved in the action. Currently + // these include Dropbox files and folders but in the future we might add + // other asset types such as Paper documents, folders, projects, etc. + Assets []*AssetLogInfo `json:"assets,omitempty"` + // InvolveNonTeamMember : True if the action involved a non team member + // either as the actor or as one of the affected users. + InvolveNonTeamMember bool `json:"involve_non_team_member"` + // Context : The user or team on whose behalf the actor performed the + // action. + Context *ContextLogInfo `json:"context"` + // EventType : The particular type of action taken. + EventType *EventType `json:"event_type"` + // Details : The variable event schema applicable to this type of action, + // instantiated with respect to this particular action. + Details *EventDetails `json:"details"` +} + +// NewTeamEvent returns a new TeamEvent instance +func NewTeamEvent(Timestamp time.Time, EventCategory *EventCategory, Actor *ActorLogInfo, InvolveNonTeamMember bool, Context *ContextLogInfo, EventType *EventType, Details *EventDetails) *TeamEvent { + s := new(TeamEvent) + s.Timestamp = Timestamp + s.EventCategory = EventCategory + s.Actor = Actor + s.InvolveNonTeamMember = InvolveNonTeamMember + s.Context = Context + s.EventType = EventType + s.Details = Details + return s +} + +// TeamFolderChangeStatusDetails : Changed the archival status of a team folder. +type TeamFolderChangeStatusDetails struct { + // NewValue : New team folder status. + NewValue *TeamFolderStatus `json:"new_value"` + // PreviousValue : Previous team folder status. Might be missing due to + // historical data gap. + PreviousValue *TeamFolderStatus `json:"previous_value,omitempty"` +} + +// NewTeamFolderChangeStatusDetails returns a new TeamFolderChangeStatusDetails instance +func NewTeamFolderChangeStatusDetails(NewValue *TeamFolderStatus) *TeamFolderChangeStatusDetails { + s := new(TeamFolderChangeStatusDetails) + s.NewValue = NewValue + return s +} + +// TeamFolderCreateDetails : Created a new team folder in active status. +type TeamFolderCreateDetails struct { +} + +// NewTeamFolderCreateDetails returns a new TeamFolderCreateDetails instance +func NewTeamFolderCreateDetails() *TeamFolderCreateDetails { + s := new(TeamFolderCreateDetails) + return s +} + +// TeamFolderDowngradeDetails : Downgraded a team folder to a regular shared +// folder. +type TeamFolderDowngradeDetails struct { + // TargetIndex : Target asset index. + TargetIndex int64 `json:"target_index"` +} + +// NewTeamFolderDowngradeDetails returns a new TeamFolderDowngradeDetails instance +func NewTeamFolderDowngradeDetails(TargetIndex int64) *TeamFolderDowngradeDetails { + s := new(TeamFolderDowngradeDetails) + s.TargetIndex = TargetIndex + return s +} + +// TeamFolderPermanentlyDeleteDetails : Permanently deleted an archived team +// folder. +type TeamFolderPermanentlyDeleteDetails struct { +} + +// NewTeamFolderPermanentlyDeleteDetails returns a new TeamFolderPermanentlyDeleteDetails instance +func NewTeamFolderPermanentlyDeleteDetails() *TeamFolderPermanentlyDeleteDetails { + s := new(TeamFolderPermanentlyDeleteDetails) + return s +} + +// TeamFolderRenameDetails : Renamed an active or archived team folder. +type TeamFolderRenameDetails struct { + // RelocateActionDetails : Specifies the source and destination indices in + // the assets list. + RelocateActionDetails *RelocateAssetReferencesLogInfo `json:"relocate_action_details"` +} + +// NewTeamFolderRenameDetails returns a new TeamFolderRenameDetails instance +func NewTeamFolderRenameDetails(RelocateActionDetails *RelocateAssetReferencesLogInfo) *TeamFolderRenameDetails { + s := new(TeamFolderRenameDetails) + s.RelocateActionDetails = RelocateActionDetails + return s +} + +// TeamFolderStatus : has no documentation (yet) +type TeamFolderStatus struct { + dropbox.Tagged +} + +// Valid tag values for TeamFolderStatus +const ( + TeamFolderStatusArchive = "archive" + TeamFolderStatusUnarchive = "unarchive" + TeamFolderStatusOther = "other" +) + +// TeamLinkedAppLogInfo : Team linked app +type TeamLinkedAppLogInfo struct { + AppLogInfo +} + +// NewTeamLinkedAppLogInfo returns a new TeamLinkedAppLogInfo instance +func NewTeamLinkedAppLogInfo() *TeamLinkedAppLogInfo { + s := new(TeamLinkedAppLogInfo) + return s +} + +// TeamMemberLogInfo : Team member's logged information. +type TeamMemberLogInfo struct { + UserLogInfo + // TeamMemberId : Team member ID. Might be missing due to historical data + // gap. + TeamMemberId string `json:"team_member_id,omitempty"` + // MemberExternalId : Team member external ID. + MemberExternalId string `json:"member_external_id,omitempty"` +} + +// NewTeamMemberLogInfo returns a new TeamMemberLogInfo instance +func NewTeamMemberLogInfo() *TeamMemberLogInfo { + s := new(TeamMemberLogInfo) + return s +} + +// TeamMembershipType : has no documentation (yet) +type TeamMembershipType struct { + dropbox.Tagged +} + +// Valid tag values for TeamMembershipType +const ( + TeamMembershipTypeFree = "free" + TeamMembershipTypeFull = "full" + TeamMembershipTypeOther = "other" +) + +// TeamMergeFromDetails : Merged another team into this team. +type TeamMergeFromDetails struct { + // TeamName : The name of the team that was merged into this team. + TeamName string `json:"team_name"` +} + +// NewTeamMergeFromDetails returns a new TeamMergeFromDetails instance +func NewTeamMergeFromDetails(TeamName string) *TeamMergeFromDetails { + s := new(TeamMergeFromDetails) + s.TeamName = TeamName + return s +} + +// TeamMergeToDetails : Merged this team into another team. +type TeamMergeToDetails struct { + // TeamName : The name of the team that this team was merged into. + TeamName string `json:"team_name"` +} + +// NewTeamMergeToDetails returns a new TeamMergeToDetails instance +func NewTeamMergeToDetails(TeamName string) *TeamMergeToDetails { + s := new(TeamMergeToDetails) + s.TeamName = TeamName + return s +} + +// TeamName : Team name details +type TeamName struct { + // TeamDisplayName : Team's display name. + TeamDisplayName string `json:"team_display_name"` + // TeamLegalName : Team's legal name. + TeamLegalName string `json:"team_legal_name"` +} + +// NewTeamName returns a new TeamName instance +func NewTeamName(TeamDisplayName string, TeamLegalName string) *TeamName { + s := new(TeamName) + s.TeamDisplayName = TeamDisplayName + s.TeamLegalName = TeamLegalName + return s +} + +// TeamProfileAddLogoDetails : Added a team logo to be displayed on shared link +// headers. +type TeamProfileAddLogoDetails struct { +} + +// NewTeamProfileAddLogoDetails returns a new TeamProfileAddLogoDetails instance +func NewTeamProfileAddLogoDetails() *TeamProfileAddLogoDetails { + s := new(TeamProfileAddLogoDetails) + return s +} + +// TeamProfileChangeLogoDetails : Changed the team logo to be displayed on +// shared link headers. +type TeamProfileChangeLogoDetails struct { +} + +// NewTeamProfileChangeLogoDetails returns a new TeamProfileChangeLogoDetails instance +func NewTeamProfileChangeLogoDetails() *TeamProfileChangeLogoDetails { + s := new(TeamProfileChangeLogoDetails) + return s +} + +// TeamProfileChangeNameDetails : Changed the team name. +type TeamProfileChangeNameDetails struct { + // PreviousValue : Previous teams name. Might be missing due to historical + // data gap. + PreviousValue *TeamName `json:"previous_value,omitempty"` + // NewValue : New team name. + NewValue *TeamName `json:"new_value"` +} + +// NewTeamProfileChangeNameDetails returns a new TeamProfileChangeNameDetails instance +func NewTeamProfileChangeNameDetails(NewValue *TeamName) *TeamProfileChangeNameDetails { + s := new(TeamProfileChangeNameDetails) + s.NewValue = NewValue + return s +} + +// TeamProfileRemoveLogoDetails : Removed the team logo to be displayed on +// shared link headers. +type TeamProfileRemoveLogoDetails struct { +} + +// NewTeamProfileRemoveLogoDetails returns a new TeamProfileRemoveLogoDetails instance +func NewTeamProfileRemoveLogoDetails() *TeamProfileRemoveLogoDetails { + s := new(TeamProfileRemoveLogoDetails) + return s +} + +// TfaAddBackupPhoneDetails : Added a backup phone for two-step verification. +type TfaAddBackupPhoneDetails struct { +} + +// NewTfaAddBackupPhoneDetails returns a new TfaAddBackupPhoneDetails instance +func NewTfaAddBackupPhoneDetails() *TfaAddBackupPhoneDetails { + s := new(TfaAddBackupPhoneDetails) + return s +} + +// TfaAddSecurityKeyDetails : Added a security key for two-step verification. +type TfaAddSecurityKeyDetails struct { +} + +// NewTfaAddSecurityKeyDetails returns a new TfaAddSecurityKeyDetails instance +func NewTfaAddSecurityKeyDetails() *TfaAddSecurityKeyDetails { + s := new(TfaAddSecurityKeyDetails) + return s +} + +// TfaChangeBackupPhoneDetails : Changed the backup phone for two-step +// verification. +type TfaChangeBackupPhoneDetails struct { +} + +// NewTfaChangeBackupPhoneDetails returns a new TfaChangeBackupPhoneDetails instance +func NewTfaChangeBackupPhoneDetails() *TfaChangeBackupPhoneDetails { + s := new(TfaChangeBackupPhoneDetails) + return s +} + +// TfaChangePolicyDetails : Change two-step verification policy for the team. +type TfaChangePolicyDetails struct { + // NewValue : New change policy. + NewValue *TfaPolicy `json:"new_value"` + // PreviousValue : Previous change policy. Might be missing due to + // historical data gap. + PreviousValue *TfaPolicy `json:"previous_value,omitempty"` +} + +// NewTfaChangePolicyDetails returns a new TfaChangePolicyDetails instance +func NewTfaChangePolicyDetails(NewValue *TfaPolicy) *TfaChangePolicyDetails { + s := new(TfaChangePolicyDetails) + s.NewValue = NewValue + return s +} + +// TfaChangeStatusDetails : Enabled, disabled or changed the configuration for +// two-step verification. +type TfaChangeStatusDetails struct { + // NewValue : The new two factor authentication configuration. + NewValue *TfaConfiguration `json:"new_value"` + // PreviousValue : The previous two factor authentication configuration. + // Might be missing due to historical data gap. + PreviousValue *TfaConfiguration `json:"previous_value,omitempty"` + // UsedRescueCode : Used two factor authentication rescue code. This flag is + // relevant when the two factor authentication configuration is disabled. + UsedRescueCode bool `json:"used_rescue_code,omitempty"` +} + +// NewTfaChangeStatusDetails returns a new TfaChangeStatusDetails instance +func NewTfaChangeStatusDetails(NewValue *TfaConfiguration) *TfaChangeStatusDetails { + s := new(TfaChangeStatusDetails) + s.NewValue = NewValue + return s +} + +// TfaConfiguration : Two factor authentication configuration. Note: the enabled +// option is deprecated. +type TfaConfiguration struct { + dropbox.Tagged +} + +// Valid tag values for TfaConfiguration +const ( + TfaConfigurationDisabled = "disabled" + TfaConfigurationEnabled = "enabled" + TfaConfigurationSms = "sms" + TfaConfigurationAuthenticator = "authenticator" + TfaConfigurationOther = "other" +) + +// TfaPolicy : Two factor authentication policy +type TfaPolicy struct { + dropbox.Tagged +} + +// Valid tag values for TfaPolicy +const ( + TfaPolicyDisabled = "disabled" + TfaPolicyOptional = "optional" + TfaPolicyRequired = "required" + TfaPolicyOther = "other" +) + +// TfaRemoveBackupPhoneDetails : Removed the backup phone for two-step +// verification. +type TfaRemoveBackupPhoneDetails struct { +} + +// NewTfaRemoveBackupPhoneDetails returns a new TfaRemoveBackupPhoneDetails instance +func NewTfaRemoveBackupPhoneDetails() *TfaRemoveBackupPhoneDetails { + s := new(TfaRemoveBackupPhoneDetails) + return s +} + +// TfaRemoveSecurityKeyDetails : Removed a security key for two-step +// verification. +type TfaRemoveSecurityKeyDetails struct { +} + +// NewTfaRemoveSecurityKeyDetails returns a new TfaRemoveSecurityKeyDetails instance +func NewTfaRemoveSecurityKeyDetails() *TfaRemoveSecurityKeyDetails { + s := new(TfaRemoveSecurityKeyDetails) + return s +} + +// TfaResetDetails : Reset two-step verification for team member. +type TfaResetDetails struct { +} + +// NewTfaResetDetails returns a new TfaResetDetails instance +func NewTfaResetDetails() *TfaResetDetails { + s := new(TfaResetDetails) + return s +} + +// TimeUnit : has no documentation (yet) +type TimeUnit struct { + dropbox.Tagged +} + +// Valid tag values for TimeUnit +const ( + TimeUnitMilliseconds = "milliseconds" + TimeUnitSeconds = "seconds" + TimeUnitMinutes = "minutes" + TimeUnitHours = "hours" + TimeUnitDays = "days" + TimeUnitWeeks = "weeks" + TimeUnitMonths = "months" + TimeUnitYears = "years" + TimeUnitOther = "other" +) + +// TwoAccountChangePolicyDetails : Enabled or disabled the option for team +// members to link a personal Dropbox account in addition to their work account +// to the same computer. +type TwoAccountChangePolicyDetails struct { + // NewValue : New two account policy. + NewValue *TwoAccountPolicy `json:"new_value"` + // PreviousValue : Previous two account policy. Might be missing due to + // historical data gap. + PreviousValue *TwoAccountPolicy `json:"previous_value,omitempty"` +} + +// NewTwoAccountChangePolicyDetails returns a new TwoAccountChangePolicyDetails instance +func NewTwoAccountChangePolicyDetails(NewValue *TwoAccountPolicy) *TwoAccountChangePolicyDetails { + s := new(TwoAccountChangePolicyDetails) + s.NewValue = NewValue + return s +} + +// TwoAccountPolicy : Policy for pairing personal account to work account +type TwoAccountPolicy struct { + dropbox.Tagged +} + +// Valid tag values for TwoAccountPolicy +const ( + TwoAccountPolicyDisabled = "disabled" + TwoAccountPolicyEnabled = "enabled" + TwoAccountPolicyOther = "other" +) + +// UserLinkedAppLogInfo : User linked app +type UserLinkedAppLogInfo struct { + AppLogInfo +} + +// NewUserLinkedAppLogInfo returns a new UserLinkedAppLogInfo instance +func NewUserLinkedAppLogInfo() *UserLinkedAppLogInfo { + s := new(UserLinkedAppLogInfo) + return s +} + +// UserNameLogInfo : User's name logged information +type UserNameLogInfo struct { + // GivenName : Given name. + GivenName string `json:"given_name"` + // Surname : Surname. + Surname string `json:"surname"` + // Locale : Locale. Might be missing due to historical data gap. + Locale string `json:"locale,omitempty"` +} + +// NewUserNameLogInfo returns a new UserNameLogInfo instance +func NewUserNameLogInfo(GivenName string, Surname string) *UserNameLogInfo { + s := new(UserNameLogInfo) + s.GivenName = GivenName + s.Surname = Surname + return s +} + +// UserOrTeamLinkedAppLogInfo : User or team linked app. Used when linked type +// is missing due to historical data gap. +type UserOrTeamLinkedAppLogInfo struct { + AppLogInfo +} + +// NewUserOrTeamLinkedAppLogInfo returns a new UserOrTeamLinkedAppLogInfo instance +func NewUserOrTeamLinkedAppLogInfo() *UserOrTeamLinkedAppLogInfo { + s := new(UserOrTeamLinkedAppLogInfo) + return s +} + +// WebSessionLogInfo : Web session. +type WebSessionLogInfo struct { + SessionLogInfo +} + +// NewWebSessionLogInfo returns a new WebSessionLogInfo instance +func NewWebSessionLogInfo() *WebSessionLogInfo { + s := new(WebSessionLogInfo) + return s +} + +// WebSessionsChangeFixedLengthPolicyDetails : Changed how long team members can +// stay signed in to Dropbox on the web. +type WebSessionsChangeFixedLengthPolicyDetails struct { + // NewValue : New session length policy. + NewValue *WebSessionsFixedLengthPolicy `json:"new_value"` + // PreviousValue : Previous session length policy. + PreviousValue *WebSessionsFixedLengthPolicy `json:"previous_value"` +} + +// NewWebSessionsChangeFixedLengthPolicyDetails returns a new WebSessionsChangeFixedLengthPolicyDetails instance +func NewWebSessionsChangeFixedLengthPolicyDetails(NewValue *WebSessionsFixedLengthPolicy, PreviousValue *WebSessionsFixedLengthPolicy) *WebSessionsChangeFixedLengthPolicyDetails { + s := new(WebSessionsChangeFixedLengthPolicyDetails) + s.NewValue = NewValue + s.PreviousValue = PreviousValue + return s +} + +// WebSessionsChangeIdleLengthPolicyDetails : Changed how long team members can +// be idle while signed in to Dropbox on the web. +type WebSessionsChangeIdleLengthPolicyDetails struct { + // NewValue : New idle length policy. + NewValue *WebSessionsIdleLengthPolicy `json:"new_value"` + // PreviousValue : Previous idle length policy. + PreviousValue *WebSessionsIdleLengthPolicy `json:"previous_value"` +} + +// NewWebSessionsChangeIdleLengthPolicyDetails returns a new WebSessionsChangeIdleLengthPolicyDetails instance +func NewWebSessionsChangeIdleLengthPolicyDetails(NewValue *WebSessionsIdleLengthPolicy, PreviousValue *WebSessionsIdleLengthPolicy) *WebSessionsChangeIdleLengthPolicyDetails { + s := new(WebSessionsChangeIdleLengthPolicyDetails) + s.NewValue = NewValue + s.PreviousValue = PreviousValue + return s +} + +// WebSessionsFixedLengthPolicy : Web sessions fixed length policy. +type WebSessionsFixedLengthPolicy struct { + dropbox.Tagged + // Defined : Defined fixed session length. + Defined *DurationLogInfo `json:"defined,omitempty"` +} + +// Valid tag values for WebSessionsFixedLengthPolicy +const ( + WebSessionsFixedLengthPolicyDefined = "defined" + WebSessionsFixedLengthPolicyUndefined = "undefined" + WebSessionsFixedLengthPolicyOther = "other" +) + +// UnmarshalJSON deserializes into a WebSessionsFixedLengthPolicy instance +func (u *WebSessionsFixedLengthPolicy) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Defined : Defined fixed session length. + Defined json.RawMessage `json:"defined,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 "defined": + err = json.Unmarshal(body, &u.Defined) + + if err != nil { + return err + } + } + return nil +} + +// WebSessionsIdleLengthPolicy : Web sessions idle length policy. +type WebSessionsIdleLengthPolicy struct { + dropbox.Tagged + // Defined : Defined idle session length. + Defined *DurationLogInfo `json:"defined,omitempty"` +} + +// Valid tag values for WebSessionsIdleLengthPolicy +const ( + WebSessionsIdleLengthPolicyDefined = "defined" + WebSessionsIdleLengthPolicyUndefined = "undefined" + WebSessionsIdleLengthPolicyOther = "other" +) + +// UnmarshalJSON deserializes into a WebSessionsIdleLengthPolicy instance +func (u *WebSessionsIdleLengthPolicy) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Defined : Defined idle session length. + Defined json.RawMessage `json:"defined,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 "defined": + err = json.Unmarshal(body, &u.Defined) + + if err != nil { + return err + } + } + return nil +} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_policies/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_policies/types.go new file mode 100644 index 000000000..4c5196664 --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_policies/types.go @@ -0,0 +1,134 @@ +// Copyright (c) Dropbox, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package team_policies : has no documentation (yet) +package team_policies + +import "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" + +// EmmState : has no documentation (yet) +type EmmState struct { + dropbox.Tagged +} + +// Valid tag values for EmmState +const ( + EmmStateDisabled = "disabled" + EmmStateOptional = "optional" + EmmStateRequired = "required" + EmmStateOther = "other" +) + +// OfficeAddInPolicy : has no documentation (yet) +type OfficeAddInPolicy struct { + dropbox.Tagged +} + +// Valid tag values for OfficeAddInPolicy +const ( + OfficeAddInPolicyDisabled = "disabled" + OfficeAddInPolicyEnabled = "enabled" + OfficeAddInPolicyOther = "other" +) + +// SharedFolderJoinPolicy : Policy governing which shared folders a team member +// can join. +type SharedFolderJoinPolicy struct { + dropbox.Tagged +} + +// Valid tag values for SharedFolderJoinPolicy +const ( + SharedFolderJoinPolicyFromTeamOnly = "from_team_only" + SharedFolderJoinPolicyFromAnyone = "from_anyone" + SharedFolderJoinPolicyOther = "other" +) + +// SharedFolderMemberPolicy : Policy governing who can be a member of a folder +// shared by a team member. +type SharedFolderMemberPolicy struct { + dropbox.Tagged +} + +// Valid tag values for SharedFolderMemberPolicy +const ( + SharedFolderMemberPolicyTeam = "team" + SharedFolderMemberPolicyAnyone = "anyone" + SharedFolderMemberPolicyOther = "other" +) + +// SharedLinkCreatePolicy : Policy governing the visibility of shared links. +// This policy can apply to newly created shared links, or all shared links. +type SharedLinkCreatePolicy struct { + dropbox.Tagged +} + +// Valid tag values for SharedLinkCreatePolicy +const ( + SharedLinkCreatePolicyDefaultPublic = "default_public" + SharedLinkCreatePolicyDefaultTeamOnly = "default_team_only" + SharedLinkCreatePolicyTeamOnly = "team_only" + SharedLinkCreatePolicyOther = "other" +) + +// TeamMemberPolicies : Policies governing team members. +type TeamMemberPolicies struct { + // Sharing : Policies governing sharing. + Sharing *TeamSharingPolicies `json:"sharing"` + // EmmState : This describes the Enterprise Mobility Management (EMM) state + // for this team. This information can be used to understand if an + // organization is integrating with a third-party EMM vendor to further + // manage and apply restrictions upon the team's Dropbox usage on mobile + // devices. This is a new feature and in the future we'll be adding more new + // fields and additional documentation. + EmmState *EmmState `json:"emm_state"` + // OfficeAddin : The admin policy around the Dropbox Office Add-In for this + // team. + OfficeAddin *OfficeAddInPolicy `json:"office_addin"` +} + +// NewTeamMemberPolicies returns a new TeamMemberPolicies instance +func NewTeamMemberPolicies(Sharing *TeamSharingPolicies, EmmState *EmmState, OfficeAddin *OfficeAddInPolicy) *TeamMemberPolicies { + s := new(TeamMemberPolicies) + s.Sharing = Sharing + s.EmmState = EmmState + s.OfficeAddin = OfficeAddin + return s +} + +// TeamSharingPolicies : Policies governing sharing within and outside of the +// team. +type TeamSharingPolicies struct { + // SharedFolderMemberPolicy : Who can join folders shared by team members. + SharedFolderMemberPolicy *SharedFolderMemberPolicy `json:"shared_folder_member_policy"` + // SharedFolderJoinPolicy : Which shared folders team members can join. + SharedFolderJoinPolicy *SharedFolderJoinPolicy `json:"shared_folder_join_policy"` + // SharedLinkCreatePolicy : Who can view shared links owned by team members. + SharedLinkCreatePolicy *SharedLinkCreatePolicy `json:"shared_link_create_policy"` +} + +// NewTeamSharingPolicies returns a new TeamSharingPolicies instance +func NewTeamSharingPolicies(SharedFolderMemberPolicy *SharedFolderMemberPolicy, SharedFolderJoinPolicy *SharedFolderJoinPolicy, SharedLinkCreatePolicy *SharedLinkCreatePolicy) *TeamSharingPolicies { + s := new(TeamSharingPolicies) + s.SharedFolderMemberPolicy = SharedFolderMemberPolicy + s.SharedFolderJoinPolicy = SharedFolderJoinPolicy + s.SharedLinkCreatePolicy = SharedLinkCreatePolicy + return s +} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users/client.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users/client.go new file mode 100644 index 000000000..5348f38cb --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users/client.go @@ -0,0 +1,324 @@ +// Copyright (c) Dropbox, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package users + +import ( + "bytes" + "encoding/json" + "io/ioutil" + "net/http" + + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" +) + +// Client interface describes all routes in this namespace +type Client interface { + // GetAccount : Get information about a user's account. + GetAccount(arg *GetAccountArg) (res *BasicAccount, err error) + // GetAccountBatch : Get information about multiple user accounts. At most + // 300 accounts may be queried per request. + GetAccountBatch(arg *GetAccountBatchArg) (res []*BasicAccount, err error) + // GetCurrentAccount : Get information about the current user's account. + GetCurrentAccount() (res *FullAccount, err error) + // GetSpaceUsage : Get the space usage information for the current user's + // account. + GetSpaceUsage() (res *SpaceUsage, err error) +} + +type apiImpl dropbox.Context + +//GetAccountAPIError is an error-wrapper for the get_account route +type GetAccountAPIError struct { + dropbox.APIError + EndpointError *GetAccountError `json:"error"` +} + +func (dbx *apiImpl) GetAccount(arg *GetAccountArg) (res *BasicAccount, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "users", "get_account", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GetAccountAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//GetAccountBatchAPIError is an error-wrapper for the get_account_batch route +type GetAccountBatchAPIError struct { + dropbox.APIError + EndpointError *GetAccountBatchError `json:"error"` +} + +func (dbx *apiImpl) GetAccountBatch(arg *GetAccountBatchArg) (res []*BasicAccount, err error) { + cli := dbx.Client + + dbx.Config.TryLog("arg: %v", arg) + b, err := json.Marshal(arg) + if err != nil { + return + } + + headers := map[string]string{ + "Content-Type": "application/json", + } + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "users", "get_account_batch", headers, bytes.NewReader(b)) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GetAccountBatchAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//GetCurrentAccountAPIError is an error-wrapper for the get_current_account route +type GetCurrentAccountAPIError struct { + dropbox.APIError + EndpointError struct{} `json:"error"` +} + +func (dbx *apiImpl) GetCurrentAccount() (res *FullAccount, err error) { + cli := dbx.Client + + headers := map[string]string{} + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "users", "get_current_account", headers, nil) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GetCurrentAccountAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +//GetSpaceUsageAPIError is an error-wrapper for the get_space_usage route +type GetSpaceUsageAPIError struct { + dropbox.APIError + EndpointError struct{} `json:"error"` +} + +func (dbx *apiImpl) GetSpaceUsage() (res *SpaceUsage, err error) { + cli := dbx.Client + + headers := map[string]string{} + if dbx.Config.AsMemberID != "" { + headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID + } + + req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "users", "get_space_usage", headers, nil) + if err != nil { + return + } + dbx.Config.TryLog("req: %v", req) + + resp, err := cli.Do(req) + if err != nil { + return + } + + dbx.Config.TryLog("resp: %v", resp) + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return + } + + dbx.Config.TryLog("body: %v", body) + if resp.StatusCode == http.StatusOK { + err = json.Unmarshal(body, &res) + if err != nil { + return + } + + return + } + if resp.StatusCode == http.StatusConflict { + var apiError GetSpaceUsageAPIError + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return + } + var apiError dropbox.APIError + if resp.StatusCode == http.StatusBadRequest { + apiError.ErrorSummary = string(body) + err = apiError + return + } + err = json.Unmarshal(body, &apiError) + if err != nil { + return + } + err = apiError + return +} + +// New returns a Client implementation for this namespace +func New(c dropbox.Config) *apiImpl { + ctx := apiImpl(dropbox.NewContext(c)) + return &ctx +} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users/types.go new file mode 100644 index 000000000..0833fd6ce --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users/types.go @@ -0,0 +1,360 @@ +// Copyright (c) Dropbox, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package users : This namespace contains endpoints and data types for user +// management. +package users + +import ( + "encoding/json" + + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_policies" + "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users_common" +) + +// Account : The amount of detail revealed about an account depends on the user +// being queried and the user making the query. +type Account struct { + // AccountId : The user's unique Dropbox ID. + AccountId string `json:"account_id"` + // Name : Details of a user's name. + Name *Name `json:"name"` + // Email : The user's e-mail address. Do not rely on this without checking + // the `email_verified` field. Even then, it's possible that the user has + // since lost access to their e-mail. + Email string `json:"email"` + // EmailVerified : Whether the user has verified their e-mail address. + EmailVerified bool `json:"email_verified"` + // ProfilePhotoUrl : URL for the photo representing the user, if one is set. + ProfilePhotoUrl string `json:"profile_photo_url,omitempty"` + // Disabled : Whether the user has been disabled. + Disabled bool `json:"disabled"` +} + +// NewAccount returns a new Account instance +func NewAccount(AccountId string, Name *Name, Email string, EmailVerified bool, Disabled bool) *Account { + s := new(Account) + s.AccountId = AccountId + s.Name = Name + s.Email = Email + s.EmailVerified = EmailVerified + s.Disabled = Disabled + return s +} + +// BasicAccount : Basic information about any account. +type BasicAccount struct { + Account + // IsTeammate : Whether this user is a teammate of the current user. If this + // account is the current user's account, then this will be true. + IsTeammate bool `json:"is_teammate"` + // TeamMemberId : The user's unique team member id. This field will only be + // present if the user is part of a team and `is_teammate` is true. + TeamMemberId string `json:"team_member_id,omitempty"` +} + +// NewBasicAccount returns a new BasicAccount instance +func NewBasicAccount(AccountId string, Name *Name, Email string, EmailVerified bool, Disabled bool, IsTeammate bool) *BasicAccount { + s := new(BasicAccount) + s.AccountId = AccountId + s.Name = Name + s.Email = Email + s.EmailVerified = EmailVerified + s.Disabled = Disabled + s.IsTeammate = IsTeammate + return s +} + +// FullAccount : Detailed information about the current user's account. +type FullAccount struct { + Account + // Country : The user's two-letter country code, if available. Country codes + // are based on `ISO 3166-1` . + Country string `json:"country,omitempty"` + // Locale : The language that the user specified. Locale tags will be `IETF + // language tags` . + Locale string `json:"locale"` + // ReferralLink : The user's `referral link` + // . + ReferralLink string `json:"referral_link"` + // Team : If this account is a member of a team, information about that + // team. + Team *FullTeam `json:"team,omitempty"` + // TeamMemberId : This account's unique team member id. This field will only + // be present if `team` is present. + TeamMemberId string `json:"team_member_id,omitempty"` + // IsPaired : Whether the user has a personal and work account. If the + // current account is personal, then `team` will always be nil, but + // `is_paired` will indicate if a work account is linked. + IsPaired bool `json:"is_paired"` + // AccountType : What type of account this user has. + AccountType *users_common.AccountType `json:"account_type"` +} + +// NewFullAccount returns a new FullAccount instance +func NewFullAccount(AccountId string, Name *Name, Email string, EmailVerified bool, Disabled bool, Locale string, ReferralLink string, IsPaired bool, AccountType *users_common.AccountType) *FullAccount { + s := new(FullAccount) + s.AccountId = AccountId + s.Name = Name + s.Email = Email + s.EmailVerified = EmailVerified + s.Disabled = Disabled + s.Locale = Locale + s.ReferralLink = ReferralLink + s.IsPaired = IsPaired + s.AccountType = AccountType + return s +} + +// Team : Information about a team. +type Team struct { + // Id : The team's unique ID. + Id string `json:"id"` + // Name : The name of the team. + Name string `json:"name"` +} + +// NewTeam returns a new Team instance +func NewTeam(Id string, Name string) *Team { + s := new(Team) + s.Id = Id + s.Name = Name + return s +} + +// FullTeam : Detailed information about a team. +type FullTeam struct { + Team + // SharingPolicies : Team policies governing sharing. + SharingPolicies *team_policies.TeamSharingPolicies `json:"sharing_policies"` + // OfficeAddinPolicy : Team policy governing the use of the Office Add-In. + OfficeAddinPolicy *team_policies.OfficeAddInPolicy `json:"office_addin_policy"` +} + +// NewFullTeam returns a new FullTeam instance +func NewFullTeam(Id string, Name string, SharingPolicies *team_policies.TeamSharingPolicies, OfficeAddinPolicy *team_policies.OfficeAddInPolicy) *FullTeam { + s := new(FullTeam) + s.Id = Id + s.Name = Name + s.SharingPolicies = SharingPolicies + s.OfficeAddinPolicy = OfficeAddinPolicy + return s +} + +// GetAccountArg : has no documentation (yet) +type GetAccountArg struct { + // AccountId : A user's account identifier. + AccountId string `json:"account_id"` +} + +// NewGetAccountArg returns a new GetAccountArg instance +func NewGetAccountArg(AccountId string) *GetAccountArg { + s := new(GetAccountArg) + s.AccountId = AccountId + return s +} + +// GetAccountBatchArg : has no documentation (yet) +type GetAccountBatchArg struct { + // AccountIds : List of user account identifiers. Should not contain any + // duplicate account IDs. + AccountIds []string `json:"account_ids"` +} + +// NewGetAccountBatchArg returns a new GetAccountBatchArg instance +func NewGetAccountBatchArg(AccountIds []string) *GetAccountBatchArg { + s := new(GetAccountBatchArg) + s.AccountIds = AccountIds + return s +} + +// GetAccountBatchError : has no documentation (yet) +type GetAccountBatchError struct { + dropbox.Tagged + // NoAccount : The value is an account ID specified in + // `GetAccountBatchArg.account_ids` that does not exist. + NoAccount string `json:"no_account,omitempty"` +} + +// Valid tag values for GetAccountBatchError +const ( + GetAccountBatchErrorNoAccount = "no_account" + GetAccountBatchErrorOther = "other" +) + +// UnmarshalJSON deserializes into a GetAccountBatchError instance +func (u *GetAccountBatchError) 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 "no_account": + err = json.Unmarshal(body, &u.NoAccount) + + if err != nil { + return err + } + } + return nil +} + +// GetAccountError : has no documentation (yet) +type GetAccountError struct { + dropbox.Tagged +} + +// Valid tag values for GetAccountError +const ( + GetAccountErrorNoAccount = "no_account" + GetAccountErrorOther = "other" +) + +// IndividualSpaceAllocation : has no documentation (yet) +type IndividualSpaceAllocation struct { + // Allocated : The total space allocated to the user's account (bytes). + Allocated uint64 `json:"allocated"` +} + +// NewIndividualSpaceAllocation returns a new IndividualSpaceAllocation instance +func NewIndividualSpaceAllocation(Allocated uint64) *IndividualSpaceAllocation { + s := new(IndividualSpaceAllocation) + s.Allocated = Allocated + return s +} + +// Name : Representations for a person's name to assist with +// internationalization. +type Name struct { + // GivenName : Also known as a first name. + GivenName string `json:"given_name"` + // Surname : Also known as a last name or family name. + Surname string `json:"surname"` + // FamiliarName : Locale-dependent name. In the US, a person's familiar name + // is their `given_name`, but elsewhere, it could be any combination of a + // person's `given_name` and `surname`. + FamiliarName string `json:"familiar_name"` + // DisplayName : A name that can be used directly to represent the name of a + // user's Dropbox account. + DisplayName string `json:"display_name"` + // AbbreviatedName : An abbreviated form of the person's name. Their + // initials in most locales. + AbbreviatedName string `json:"abbreviated_name"` +} + +// NewName returns a new Name instance +func NewName(GivenName string, Surname string, FamiliarName string, DisplayName string, AbbreviatedName string) *Name { + s := new(Name) + s.GivenName = GivenName + s.Surname = Surname + s.FamiliarName = FamiliarName + s.DisplayName = DisplayName + s.AbbreviatedName = AbbreviatedName + return s +} + +// SpaceAllocation : Space is allocated differently based on the type of +// account. +type SpaceAllocation struct { + dropbox.Tagged + // Individual : The user's space allocation applies only to their individual + // account. + Individual *IndividualSpaceAllocation `json:"individual,omitempty"` + // Team : The user shares space with other members of their team. + Team *TeamSpaceAllocation `json:"team,omitempty"` +} + +// Valid tag values for SpaceAllocation +const ( + SpaceAllocationIndividual = "individual" + SpaceAllocationTeam = "team" + SpaceAllocationOther = "other" +) + +// UnmarshalJSON deserializes into a SpaceAllocation instance +func (u *SpaceAllocation) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // Individual : The user's space allocation applies only to their + // individual account. + Individual json.RawMessage `json:"individual,omitempty"` + // Team : The user shares space with other members of their team. + Team json.RawMessage `json:"team,omitempty"` + } + var w wrap + var err error + if err = json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "individual": + err = json.Unmarshal(body, &u.Individual) + + if err != nil { + return err + } + case "team": + err = json.Unmarshal(body, &u.Team) + + if err != nil { + return err + } + } + return nil +} + +// SpaceUsage : Information about a user's space usage and quota. +type SpaceUsage struct { + // Used : The user's total space usage (bytes). + Used uint64 `json:"used"` + // Allocation : The user's space allocation. + Allocation *SpaceAllocation `json:"allocation"` +} + +// NewSpaceUsage returns a new SpaceUsage instance +func NewSpaceUsage(Used uint64, Allocation *SpaceAllocation) *SpaceUsage { + s := new(SpaceUsage) + s.Used = Used + s.Allocation = Allocation + return s +} + +// TeamSpaceAllocation : has no documentation (yet) +type TeamSpaceAllocation struct { + // Used : The total space currently used by the user's team (bytes). + Used uint64 `json:"used"` + // Allocated : The total space allocated to the user's team (bytes). + Allocated uint64 `json:"allocated"` +} + +// NewTeamSpaceAllocation returns a new TeamSpaceAllocation instance +func NewTeamSpaceAllocation(Used uint64, Allocated uint64) *TeamSpaceAllocation { + s := new(TeamSpaceAllocation) + s.Used = Used + s.Allocated = Allocated + return s +} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users_common/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users_common/types.go new file mode 100644 index 000000000..e7a6a1a9d --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users_common/types.go @@ -0,0 +1,37 @@ +// Copyright (c) Dropbox, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package users_common : This namespace contains common data types used within +// the users namespace +package users_common + +import "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox" + +// AccountType : What type of account this user has. +type AccountType struct { + dropbox.Tagged +} + +// Valid tag values for AccountType +const ( + AccountTypeBasic = "basic" + AccountTypePro = "pro" + AccountTypeBusiness = "business" +) diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/README.md b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/README.md new file mode 100644 index 000000000..325f84265 --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/README.md @@ -0,0 +1,237 @@ +# Dropbox Go SDK Generator + +This directory contains the [Stone](https://github.com/dropbox/stone) code generators +used to programmatically generate the [Dropbox Go SDK](https://github.com/dropbox/dropbox-sdk-go). + +## Requirements + + * While not a hard requirement, this repo currently assumes `python3` in the path. + * Assumes you have already installed [Stone](https://github.com/dropbox/stone) + * Requires [goimports](https://godoc.org/golang.org/x/tools/cmd/goimports) to fix up imports in the auto-generated code + +## Basic Setup + + . Clone this repo + . Run `git submodule init` followed by `git submodule update` + . Run `./generate-sdk.sh` to generate code under `../dropbox` + +## Generated Code + +### Basic Types + +Here is how Stone [basic types](https://github.com/dropbox/stone/blob/master/doc/lang_ref.rst#basic-types) map to Go types: + +Stone Type | Go Type +---------- | ------- +Int32/Int64/UInt32/UInt64 | int32/int64/uint32/uint64 +Float32/Float64 | float32/float64 +Boolean | bool +String | string +Timestamp | time.Time +Void | struct{} + +### Structs + +Stone [structs](https://github.com/dropbox/stone/blob/master/doc/lang_ref.rst#struct) are represented as Go [structs](https://gobyexample.com/structs) in a relatively straight-forward manner. Each struct member is exported and also gets assigned the correct json tag. The latter is used for serializing requests and deserializing responses. Non-primitive types are represented as pointers to the corresponding type. + +``` +struct Account + "The amount of detail revealed about an account depends on the user + being queried and the user making the query." + + account_id AccountId + "The user's unique Dropbox ID." + name Name + "Details of a user's name." +``` + +```go +// The amount of detail revealed about an account depends on the user being +// queried and the user making the query. +type Account struct { + // The user's unique Dropbox ID. + AccountId string `json:"account_id"` + // Details of a user's name. + Name *Name `json:"name"` +} +``` + +#### Inheritance + +Stone supports [struct inheritance](https://github.com/dropbox/stone/blob/master/doc/lang_ref.rst#inheritance). In Go, we support this via [embedding](https://golang.org/doc/effective_go.html#embedding) + +``` +struct BasicAccount extends Account + "Basic information about any account." + + is_teammate Boolean + "Whether this user is a teammate of the current user. If this account + is the current user's account, then this will be :val:`true`." +``` + +```go +// Basic information about any account. +type BasicAccount struct { + Account + // Whether this user is a teammate of the current user. If this account is + // the current user's account, then this will be `True`. + IsTeammate bool `json:"is_teammate"` +``` + +### Unions + +Stone https://github.com/dropbox/stone/blob/master/doc/lang_ref.rst#union[unions] are bit more complex as Go doesn't have native support for union types (tagged or otherwise). We declare a union as a Go struct with all the possible fields as pointer types, and then use the tag value to populate the correct field during deserialization. This necessitates the use of an intermediate wrapper struct for the deserialization to work correctly, see below for a concrete example. + +``` +union SpaceAllocation + "Space is allocated differently based on the type of account." + + individual IndividualSpaceAllocation + "The user's space allocation applies only to their individual account." + team TeamSpaceAllocation + "The user shares space with other members of their team." +``` + +```go +// Space is allocated differently based on the type of account. +type SpaceAllocation struct { + dropbox.Tagged + // The user's space allocation applies only to their individual account. + Individual *IndividualSpaceAllocation `json:"individual,omitempty"` + // The user shares space with other members of their team. + Team *TeamSpaceAllocation `json:"team,omitempty"` +} + +// Valid tag values for `SpaceAllocation` +const ( + SpaceAllocation_Individual = "individual" + SpaceAllocation_Team = "team" + SpaceAllocation_Other = "other" +) + +func (u *SpaceAllocation) UnmarshalJSON(body []byte) error { + type wrap struct { + dropbox.Tagged + // The user's space allocation applies only to their individual account. + Individual json.RawMessage `json:"individual,omitempty"` + // The user shares space with other members of their team. + Team json.RawMessage `json:"team,omitempty"` + } + var w wrap + if err := json.Unmarshal(body, &w); err != nil { + return err + } + u.Tag = w.Tag + switch u.Tag { + case "individual": + if err := json.Unmarshal(body, &u.Individual); err != nil { + return err + } + + case "team": + if err := json.Unmarshal(body, &u.Team); err != nil { + return err + } + + } + return nil +} +``` + +### Struct with Enumerated Subtypes + +Per the https://github.com/dropbox/stone/blob/master/doc/lang_ref.rst#struct-polymorphism[spec], structs with enumerated subtypes are a mechanism of inheritance: + +> If a struct enumerates its subtypes, an instance of any subtype will satisfy the type constraint. This is useful when wanting to discriminate amongst types that are part of the same hierarchy while simultaneously being able to avoid discriminating when accessing common fields. + +To represent structs with enumerated subtypes in Go, we use a combination of Go interface types and unions as implemented above. Considering the following: + +``` +struct Metadata + union + file FileMetadata + folder FolderMetadata + deleted DeletedMetadata # Used by list_folder* and search + + name String + path_lower String? + path_display String? + parent_shared_folder_id common.SharedFolderId? + +struct FileMetadata extends Metadata + id Id + client_modified common.DropboxTimestamp + ... +``` + +In this case, `FileMetadata`, `FolderMetadata` etc are subtypes of `Metadata`. Specifically, any subtype can be used where a parent type is expected. Thus, if `list_folder` returns a list of `Metadata`s, we should be able to parse and "upcast" to one of the enumerated subtypes. + +First, we define structs to represent the base and enumerated types as we did for inherited structs above: + +```go +type Metadata struct { + Name string `json:"name"` + PathLower string `json:"path_lower,omitempty"` + PathDisplay string `json:"path_display,omitempty"` + ParentSharedFolderId string `json:"parent_shared_folder_id,omitempty"` +} + +type FileMetadata struct { + Metadata + Id string `json:"id"` + ClientModified time.Time `json:"client_modified"` + ... +} +``` + +Next, we define an interface type with a dummy method and ensure that both the base and the subtypes implement the interface: + +```go +type IsMetadata interface { + IsMetadata() +} + +func (u *Metadata) IsMetadata() {} // Subtypes get this for free due to embedding +``` + +At this point, types or methods that accept/return a struct with enumerated subtypes can use the interface type instead. For instance: + +```go +func GetMetadata(arg *GetMetadataArg) (res IsMetadata, err error) {...} + +type ListFolderResult struct { + // The files and (direct) subfolders in the folder. + Entries []IsMetadata `json:"entries"` + ... +} +``` + +Finally, to actually deserialize a bag of bytes into the appropriate type or subtype, we use a trick similar to how we handle unions above. + +```go +type metadataUnion struct { + dropbox.Tagged + File *FileMetadata `json:"file,omitempty"` + Folder *FolderMetadata `json:"folder,omitempty"` + Deleted *DeletedMetadata `json:"deleted,omitempty"` +} + +func (u *metadataUnion) UnmarshalJSON(body []byte) error {...} + +func (dbx *apiImpl) GetMetadata(arg *GetMetadataArg) (res IsMetadata, err error) { + ... + var tmp metadataUnion + err = json.Unmarshal(body, &tmp) + if err != nil { + return + } + switch tmp.Tag { + case "file": + res = tmp.File + case "folder": + res = tmp.Folder + case "deleted": + res = tmp.Deleted + } +} +``` diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/generate-sdk.sh b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/generate-sdk.sh new file mode 100755 index 000000000..718f686f4 --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/generate-sdk.sh @@ -0,0 +1,26 @@ +#! /usr/bin/env bash +set -euo pipefail + +if [[ $# -ne 0 ]]; then + echo "$0: Not expecting any command-line arguments, got $#." 1>&2 + exit 1 +fi + +loc=$(realpath -e $0) +base_dir=$(dirname "$loc") +spec_dir="$base_dir/dropbox-api-spec" +gen_dir=$(dirname ${base_dir})/dropbox + +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.0.0-beta" +pushd ${spec_dir} +spec_version=$(git rev-parse --short HEAD) +popd + +sed -i.bak -e "s/UNKNOWN SDK VERSION/${sdk_version}/" \ + -e "s/UNKNOWN SPEC VERSION/${spec_version}/" ${gen_dir}/sdk.go +rm ${gen_dir}/sdk.go.bak +goimports -l -w ${gen_dir} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/go_client.stoneg.py b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/go_client.stoneg.py new file mode 100644 index 000000000..4193a25b4 --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/go_client.stoneg.py @@ -0,0 +1,214 @@ +import os + +from stone.generator import CodeGenerator +from stone.data_type import ( + is_void_type, + is_struct_type +) + +from go_helpers import ( + HEADER, + fmt_type, + fmt_var, + generate_doc, +) + + +class GoClientGenerator(CodeGenerator): + def generate(self, api): + for namespace in api.namespaces.values(): + if len(namespace.routes) > 0: + self._generate_client(namespace) + + def _generate_client(self, namespace): + file_name = os.path.join(self.target_folder_path, namespace.name, + 'client.go') + with self.output_to_relative_path(file_name): + self.emit_raw(HEADER) + self.emit() + self.emit('package %s' % namespace.name) + self.emit() + + self.emit('// Client interface describes all routes in this namespace') + with self.block('type Client interface'): + for route in namespace.routes: + generate_doc(self, route) + self.emit(self._generate_route_signature(namespace, route)) + self.emit() + + self.emit('type apiImpl dropbox.Context') + for route in namespace.routes: + self._generate_route(namespace, route) + self.emit('// New returns a Client implementation for this namespace') + with self.block('func New(c dropbox.Config) *apiImpl'): + self.emit('ctx := apiImpl(dropbox.NewContext(c))') + self.emit('return &ctx') + + def _generate_route_signature(self, namespace, route): + req = fmt_type(route.arg_data_type, namespace) + res = fmt_type(route.result_data_type, namespace, use_interface=True) + fn = fmt_var(route.name) + style = route.attrs.get('style', 'rpc') + + arg = '' if is_void_type(route.arg_data_type) else 'arg {req}' + ret = '(err error)' if is_void_type(route.result_data_type) else \ + '(res {res}, err error)' + signature = '{fn}(' + arg + ') ' + ret + if style == 'download': + signature = '{fn}(' + arg + \ + ') (res {res}, content io.ReadCloser, err error)' + elif style == 'upload': + signature = '{fn}(' + arg + ', content io.Reader) ' + ret + if is_void_type(route.arg_data_type): + signature = '{fn}(content io.Reader) ' + ret + return signature.format(fn=fn, req=req, res=res) + + + def _generate_route(self, namespace, route): + out = self.emit + fn = fmt_var(route.name) + err = fmt_type(route.error_data_type, namespace) + out('//%sAPIError is an error-wrapper for the %s route' % + (fn, route.name)) + with self.block('type {fn}APIError struct'.format(fn=fn)): + out('dropbox.APIError') + out('EndpointError {err} `json:"error"`'.format(err=err)) + out() + + signature = 'func (dbx *apiImpl) ' + self._generate_route_signature( + namespace, route) + with self.block(signature): + if route.deprecated is not None: + out('log.Printf("WARNING: API `%s` is deprecated")' % fn) + if route.deprecated.by is not None: + out('log.Printf("Use API `%s` instead")' % fmt_var(route.deprecated.by.name)) + out() + + out('cli := dbx.Client') + out() + + self._generate_request(namespace, route) + self._generate_post() + self._generate_response(route) + ok_check = 'if resp.StatusCode == http.StatusOK' + if fn == "Download": + ok_check += ' || resp.StatusCode == http.StatusPartialContent' + with self.block(ok_check): + self._generate_result(route) + self._generate_error_handling(route) + + out() + + def _generate_request(self, namespace, route): + out = self.emit + auth = route.attrs.get('auth', '') + host = route.attrs.get('host', 'api') + style = route.attrs.get('style', 'rpc') + + body = 'nil' + if not is_void_type(route.arg_data_type): + out('dbx.Config.TryLog("arg: %v", arg)') + + out('b, err := json.Marshal(arg)') + with self.block('if err != nil'): + out('return') + out() + if host != 'content': + body = 'bytes.NewReader(b)' + if style == 'upload': + body = 'content' + + headers = {} + if not is_void_type(route.arg_data_type): + if host == 'content': + headers["Dropbox-API-Arg"] = "string(b)" + else: + headers["Content-Type"] = '"application/json"' + if style == 'upload': + headers["Content-Type"] = '"application/octet-stream"' + + out('headers := map[string]string{') + for k, v in sorted(headers.items()): + out('\t"{}": {},'.format(k, v)) + out('}') + if fmt_var(route.name) == "Download": + out('for k, v := range arg.ExtraHeaders { headers[k] = v }') + if auth != 'noauth' and auth != 'team': + with self.block('if dbx.Config.AsMemberID != ""'): + out('headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID') + out() + + authed = 'false' if auth == 'noauth' else 'true' + out('req, err := (*dropbox.Context)(dbx).NewRequest("{}", "{}", {}, "{}", "{}", headers, {})'.format( + host, style, authed, namespace.name, route.name, body)) + with self.block('if err != nil'): + out('return') + + out('dbx.Config.TryLog("req: %v", req)') + + out() + + def _generate_post(self): + out = self.emit + + out('resp, err := cli.Do(req)') + + with self.block('if err != nil'): + out('return') + out() + + out('dbx.Config.TryLog("resp: %v", resp)') + + def _generate_response(self, route): + out = self.emit + style = route.attrs.get('style', 'rpc') + if style == 'download': + out('body := []byte(resp.Header.Get("Dropbox-API-Result"))') + out('content = resp.Body') + else: + out('defer resp.Body.Close()') + with self.block('body, err := ioutil.ReadAll(resp.Body);' + 'if err != nil'): + out('return') + out() + + out('dbx.Config.TryLog("body: %v", body)') + + def _generate_error_handling(self, route): + out = self.emit + with self.block('if resp.StatusCode == http.StatusConflict'): + out('var apiError %sAPIError' % fmt_var(route.name)) + with self.block('err = json.Unmarshal(body, &apiError);' + 'if err != nil'): + out('return') + out('err = apiError') + out('return') + out('var apiError dropbox.APIError') + with self.block('if resp.StatusCode == http.StatusBadRequest'): + out('apiError.ErrorSummary = string(body)') + out('err = apiError') + out('return') + with self.block('err = json.Unmarshal(body, &apiError);' + 'if err != nil'): + out('return') + out('err = apiError') + out('return') + + def _generate_result(self, route): + out = self.emit + if is_struct_type(route.result_data_type) and \ + route.result_data_type.has_enumerated_subtypes(): + out('var tmp %sUnion' % fmt_var(route.result_data_type.name, export=False)) + with self.block('err = json.Unmarshal(body, &tmp);' + 'if err != nil'): + out('return') + with self.block('switch tmp.Tag'): + for t in route.result_data_type.get_enumerated_subtypes(): + with self.block('case "%s":' % t.name, delim=(None, None)): + self.emit('res = tmp.%s' % fmt_var(t.name)) + elif not is_void_type(route.result_data_type): + with self.block('err = json.Unmarshal(body, &res);' + 'if err != nil'): + out('return') + out() + out('return') diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/go_helpers.py b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/go_helpers.py new file mode 100644 index 000000000..71183e520 --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/go_helpers.py @@ -0,0 +1,142 @@ +from stone.api import (ApiNamespace, ApiRoute) +from stone.data_type import ( + Boolean, + Float32, + Float64, + Int32, + Int64, + String, + Timestamp, + UInt32, + UInt64, + unwrap_nullable, + is_composite_type, + is_list_type, + is_struct_type, + Void, +) +from stone.target import helpers + +HEADER = """\ +// Copyright (c) Dropbox, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +""" + +_reserved_keywords = { + 'break', 'default', 'func', 'interface', 'select', + 'case', 'defer', 'go', 'map', 'struct', + 'chan', 'else', 'goto', 'package', 'switch', + 'const', 'fallthrough', 'if', 'range', 'type', + 'continue', 'for', 'import', 'return', 'var', +} + +_type_table = { + UInt64: 'uint64', + Int64: 'int64', + UInt32: 'uint32', + Int32: 'int32', + Float64: 'float64', + Float32: 'float32', + Boolean: 'bool', + String: 'string', + Timestamp: 'time.Time', + Void: 'struct{}', +} + + +def _rename_if_reserved(s): + if s in _reserved_keywords: + return s + '_' + else: + return s + + +def fmt_type(data_type, namespace=None, use_interface=False): + data_type, nullable = unwrap_nullable(data_type) + if is_list_type(data_type): + return '[]%s' % fmt_type(data_type.data_type, namespace, use_interface) + type_name = data_type.name + if use_interface and _needs_base_type(data_type): + type_name = 'Is' + type_name + if is_composite_type(data_type) and namespace is not None and \ + namespace.name != data_type.namespace.name: + type_name = data_type.namespace.name + '.' + type_name + if use_interface and _needs_base_type(data_type): + return _type_table.get(data_type.__class__, type_name) + else: + return _type_table.get(data_type.__class__, '*' + type_name) + + +def fmt_var(name, export=True, check_reserved=False): + s = helpers.fmt_pascal(name) if export else helpers.fmt_camel(name) + return _rename_if_reserved(s) if check_reserved else s + + +def _doc_handler(tag, val): + if tag == 'type': + return '`{}`'.format(val) + elif tag == 'route': + return '`{}`'.format(helpers.fmt_camel(val)) + elif tag == 'link': + anchor, link = val.rsplit(' ', 1) + return '`{}` <{}>'.format(anchor, link) + elif tag == 'val': + if val == 'null': + return 'nil' + else: + return val + elif tag == 'field': + return '`{}`'.format(val) + else: + raise RuntimeError('Unknown doc ref tag %r' % tag) + + +def generate_doc(code_generator, t): + doc = t.doc + if doc is None: + doc = 'has no documentation (yet)' + doc = code_generator.process_doc(doc, _doc_handler) + d = '%s : %s' % (fmt_var(t.name), doc) + if isinstance(t, ApiNamespace): + d = 'Package %s : %s' % (t.name, doc) + code_generator.emit_wrapped_text(d, prefix='// ') + + # Generate comment for deprecated routes + if isinstance(t, ApiRoute): + if t.deprecated is not None: + d = 'Deprecated: ' + if t.deprecated.by is not None: + d += 'Use `%s` instead' % fmt_var(t.deprecated.by.name) + code_generator.emit_wrapped_text(d, prefix='// ') + + +def _needs_base_type(data_type): + if is_struct_type(data_type) and data_type.has_enumerated_subtypes(): + return True + if is_list_type(data_type): + return _needs_base_type(data_type.data_type) + return False + + +def needs_base_type(struct): + for field in struct.fields: + if _needs_base_type(field.data_type): + return True + return False diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/go_rsrc/files/metadata.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/go_rsrc/files/metadata.go new file mode 100644 index 000000000..d2346b4f5 --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/go_rsrc/files/metadata.go @@ -0,0 +1,99 @@ +// Copyright (c) Dropbox, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package files + +import "encoding/json" + +type listFolderResult struct { + Entries []metadataUnion `json:"entries"` + Cursor string `json:"cursor"` + HasMore bool `json:"has_more"` +} + +// UnmarshalJSON deserializes into a ListFolderResult instance +func (r *ListFolderResult) UnmarshalJSON(b []byte) error { + var l listFolderResult + if err := json.Unmarshal(b, &l); err != nil { + return err + } + r.Cursor = l.Cursor + r.HasMore = l.HasMore + r.Entries = make([]IsMetadata, len(l.Entries)) + for i, e := range l.Entries { + switch e.Tag { + case "file": + r.Entries[i] = e.File + case "folder": + r.Entries[i] = e.Folder + case "deleted": + r.Entries[i] = e.Deleted + } + } + return nil +} + +type searchMatch struct { + MatchType *SearchMatchType `json:"match_type"` + Metadata metadataUnion `json:"metadata"` +} + +// UnmarshalJSON deserializes into a SearchMatch instance +func (s *SearchMatch) UnmarshalJSON(b []byte) error { + var m searchMatch + if err := json.Unmarshal(b, &m); err != nil { + return err + } + s.MatchType = m.MatchType + e := m.Metadata + switch e.Tag { + case "file": + s.Metadata = e.File + case "folder": + s.Metadata = e.Folder + case "deleted": + s.Metadata = e.Deleted + } + return nil +} + +type deleteResult struct { + FileOpsResult + Metadata metadataUnion `json:"metadata"` +} + +// UnmarshalJSON deserializes into a SearchMatch instance +func (s *DeleteResult) UnmarshalJSON(b []byte) error { + var m deleteResult + if err := json.Unmarshal(b, &m); err != nil { + return err + } + s.FileOpsResult = m.FileOpsResult + e := m.Metadata + switch e.Tag { + case "file": + s.Metadata = e.File + case "folder": + s.Metadata = e.Folder + case "deleted": + s.Metadata = e.Deleted + } + return nil +} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/go_rsrc/sdk.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/go_rsrc/sdk.go new file mode 100644 index 000000000..4a37ba82f --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/go_rsrc/sdk.go @@ -0,0 +1,186 @@ +// Copyright (c) Dropbox, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package dropbox + +import ( + "fmt" + "io" + "log" + "net/http" + + "golang.org/x/oauth2" +) + +const ( + apiVersion = 2 + defaultDomain = ".dropboxapi.com" + hostAPI = "api" + hostContent = "content" + hostNotify = "notify" + sdkVersion = "UNKNOWN SDK VERSION" + specVersion = "UNKNOWN SPEC VERSION" +) + +// Version returns the current SDK version and API Spec version +func Version() (string, string) { + return sdkVersion, specVersion +} + +// Config contains parameters for configuring the SDK. +type Config struct { + // OAuth2 access token + Token string + // Enable verbose logging in SDK + Verbose bool + // Logging target for verbose SDK logging + Logger *log.Logger + // Used with APIs that support operations as another user + AsMemberID string + // No need to set -- for testing only + Domain string + // No need to set -- for testing only + Client *http.Client + // No need to set -- for testing only + HeaderGenerator func(hostType string, style string, namespace string, route string) map[string]string + // No need to set -- for testing only + 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 { + return + } + if c.Logger != nil { + c.Logger.Printf(format, v...) + } else { + log.Printf(format, v...) + } +} + +// Context is the base client context used to implement per-namespace clients. +type Context struct { + Config Config + Client *http.Client + HeaderGenerator func(hostType string, style string, namespace string, route string) map[string]string + URLGenerator func(hostType string, style string, namespace string, route string) string +} + +// NewRequest returns an appropriate Request object for the given namespace/route. +func (c *Context) NewRequest( + hostType string, + style string, + authed bool, + namespace string, + route string, + headers map[string]string, + body io.Reader, +) (*http.Request, error) { + url := c.URLGenerator(hostType, style, namespace, route) + req, err := http.NewRequest("POST", url, body) + if err != nil { + return nil, err + } + for k, v := range headers { + req.Header.Add(k, v) + } + for k, v := range c.HeaderGenerator(hostType, style, namespace, route) { + req.Header.Add(k, v) + } + if req.Header.Get("Host") != "" { + req.Host = req.Header.Get("Host") + } + if !authed { + req.Header.Del("Authorization") + } + return req, nil +} + +// NewContext returns a new Context with the given Config. +func NewContext(c Config) Context { + domain := c.Domain + if domain == "" { + domain = defaultDomain + } + + client := c.Client + if client == nil { + var conf = &oauth2.Config{Endpoint: OAuthEndpoint(domain)} + tok := &oauth2.Token{AccessToken: c.Token} + client = conf.Client(oauth2.NoContext, tok) + } + + headerGenerator := c.HeaderGenerator + if headerGenerator == nil { + headerGenerator = func(hostType string, style string, namespace string, route string) map[string]string { + return map[string]string{} + } + } + + urlGenerator := c.URLGenerator + if urlGenerator == nil { + hostMap := map[string]string{ + hostAPI: hostAPI + domain, + hostContent: hostContent + domain, + hostNotify: hostNotify + domain, + } + urlGenerator = func(hostType string, style string, namespace string, route string) string { + fqHost := hostMap[hostType] + return fmt.Sprintf("https://%s/%d/%s/%s", fqHost, apiVersion, namespace, route) + } + } + + return Context{c, client, headerGenerator, urlGenerator} +} + +// OAuthEndpoint constructs an `oauth2.Endpoint` for the given domain +func OAuthEndpoint(domain string) oauth2.Endpoint { + if domain == "" { + domain = defaultDomain + } + authURL := fmt.Sprintf("https://meta%s/1/oauth2/authorize", domain) + tokenURL := fmt.Sprintf("https://api%s/1/oauth2/token", domain) + if domain == defaultDomain { + authURL = "https://www.dropbox.com/1/oauth2/authorize" + } + return oauth2.Endpoint{AuthURL: authURL, TokenURL: tokenURL} +} + +// Tagged is used for tagged unions. +type Tagged struct { + Tag string `json:".tag"` +} + +// APIError is the base type for endpoint-specific errors. +type APIError struct { + ErrorSummary string `json:"error_summary"` +} + +func (e APIError) Error() string { + return e.ErrorSummary +} + +func init() { + // These are not registered in the oauth library by default + oauth2.RegisterBrokenAuthHeaderProvider("https://api.dropboxapi.com") + oauth2.RegisterBrokenAuthHeaderProvider("https://api-dbdev.dev.corp.dropbox.com") +} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/go_rsrc/sharing/metadata.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/go_rsrc/sharing/metadata.go new file mode 100644 index 000000000..9d70db8b6 --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/go_rsrc/sharing/metadata.go @@ -0,0 +1,49 @@ +// Copyright (c) Dropbox, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package sharing + +import "encoding/json" + +type listSharedLinksResult struct { + Links []sharedLinkMetadataUnion `json:"links"` + HasMore bool `json:"has_more"` + Cursor string `json:"cursor,omitempty"` +} + +// UnmarshalJSON deserializes into a ListSharedLinksResult instance +func (r *ListSharedLinksResult) UnmarshalJSON(b []byte) error { + var l listSharedLinksResult + if err := json.Unmarshal(b, &l); err != nil { + return err + } + r.Cursor = l.Cursor + r.HasMore = l.HasMore + r.Links = make([]IsSharedLinkMetadata, len(l.Links)) + for i, e := range l.Links { + switch e.Tag { + case "file": + r.Links[i] = e.File + case "folder": + r.Links[i] = e.Folder + } + } + return nil +} diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/go_types.stoneg.py b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/go_types.stoneg.py new file mode 100644 index 000000000..d00443c84 --- /dev/null +++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/generator/go_types.stoneg.py @@ -0,0 +1,198 @@ +import os +import shutil + +from stone.generator import CodeGenerator +from stone.data_type import ( + is_boolean_type, + is_nullable_type, + is_primitive_type, + is_struct_type, + is_union_type, + is_void_type, +) + +from go_helpers import ( + HEADER, + fmt_type, + fmt_var, + generate_doc, +) + + +class GoTypesGenerator(CodeGenerator): + def generate(self, api): + rsrc_folder = os.path.join(os.path.dirname(__file__), 'go_rsrc') + shutil.copy(os.path.join(rsrc_folder, 'sdk.go'), + self.target_folder_path) + for namespace in api.namespaces.values(): + self._generate_namespace(namespace) + if namespace.name == 'files' or namespace.name == 'sharing': + self.logger.info('Copying metadata.go to files') + shutil.copy(os.path.join(rsrc_folder, namespace.name, 'metadata.go'), + os.path.join(self.target_folder_path, namespace.name)) + + def _generate_namespace(self, namespace): + file_name = os.path.join(self.target_folder_path, namespace.name, + 'types.go') + with self.output_to_relative_path(file_name): + self.emit_raw(HEADER) + self.emit() + generate_doc(self, namespace) + self.emit('package %s' % namespace.name) + self.emit() + + for data_type in namespace.linearize_data_types(): + self._generate_data_type(data_type) + + def _generate_data_type(self, data_type): + generate_doc(self, data_type) + if is_struct_type(data_type): + self._generate_struct(data_type) + if data_type.has_enumerated_subtypes(): + self._generate_base_type(data_type) + elif is_union_type(data_type): + self._generate_union(data_type) + else: + self.logger.info("Unhandled data type", data_type) + + def _generate_base_type(self, base): + t = fmt_type(base).lstrip('*') + self.emit('// Is{0} is the interface type for {0} and its subtypes'.format(t)) + with self.block('type Is%s interface' % t): + self.emit('Is%s()' % t) + self.emit() + self.emit('// Is{0} implements the Is{0} interface'.format(t)) + self.emit("func (u *{0}) Is{0}() {{}}".format(t)) + self.emit() + self._generate_union_helper(base) + + self.emit("// Is{0}FromJSON converts JSON to a concrete Is{0} instance".format(t)) + with self.block("func Is{0}FromJSON(data []byte) (Is{0}, error)".format(t)): + name = fmt_var(t, export=False) + 'Union' + self.emit("var t {0}".format(name)) + with self.block("if err := json.Unmarshal(data, &t); err != nil"): + self.emit("return nil, err") + with self.block("switch t.Tag"): + fields = base.get_enumerated_subtypes() + for field in fields: + with self.block('case "%s":' % field.name, delim=(None, None)): + self.emit("return t.{0}, nil".format(fmt_var(field.name))) + # FIX THIS + self.emit("return nil, nil") + + def _generate_struct(self, struct): + with self.block('type %s struct' % struct.name): + if struct.parent_type: + self.emit(fmt_type(struct.parent_type, struct.namespace).lstrip('*')) + for field in struct.fields: + self._generate_field(field, namespace=struct.namespace) + if struct.name in ('DownloadArg',): + self.emit('// ExtraHeaders can be used to pass Range, If-None-Match headers') + self.emit('ExtraHeaders map[string]string `json:"-"`') + self._generate_struct_builder(struct) + + def _generate_struct_builder(self, struct): + fields = ["%s %s" % (fmt_var(field.name), + fmt_type(field.data_type, struct.namespace, + use_interface=True)) + for field in struct.all_required_fields] + self.emit('// New{0} returns a new {0} instance'.format(struct.name)) + signature = "func New{0}({1}) *{0}".format(struct.name, ', '.join(fields)) + with self.block(signature): + self.emit('s := new({0})'.format(struct.name)) + for field in struct.all_required_fields: + field_name = fmt_var(field.name) + self.emit("s.{0} = {0}".format(field_name)) + + for field in struct.all_optional_fields: + if field.has_default: + if is_primitive_type(field.data_type): + default = field.default + if is_boolean_type(field.data_type): + default = str(default).lower() + self.emit('s.{0} = {1}'.format(fmt_var(field.name), default)) + elif is_union_type(field.data_type): + self.emit('s.%s = &%s{Tagged:dropbox.Tagged{"%s"}}' % + (fmt_var(field.name), + fmt_type(field.data_type, struct.namespace).lstrip('*'), + field.default.tag_name)) + self.emit('return s') + self.emit() + + def _generate_field(self, field, union_field=False, namespace=None, raw=False): + generate_doc(self, field) + field_name = fmt_var(field.name) + type_name = fmt_type(field.data_type, namespace, use_interface=True) + json_tag = '`json:"%s"`' % field.name + if is_nullable_type(field.data_type) or union_field: + json_tag = '`json:"%s,omitempty"`' % field.name + if raw: + self.emit('%s json.RawMessage %s' % (field_name, json_tag)) + else: + self.emit('%s %s %s' % (field_name, type_name, json_tag)) + + def _generate_union(self, union): + self._generate_union_helper(union) + + def _generate_union_helper(self, u): + name = u.name + namespace = u.namespace + fields = u.fields + if is_struct_type(u) and u.has_enumerated_subtypes(): + name = fmt_var(name, export=False) + 'Union' + fields = u.get_enumerated_subtypes() + + with self.block('type %s struct' % name): + self.emit('dropbox.Tagged') + for field in fields: + if is_void_type(field.data_type): + continue + self._generate_field(field, union_field=True, + namespace=namespace) + self.emit() + self.emit('// Valid tag values for %s' % fmt_var(u.name)) + with self.block('const', delim=('(', ')')): + for field in fields: + self.emit('%s%s = "%s"' % (fmt_var(u.name), fmt_var(field.name), field.name)) + self.emit() + + num_void_fields = sum([is_void_type(f.data_type) for f in fields]) + # Simple structure, no need in UnmarshalJSON + if len(fields) == num_void_fields: + return + + self.emit('// UnmarshalJSON deserializes into a %s instance' % name) + with self.block('func (u *%s) UnmarshalJSON(body []byte) error' % name): + with self.block('type wrap struct'): + self.emit('dropbox.Tagged') + for field in fields: + if is_void_type(field.data_type) or \ + is_primitive_type(field.data_type): + continue + self._generate_field(field, union_field=True, + namespace=namespace, raw=True) + self.emit('var w wrap') + self.emit('var err error') + with self.block('if err = json.Unmarshal(body, &w); err != nil'): + self.emit('return err') + self.emit('u.Tag = w.Tag') + with self.block('switch u.Tag'): + for field in fields: + if is_void_type(field.data_type): + continue + field_name = fmt_var(field.name) + with self.block('case "%s":' % field.name, delim=(None, None)): + if is_union_type(field.data_type): + self.emit('err = json.Unmarshal(w.{0}, &u.{0})' + .format(field_name)) + elif is_struct_type(field.data_type) and \ + field.data_type.has_enumerated_subtypes(): + self.emit("u.{0}, err = Is{1}FromJSON(body)" + .format(field_name, field.data_type.name)) + else: + self.emit('err = json.Unmarshal(body, &u.{0})' + .format(field_name)) + with self.block("if err != nil"): + self.emit("return err") + self.emit('return nil') + self.emit()