Mainflux.mainflux/sdk/go
Dušan Borovčanin 9f37927dec MF-932 - User API keys (#941)
* Add inital Auth implementation

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Extract IssuedAt on transport layer

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Add token type

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Fix Auth service URL in Things service

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Add User Keys revocation check

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Update tests

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Remove unused tracing methods

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Fix Key retrival and parsing

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Remove unused code

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Increase test coverage

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Fix compose files

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Fix typos

Simplify tests.

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Fix typos and remove useless comments

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Rename Auth to Authn

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Rename database.go to tracin.go

A new name (`tracing.go`) describes better the purpose of the file.

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Increase test coverage

Fix typo.

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Increase test coverage

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Remove token from Users service

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Fix identify login keys

Rename token parsing method.

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Extract tokenizer to interface

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Remove pointer time

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Use pointer for expiration time in response

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Use uppercase N

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Remove unnecessary email check

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Cleanup unused code and env vars

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Rename tokenizer field

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Use slices and named fields in test cases

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Update AuthN keys naming

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Remove package-lock.json changes

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Remove Secret from issuing request

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
2019-12-16 16:22:09 +01:00
..
README.md NOISSUE - Refactor SDK and things service (#420) 2018-10-24 10:21:03 +01:00
channels.go MF-484 - Add bulk provisioning for things and channels (#889) 2019-10-29 12:59:54 +01:00
channels_test.go MF-484 - Add bulk provisioning for things and channels (#889) 2019-10-29 12:59:54 +01:00
message.go MF-788 - Remove date and minimize copyright comments (#876) 2019-10-07 16:14:47 +02:00
message_test.go MF-788 - Remove date and minimize copyright comments (#876) 2019-10-07 16:14:47 +02:00
responses.go MF-484 - Add bulk provisioning for things and channels (#889) 2019-10-29 12:59:54 +01:00
sdk.go MF-898 - Add bulk connect to CLI and SDK (#956) 2019-11-21 12:29:37 +01:00
things.go MF-898 - Add bulk connect to CLI and SDK (#956) 2019-11-21 12:29:37 +01:00
things_test.go MF-932 - User API keys (#941) 2019-12-16 16:22:09 +01:00
users.go MF-788 - Remove date and minimize copyright comments (#876) 2019-10-07 16:14:47 +02:00
users_test.go MF-932 - User API keys (#941) 2019-12-16 16:22:09 +01:00
version.go MF-788 - Remove date and minimize copyright comments (#876) 2019-10-07 16:14:47 +02:00
version_test.go MF-417 - Implement SDK tests (#438) 2018-11-19 21:27:01 +01:00

README.md

Mainflux Go SDK

Go SDK, a Go driver for Mainflux HTTP API.

Does both system administration (provisioning) and messaging.

Installation

Import "github.com/mainflux/mainflux/sdk/go" in your Go package.

import "github.com/mainflux/mainflux/sdk/go"

Then call SDK Go functions to interact with the system.

API Reference

FUNCTIONS

func NewMfxSDK(host, port string, tls bool) *MfxSDK

func (sdk *MfxSDK) Channel(id, token string) (things.Channel, error)
    Channel - gets channel by ID

func (sdk *MfxSDK) Channels(token string) ([]things.Channel, error)
    Channels - gets all channels

func (sdk *MfxSDK) ConnectThing(thingID, chanID, token string) error
    ConnectThing - connect thing to a channel

func (sdk *MfxSDK) CreateChannel(data, token string) (string, error)
    CreateChannel - creates new channel and generates UUID

func (sdk *MfxSDK) CreateThing(data, token string) (string, error)
    CreateThing - creates new thing and generates thing UUID

func (sdk *MfxSDK) CreateToken(user, pwd string) (string, error)
    CreateToken - create user token

func (sdk *MfxSDK) CreateUser(user, pwd string) error
    CreateUser - create user

func (sdk *MfxSDK) DeleteChannel(id, token string) error
    DeleteChannel - removes channel

func (sdk *MfxSDK) DeleteThing(id, token string) error
    DeleteThing - removes thing

func (sdk *MfxSDK) DisconnectThing(thingID, chanID, token string) error
    DisconnectThing - connect thing to a channel

func (sdk mfSDK) SendMessage(chanID, msg, token string) error
    SendMessage - send message on Mainflux channel

func (sdk mfSDK) SetContentType(ct ContentType) error
    SetContentType - set message content type. Available options are SenML
    JSON, custom JSON and custom binary (octet-stream).

func (sdk mfSDK) Thing(id, token string) (Thing, error)
    Thing - gets thing by ID

func (sdk mfSDK) Things(token string) ([]Thing, error)
    Things - gets all things

func (sdk mfSDK) UpdateChannel(channel Channel, token string) error
    UpdateChannel - update a channel

func (sdk mfSDK) UpdateThing(thing Thing, token string) error
    UpdateThing - updates thing by ID

func (sdk mfSDK) Version() (string, error)
    Version - server health check