2121// Package auth : has no documentation (yet)
2222package auth
2323
24- import "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox"
24+ import (
25+ "encoding/json"
26+
27+ "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox"
28+ )
29+
30+ // AccessError : Error occurred because the account doesn't have permission to
31+ // access the resource.
32+ type AccessError struct {
33+ dropbox.Tagged
34+ // InvalidAccountType : Current account type cannot access the resource.
35+ InvalidAccountType * InvalidAccountTypeError `json:"invalid_account_type,omitempty"`
36+ // PaperAccessDenied : Current account cannot access Paper.
37+ PaperAccessDenied * PaperAccessError `json:"paper_access_denied,omitempty"`
38+ }
39+
40+ // Valid tag values for AccessError
41+ const (
42+ AccessErrorInvalidAccountType = "invalid_account_type"
43+ AccessErrorPaperAccessDenied = "paper_access_denied"
44+ AccessErrorOther = "other"
45+ )
46+
47+ // UnmarshalJSON deserializes into a AccessError instance
48+ func (u * AccessError ) UnmarshalJSON (body []byte ) error {
49+ type wrap struct {
50+ dropbox.Tagged
51+ // InvalidAccountType : Current account type cannot access the resource.
52+ InvalidAccountType json.RawMessage `json:"invalid_account_type,omitempty"`
53+ // PaperAccessDenied : Current account cannot access Paper.
54+ PaperAccessDenied json.RawMessage `json:"paper_access_denied,omitempty"`
55+ }
56+ var w wrap
57+ if err := json .Unmarshal (body , & w ); err != nil {
58+ return err
59+ }
60+ u .Tag = w .Tag
61+ switch u .Tag {
62+ case "invalid_account_type" :
63+ if err := json .Unmarshal (w .InvalidAccountType , & u .InvalidAccountType ); err != nil {
64+ return err
65+ }
66+
67+ case "paper_access_denied" :
68+ if err := json .Unmarshal (w .PaperAccessDenied , & u .PaperAccessDenied ); err != nil {
69+ return err
70+ }
71+
72+ }
73+ return nil
74+ }
2575
2676// AuthError : Errors occurred during authentication.
2777type AuthError struct {
@@ -37,6 +87,30 @@ const (
3787 AuthErrorOther = "other"
3888)
3989
90+ // InvalidAccountTypeError : has no documentation (yet)
91+ type InvalidAccountTypeError struct {
92+ dropbox.Tagged
93+ }
94+
95+ // Valid tag values for InvalidAccountTypeError
96+ const (
97+ InvalidAccountTypeErrorEndpoint = "endpoint"
98+ InvalidAccountTypeErrorFeature = "feature"
99+ InvalidAccountTypeErrorOther = "other"
100+ )
101+
102+ // PaperAccessError : has no documentation (yet)
103+ type PaperAccessError struct {
104+ dropbox.Tagged
105+ }
106+
107+ // Valid tag values for PaperAccessError
108+ const (
109+ PaperAccessErrorPaperDisabled = "paper_disabled"
110+ PaperAccessErrorNotPaperUser = "not_paper_user"
111+ PaperAccessErrorOther = "other"
112+ )
113+
40114// RateLimitError : Error occurred because the app is being rate limited.
41115type RateLimitError struct {
42116 // Reason : The reason why the app is being rate limited.
@@ -65,3 +139,46 @@ const (
65139 RateLimitReasonTooManyWriteOperations = "too_many_write_operations"
66140 RateLimitReasonOther = "other"
67141)
142+
143+ // TokenFromOAuth1Arg : has no documentation (yet)
144+ type TokenFromOAuth1Arg struct {
145+ // Oauth1Token : The supplied OAuth 1.0 access token.
146+ Oauth1Token string `json:"oauth1_token"`
147+ // Oauth1TokenSecret : The token secret associated with the supplied access
148+ // token.
149+ Oauth1TokenSecret string `json:"oauth1_token_secret"`
150+ }
151+
152+ // NewTokenFromOAuth1Arg returns a new TokenFromOAuth1Arg instance
153+ func NewTokenFromOAuth1Arg (Oauth1Token string , Oauth1TokenSecret string ) * TokenFromOAuth1Arg {
154+ s := new (TokenFromOAuth1Arg )
155+ s .Oauth1Token = Oauth1Token
156+ s .Oauth1TokenSecret = Oauth1TokenSecret
157+ return s
158+ }
159+
160+ // TokenFromOAuth1Error : has no documentation (yet)
161+ type TokenFromOAuth1Error struct {
162+ dropbox.Tagged
163+ }
164+
165+ // Valid tag values for TokenFromOAuth1Error
166+ const (
167+ TokenFromOAuth1ErrorInvalidOauth1TokenInfo = "invalid_oauth1_token_info"
168+ TokenFromOAuth1ErrorAppIdMismatch = "app_id_mismatch"
169+ TokenFromOAuth1ErrorOther = "other"
170+ )
171+
172+ // TokenFromOAuth1Result : has no documentation (yet)
173+ type TokenFromOAuth1Result struct {
174+ // Oauth2Token : The OAuth 2.0 token generated from the supplied OAuth 1.0
175+ // token.
176+ Oauth2Token string `json:"oauth2_token"`
177+ }
178+
179+ // NewTokenFromOAuth1Result returns a new TokenFromOAuth1Result instance
180+ func NewTokenFromOAuth1Result (Oauth2Token string ) * TokenFromOAuth1Result {
181+ s := new (TokenFromOAuth1Result )
182+ s .Oauth2Token = Oauth2Token
183+ return s
184+ }
0 commit comments