Skip to content

Commit 160b787

Browse files
author
Diwaker Gupta
committed
Update generator to emit string consts for union tags.
Also simplify helper for generating union code.
1 parent 64af361 commit 160b787

File tree

11 files changed

+1098
-6
lines changed

11 files changed

+1098
-6
lines changed

dropbox/async/types.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ type LaunchResultBase struct {
3737
AsyncJobId string `json:"async_job_id,omitempty"`
3838
}
3939

40+
const (
41+
LaunchResultBase_AsyncJobId = "async_job_id"
42+
)
43+
4044
func (u *LaunchResultBase) UnmarshalJSON(body []byte) error {
4145
type wrap struct {
4246
dropbox.Tagged
@@ -63,6 +67,10 @@ type LaunchEmptyResult struct {
6367
dropbox.Tagged
6468
}
6569

70+
const (
71+
LaunchEmptyResult_Complete = "complete"
72+
)
73+
6674
// Arguments for methods that poll the status of an asynchronous job.
6775
type PollArg struct {
6876
// Id of the asynchronous job. This is the value of a response returned from
@@ -84,13 +92,27 @@ type PollResultBase struct {
8492
dropbox.Tagged
8593
}
8694

95+
const (
96+
PollResultBase_InProgress = "in_progress"
97+
)
98+
8799
// Result returned by methods that poll for the status of an asynchronous job.
88100
// Upon completion of the job, no additional information is returned.
89101
type PollEmptyResult struct {
90102
dropbox.Tagged
91103
}
92104

105+
const (
106+
PollEmptyResult_Complete = "complete"
107+
)
108+
93109
// Error returned by methods for polling the status of asynchronous job.
94110
type PollError struct {
95111
dropbox.Tagged
96112
}
113+
114+
const (
115+
PollError_InvalidAsyncJobId = "invalid_async_job_id"
116+
PollError_InternalError = "internal_error"
117+
PollError_Other = "other"
118+
)

dropbox/auth/types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,10 @@ import "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox"
2626
type AuthError struct {
2727
dropbox.Tagged
2828
}
29+
30+
const (
31+
AuthError_InvalidAccessToken = "invalid_access_token"
32+
AuthError_InvalidSelectUser = "invalid_select_user"
33+
AuthError_InvalidSelectAdmin = "invalid_select_admin"
34+
AuthError_Other = "other"
35+
)

0 commit comments

Comments
 (0)