Skip to content

Commit af4558f

Browse files
author
Diwaker Gupta
committed
Invoke correct method for versioned routes.
Fixes #49. Refs #50.
1 parent dd3c8f5 commit af4558f

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

dropbox/files/client.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ func (dbx *apiImpl) CopyV2(arg *RelocationArg) (res *RelocationResult, err error
549549
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
550550
}
551551

552-
req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "copy", headers, bytes.NewReader(b))
552+
req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "copy_v2", headers, bytes.NewReader(b))
553553
if err != nil {
554554
return
555555
}
@@ -695,7 +695,7 @@ func (dbx *apiImpl) CopyBatchV2(arg *RelocationBatchArgBase) (res *RelocationBat
695695
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
696696
}
697697

698-
req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "copy_batch", headers, bytes.NewReader(b))
698+
req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "copy_batch_v2", headers, bytes.NewReader(b))
699699
if err != nil {
700700
return
701701
}
@@ -830,7 +830,7 @@ func (dbx *apiImpl) CopyBatchCheckV2(arg *async.PollArg) (res *RelocationBatchV2
830830
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
831831
}
832832

833-
req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "copy_batch/check", headers, bytes.NewReader(b))
833+
req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "copy_batch/check_v2", headers, bytes.NewReader(b))
834834
if err != nil {
835835
return
836836
}
@@ -1097,7 +1097,7 @@ func (dbx *apiImpl) CreateFolderV2(arg *CreateFolderArg) (res *CreateFolderResul
10971097
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
10981098
}
10991099

1100-
req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "create_folder", headers, bytes.NewReader(b))
1100+
req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "create_folder_v2", headers, bytes.NewReader(b))
11011101
if err != nil {
11021102
return
11031103
}
@@ -1364,7 +1364,7 @@ func (dbx *apiImpl) DeleteV2(arg *DeleteArg) (res *DeleteResult, err error) {
13641364
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
13651365
}
13661366

1367-
req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "delete", headers, bytes.NewReader(b))
1367+
req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "delete_v2", headers, bytes.NewReader(b))
13681368
if err != nil {
13691369
return
13701370
}
@@ -2515,7 +2515,7 @@ func (dbx *apiImpl) MoveV2(arg *RelocationArg) (res *RelocationResult, err error
25152515
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
25162516
}
25172517

2518-
req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "move", headers, bytes.NewReader(b))
2518+
req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "move_v2", headers, bytes.NewReader(b))
25192519
if err != nil {
25202520
return
25212521
}
@@ -2661,7 +2661,7 @@ func (dbx *apiImpl) MoveBatchV2(arg *MoveBatchArg) (res *RelocationBatchV2Launch
26612661
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
26622662
}
26632663

2664-
req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "move_batch", headers, bytes.NewReader(b))
2664+
req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "move_batch_v2", headers, bytes.NewReader(b))
26652665
if err != nil {
26662666
return
26672667
}
@@ -2793,7 +2793,7 @@ func (dbx *apiImpl) MoveBatchCheckV2(arg *async.PollArg) (res *RelocationBatchV2
27932793
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
27942794
}
27952795

2796-
req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "move_batch/check", headers, bytes.NewReader(b))
2796+
req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "move_batch/check_v2", headers, bytes.NewReader(b))
27972797
if err != nil {
27982798
return
27992799
}
@@ -3698,7 +3698,7 @@ func (dbx *apiImpl) UploadSessionAppendV2(arg *UploadSessionAppendArg, content i
36983698
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
36993699
}
37003700

3701-
req, err := (*dropbox.Context)(dbx).NewRequest("content", "upload", true, "files", "upload_session/append", headers, content)
3701+
req, err := (*dropbox.Context)(dbx).NewRequest("content", "upload", true, "files", "upload_session/append_v2", headers, content)
37023702
if err != nil {
37033703
return
37043704
}

dropbox/sdk.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const (
3737
hostAPI = "api"
3838
hostContent = "content"
3939
hostNotify = "notify"
40-
sdkVersion = "5.3.0"
40+
sdkVersion = "5.4.0"
4141
specVersion = "097e9ba"
4242
)
4343

generator/go_client.stoneg.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,12 @@ def _generate_request(self, namespace, route):
142142
out('headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID')
143143
out()
144144

145+
fn = route.name
146+
if route.version != 1:
147+
fn += '_v%d' % route.version
145148
authed = 'false' if auth == 'noauth' else 'true'
146149
out('req, err := (*dropbox.Context)(dbx).NewRequest("{}", "{}", {}, "{}", "{}", headers, {})'.format(
147-
host, style, authed, namespace.name, route.name, body))
150+
host, style, authed, namespace.name, fn, body))
148151
with self.block('if err != nil'):
149152
out('return')
150153

0 commit comments

Comments
 (0)