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.18.0
, write CHANGELOG.md
- Loading branch information
1 parent
283a619
commit 53815ae
Showing
3 changed files
with
7 additions
and
46 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,45 +1,6 @@ | ||
## Changelog for v0.17.0 | ||
## Changelog for v0.18.0 | ||
|
||
- 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()) | ||
} | ||
} | ||
``` | ||
- Fixed all known typos in the codebase | ||
- This release is required because some typos were located inside error "`ENUMS`" | ||
- This is a significant change and should be made public. | ||
- Because of the above facts, this release exists |
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.17.0 | ||
version := 0.18.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.17.0" | ||
const Version = "0.18.0" | ||
|
||
// Specifies the oldest Smarthome version this SDK can connect to | ||
const MinSmarthomeVersion = "0.0.54" |