Mainflux.mainflux/pkg/sdk/go
Ian Ngethe Muchiri 5fa2bf4229
1890 - Update error encoding (#1891)
* update error encoding

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* fix semaphore fail

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* update encode error

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* update bootstraptests

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* Update notifiers endpoint_test

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* Update tokens_test

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* Update json.unmarshal into expected struct

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* update .env

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* update sdk_error to check if err is empty

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* update message_test

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* Update error marshaling

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* update tests

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* Redo makefile

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* Add fullstop to comments

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* Update rebase error

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

---------

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>
2023-08-24 15:09:23 +02:00
..
README.md MF-1308 - Use IETF Health Check standard (#1541) 2022-01-24 21:18:53 +01:00
bootstrap.go NOISSUE- Update bootstrapSDK endpoints (#1888) 2023-08-11 15:17:17 +02:00
certs.go NOISSUE-Add resetPassword to the SDK (#1872) 2023-08-01 17:03:18 +02:00
certs_test.go NOISSUE - Change import name aliases (#1868) 2023-08-11 11:30:25 +02:00
channels.go NOISSUE-Add resetPassword to the SDK (#1872) 2023-08-01 17:03:18 +02:00
channels_test.go NOISSUE - Change import name aliases (#1868) 2023-08-11 11:30:25 +02:00
consumers.go NOISSUE-Add resetPassword to the SDK (#1872) 2023-08-01 17:03:18 +02:00
consumers_test.go NOISSUE - Change import name aliases (#1868) 2023-08-11 11:30:25 +02:00
doc.go MF-1506 - Group-based Access Control (#1716) 2023-06-14 12:40:37 +02:00
groups.go NOISSUE - Change import name aliases (#1868) 2023-08-11 11:30:25 +02:00
groups_test.go NOISSUE - Change import name aliases (#1868) 2023-08-11 11:30:25 +02:00
health.go NOISSUE- update health method in SDK (#1881) 2023-08-08 14:42:32 +02:00
health_test.go NOISSUE- update health method in SDK (#1881) 2023-08-08 14:42:32 +02:00
message.go NOISSUE - Change import name aliases (#1868) 2023-08-11 11:30:25 +02:00
message_test.go 1890 - Update error encoding (#1891) 2023-08-24 15:09:23 +02:00
metadata.go MF-1506 - Group-based Access Control (#1716) 2023-06-14 12:40:37 +02:00
policies.go NOISSUE - Change import name aliases (#1868) 2023-08-11 11:30:25 +02:00
policies_test.go NOISSUE - Change import name aliases (#1868) 2023-08-11 11:30:25 +02:00
requests.go NOISSUE-Add resetPassword to the SDK (#1872) 2023-08-01 17:03:18 +02:00
responses.go NOISSUE - Reformat Things and Users Policies Endpoint (#1831) 2023-07-28 14:39:13 +02:00
sdk.go MF-1723 - Fix lack of logging for invalid query params (#1724) 2023-08-09 23:02:44 +02:00
setup_test.go NOISSUE - Use Insert On Conflict For Policies (#1824) 2023-06-20 14:59:53 +02:00
things.go NOISSUE - Change import name aliases (#1868) 2023-08-11 11:30:25 +02:00
things_test.go NOISSUE - Change import name aliases (#1868) 2023-08-11 11:30:25 +02:00
tokens.go NOISSUE - Change import name aliases (#1868) 2023-08-11 11:30:25 +02:00
tokens_test.go 1890 - Update error encoding (#1891) 2023-08-24 15:09:23 +02:00
users.go NOISSUE - Change import name aliases (#1868) 2023-08-11 11:30:25 +02:00
users_test.go NOISSUE - Change import name aliases (#1868) 2023-08-11 11:30:25 +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) Health() (mainflux.Health, error)
    Health - things service health check