Mainflux.mainflux/pkg/sdk/go
Mirko Teodorovic 0cdcf28683
MF-1394 - SDK groups (#1396)
* remove owner id

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* fix groups sdk

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* fix groups sdk

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* fix groups sdk

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* small fix, revert some changes

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* fix test fail

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* fix unassign request

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* decouple util method form group repo

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* resolve comments

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>

* fix param parsing

Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
2021-03-26 22:51:02 +01:00
..
README.md MF-1190 - Add pkg for library packages (#1191) 2020-06-03 15:16:19 +02:00
bootstrap.go NOISSUE - Fix certs update in bootstrap config and make content handling in config.toml user friendly (#1221) 2020-07-29 14:20:43 +02:00
certs.go MF-1179 - Add a certificate service and certs endpoint to SDK (#1188) 2020-07-21 12:53:21 +02:00
channels.go MF-1368 - Add internal http api package for query params reading (#1384) 2021-03-23 11:48:05 +01:00
channels_test.go MF-1368 - Add internal http api package for query params reading (#1384) 2021-03-23 11:48:05 +01:00
groups.go MF-1394 - SDK groups (#1396) 2021-03-26 22:51:02 +01:00
message.go MF-1179 - Add a certificate service and certs endpoint to SDK (#1188) 2020-07-21 12:53:21 +02:00
message_test.go NOISSUE - Add user groups (#1228) 2020-09-23 23:18:53 +02:00
requests.go MF-1190 - Add pkg for library packages (#1191) 2020-06-03 15:16:19 +02:00
responses.go NOISSUE - Add user groups (#1228) 2020-09-23 23:18:53 +02:00
sdk.go MF-1394 - SDK groups (#1396) 2021-03-26 22:51:02 +01:00
sdk_test.go MF-1190 - Add pkg for library packages (#1191) 2020-06-03 15:16:19 +02:00
things.go MF-1368 - Add internal http api package for query params reading (#1384) 2021-03-23 11:48:05 +01:00
things_test.go MF-1368 - Add internal http api package for query params reading (#1384) 2021-03-23 11:48:05 +01:00
users.go MF-1394 - SDK groups (#1396) 2021-03-26 22:51:02 +01:00
users_test.go MF-1346 - Create Groups API - add grouping of entities (#1334) 2021-03-04 10:29:03 +01:00
version.go MF-1190 - Add pkg for library packages (#1191) 2020-06-03 15:16:19 +02:00
version_test.go NOISSUE - Add user groups (#1228) 2020-09-23 23:18:53 +02: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/pkg/sdk/go"```

Then call SDK Go functions to interact with the system.

## API Reference

```go
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