Skip to content

Commit 475ca83

Browse files
author
Diwaker Gupta
committed
Add versioning to the SDK.
1 parent 13ed6f0 commit 475ca83

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

dropbox/sdk.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,15 @@ const (
3333
hostAPI = "api"
3434
hostContent = "content"
3535
hostNotify = "notify"
36+
sdkVersion = "1.0.0-beta"
37+
specVersion = "0697bd2"
3638
)
3739

40+
// Version returns the current SDK version and API Spec version
41+
func Version() (sdkVersion, specVersion string) {
42+
return sdkVersion, specVersion
43+
}
44+
3845
// Config contains parameters for configuring the SDK.
3946
type Config struct {
4047
Token string

generator/generate-sdk.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,12 @@ gen_dir=$(dirname ${base_dir})/dropbox
1414
stone -v -a :all go_types.stoneg.py "$gen_dir" "$spec_dir"/*.stone
1515
stone -v -a :all go_client.stoneg.py "$gen_dir" "$spec_dir"/*.stone
1616

17+
# Update SDK and API spec versions
18+
sdk_version="1.0.0-beta"
19+
pushd ${spec_dir}
20+
spec_version=$(git rev-parse --short HEAD)
21+
popd
22+
23+
sed -i '' -e "s/UNKNOWN SDK VERSION/${sdk_version}/" \
24+
-e "s/UNKNOWN SPEC VERSION/${spec_version}/" ${gen_dir}/sdk.go
1725
goimports -l -w ${gen_dir}

generator/go_client.stoneg.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ def _generate_request(self, namespace, route):
104104
out('return')
105105
out()
106106
if host != 'content':
107-
print(host, namespace.name, route.name)
108107
body = 'bytes.NewReader(b)'
109108
if style == 'upload':
110109
body = 'content'

generator/go_rsrc/sdk.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,15 @@ const (
3333
hostAPI = "api"
3434
hostContent = "content"
3535
hostNotify = "notify"
36+
sdkVersion = "UNKNOWN SDK VERSION"
37+
specVersion = "UNKNOWN SPEC VERSION"
3638
)
3739

40+
// Version returns the current SDK version and API Spec version
41+
func Version() (sdkVersion, specVersion string) {
42+
return sdkVersion, specVersion
43+
}
44+
3845
// Config contains parameters for configuring the SDK.
3946
type Config struct {
4047
Token string

0 commit comments

Comments
 (0)