This repository has been archived by the owner on Oct 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump version to
0.17.0
, write CHANGELOG.md
- Loading branch information
1 parent
dc090b8
commit 65542d2
Showing
3 changed files
with
47 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,45 @@ | ||
## Changelog for v0.16.0 | ||
## Changelog for v0.17.0 | ||
|
||
- Added HMS job count to debug info | ||
- Added support for `token` authentication | ||
- Completely refactored the way login and connection works | ||
- Now compatible with Smarthome user authentication tokens and server version `0.0.54` | ||
|
||
### Example Code | ||
This code demonstrates the use and difference of the new authentication methods | ||
```go | ||
package main | ||
|
||
import "github.com/smarthome-go/sdk" | ||
|
||
const URL = "http://localhost:8082" | ||
|
||
func main() { | ||
// === Example 1: Using token authentication === // | ||
c1, err := sdk.NewConnection(URL, sdk.AuthMethodQueryToken /* sdk.AuthMethodCookieToken */) | ||
if err != nil { | ||
panic(err.Error()) | ||
} | ||
// Login with your user authentication token, to obtain one, visit `http://your-smarthome.box/profile` | ||
if err := c1.TokenLogin("650feaafc1487d18bd8c5a805363be96"); err != nil { | ||
panic(err.Error()) | ||
} | ||
|
||
// === Example 2: Using username & password authentication === // | ||
c2, err := sdk.NewConnection(URL, sdk.AuthMethodQueryPassword /* sdk.AuthMethodCookiePassword */) | ||
if err != nil { | ||
panic(err.Error()) | ||
} | ||
// Login with the usual username-password combination | ||
if err := c1.UserLogin("admin", "admin"); err != nil { | ||
panic(err.Error()) | ||
} | ||
|
||
// => After login, each connection behaves idenically | ||
if err := c1.SetPower("s2", true); err != nil { | ||
panic(err.Error()) | ||
} | ||
if err := c2.SetPower("s2", true); err != nil { | ||
panic(err.Error()) | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
version := 0.16.0 | ||
version := 0.17.0 | ||
|
||
test: | ||
go test -v -race . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package sdk | ||
|
||
// Specifies the SDK version | ||
const Version = "0.16.0" | ||
const Version = "0.17.0" | ||
|
||
// Specifies the oldest Smarthome version this SDK can connect to | ||
const MinSmarthomeVersion = "0.0.50" | ||
const MinSmarthomeVersion = "0.0.54" |