Mainflux.mainflux/sdk/go
Manuel Imperiale cc5e0288df
NOISSUE - Fix users CLI (#1062)
* NOISSSUE - Fix users CLI

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Fix README

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* use Mainflux entities

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>

* Mv ConnectionIDs to requests

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
2020-03-09 11:31:19 +01:00
..
README.md MF-1016 - Add UserUpdate and UpdatePassword to sdk and CLI (#1057) 2020-03-04 18:37:41 +01:00
channels.go NOISSUE - Fix SDK Messages response (#1064) 2020-03-07 05:02:26 +01:00
channels_test.go NOISSUE - Fix connect CLI command and remove ConnectThing func from SDK (#1051) 2020-03-03 10:58:30 +01:00
message.go NOISSUE - Fix SDK Messages response (#1064) 2020-03-07 05:02:26 +01:00
message_test.go MF-788 - Remove date and minimize copyright comments (#876) 2019-10-07 16:14:47 +02:00
requests.go NOISSUE - Fix users CLI (#1062) 2020-03-09 11:31:19 +01:00
responses.go NOISSUE - Fix users CLI (#1062) 2020-03-09 11:31:19 +01:00
sdk.go NOISSUE - Fix users CLI (#1062) 2020-03-09 11:31:19 +01:00
things.go NOISSUE - Fix SDK Messages response (#1064) 2020-03-07 05:02:26 +01:00
things_test.go NOISSUE - Fix connect CLI command and remove ConnectThing func from SDK (#1051) 2020-03-03 10:58:30 +01:00
users.go NOISSUE - Fix users CLI (#1062) 2020-03-09 11:31:19 +01: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) Connect(struct{[]string, []string}, token string) error
    Connect - connect things to channels

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) User(pwd string) (user, error)
    User - gets user

func (sdk *MfxSDK) UpdateUser(user, pwd string) error
    UpdateUser - update user

func (sdk *MfxSDK) UpdatePassword(user, pwd string) error
    UpdatePassword - update user password

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