2019-10-07 08:14:47 -06:00
|
|
|
// Copyright (c) Mainflux
|
2018-10-14 16:44:21 +02:00
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
|
|
package sdk
|
|
|
|
|
|
|
|
import (
|
2022-12-15 07:24:19 -08:00
|
|
|
"bytes"
|
2018-10-24 11:21:03 +02:00
|
|
|
"crypto/tls"
|
2022-06-17 18:32:23 +03:00
|
|
|
"encoding/json"
|
|
|
|
"fmt"
|
2023-06-14 12:40:37 +02:00
|
|
|
"io"
|
2018-10-14 16:44:21 +02:00
|
|
|
"net/http"
|
2022-06-17 18:32:23 +03:00
|
|
|
"net/url"
|
|
|
|
"strconv"
|
2022-12-15 07:24:19 -08:00
|
|
|
"strings"
|
2022-01-12 13:24:51 +01:00
|
|
|
"time"
|
2022-01-24 21:18:53 +01:00
|
|
|
|
2022-12-15 07:24:19 -08:00
|
|
|
"github.com/mainflux/mainflux/pkg/errors"
|
2018-10-24 11:21:03 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
// CTJSON represents JSON content type.
|
|
|
|
CTJSON ContentType = "application/json"
|
|
|
|
|
|
|
|
// CTJSONSenML represents JSON SenML content type.
|
|
|
|
CTJSONSenML ContentType = "application/senml+json"
|
2018-10-14 16:44:21 +02:00
|
|
|
|
2018-10-24 11:21:03 +02:00
|
|
|
// CTBinary represents binary content type.
|
|
|
|
CTBinary ContentType = "application/octet-stream"
|
2023-06-14 12:40:37 +02:00
|
|
|
|
|
|
|
// EnabledStatus represents enable status for a client.
|
|
|
|
EnabledStatus = "enabled"
|
|
|
|
|
|
|
|
// DisabledStatus represents disabled status for a client.
|
|
|
|
DisabledStatus = "disabled"
|
|
|
|
|
|
|
|
BearerPrefix = "Bearer "
|
|
|
|
|
|
|
|
ThingPrefix = "Thing "
|
2018-10-14 16:44:21 +02:00
|
|
|
)
|
|
|
|
|
2018-10-24 11:21:03 +02:00
|
|
|
// ContentType represents all possible content types.
|
|
|
|
type ContentType string
|
|
|
|
|
|
|
|
var _ SDK = (*mfSDK)(nil)
|
|
|
|
|
2023-06-14 12:40:37 +02:00
|
|
|
var (
|
|
|
|
// ErrFailedCreation indicates that entity creation failed.
|
|
|
|
ErrFailedCreation = errors.New("failed to create entity in the db")
|
2018-10-24 11:21:03 +02:00
|
|
|
|
2023-06-14 12:40:37 +02:00
|
|
|
// ErrFailedList indicates that entities list failed.
|
|
|
|
ErrFailedList = errors.New("failed to list entities")
|
2020-09-23 23:18:53 +02:00
|
|
|
|
2023-06-14 12:40:37 +02:00
|
|
|
// ErrFailedUpdate indicates that entity update failed.
|
|
|
|
ErrFailedUpdate = errors.New("failed to update entity")
|
|
|
|
|
|
|
|
// ErrFailedFetch indicates that fetching of entity data failed.
|
|
|
|
ErrFailedFetch = errors.New("failed to fetch entity")
|
|
|
|
|
|
|
|
// ErrFailedRemoval indicates that entity removal failed.
|
|
|
|
ErrFailedRemoval = errors.New("failed to remove entity")
|
2019-01-08 11:53:24 +01:00
|
|
|
|
2023-06-14 12:40:37 +02:00
|
|
|
// ErrFailedEnable indicates that client enable failed.
|
|
|
|
ErrFailedEnable = errors.New("failed to enable client")
|
|
|
|
|
|
|
|
// ErrFailedDisable indicates that client disable failed.
|
|
|
|
ErrFailedDisable = errors.New("failed to disable client")
|
2023-08-10 02:32:44 +05:30
|
|
|
|
|
|
|
ErrInvalidJWT = errors.New("invalid JWT")
|
2023-06-14 12:40:37 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
type PageMetadata struct {
|
|
|
|
Total uint64 `json:"total"`
|
|
|
|
Offset uint64 `json:"offset"`
|
|
|
|
Limit uint64 `json:"limit"`
|
|
|
|
Level uint64 `json:"level,omitempty"`
|
|
|
|
Email string `json:"email,omitempty"`
|
|
|
|
Name string `json:"name,omitempty"`
|
|
|
|
Type string `json:"type,omitempty"`
|
|
|
|
Metadata Metadata `json:"metadata,omitempty"`
|
|
|
|
Status string `json:"status,omitempty"`
|
|
|
|
Action string `json:"action,omitempty"`
|
|
|
|
Subject string `json:"subject,omitempty"`
|
|
|
|
Object string `json:"object,omitempty"`
|
NOISSUE: Listing of shared things with users & Update SDK (#1923)
* NOISSUE - Fix Bugs (#20)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add Connect Disconnect endpoints (#23)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Things share with users (#25)
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: things share with other users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Listing of things, channels, groups, users (#26)
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: List of user groups & removed repeating code in groups (#29)
* removed repeating code in list groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: list of user group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: otel handler operator name for endpoints
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* add: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: comment
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: sdk function names
Signed-off-by: Arvindh <arvindh91@gmail.com>
* update: api spec
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: channels connect request
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of clients and groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: CLI
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: array len comparision
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: nginx
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
2023-10-17 19:08:06 +05:30
|
|
|
Permission string `json:"permission,omitempty"`
|
2023-06-14 12:40:37 +02:00
|
|
|
Tag string `json:"tag,omitempty"`
|
|
|
|
Owner string `json:"owner,omitempty"`
|
|
|
|
SharedBy string `json:"shared_by,omitempty"`
|
|
|
|
Visibility string `json:"visibility,omitempty"`
|
|
|
|
OwnerID string `json:"owner_id,omitempty"`
|
|
|
|
Topic string `json:"topic,omitempty"`
|
|
|
|
Contact string `json:"contact,omitempty"`
|
|
|
|
State string `json:"state,omitempty"`
|
2020-04-27 18:49:09 +02:00
|
|
|
}
|
2019-11-21 04:29:37 -07:00
|
|
|
|
2023-06-14 12:40:37 +02:00
|
|
|
// Credentials represent client credentials: it contains
|
|
|
|
// "identity" which can be a username, email, generated name;
|
|
|
|
// and "secret" which can be a password or access token.
|
|
|
|
type Credentials struct {
|
|
|
|
Identity string `json:"identity,omitempty"` // username or generated login ID
|
|
|
|
Secret string `json:"secret,omitempty"` // password or token
|
2022-01-12 13:24:51 +01:00
|
|
|
}
|
|
|
|
|
2018-10-24 11:21:03 +02:00
|
|
|
// SDK contains Mainflux API.
|
2018-10-14 16:44:21 +02:00
|
|
|
type SDK interface {
|
2018-10-24 11:21:03 +02:00
|
|
|
// CreateUser registers mainflux user.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// user := sdk.User{
|
|
|
|
// Name: "John Doe",
|
|
|
|
// Credentials: sdk.Credentials{
|
|
|
|
// Identity: "john.doe@example",
|
|
|
|
// Secret: "12345678",
|
|
|
|
// },
|
|
|
|
// }
|
|
|
|
// user, _ := sdk.CreateUser(user)
|
|
|
|
// fmt.Println(user)
|
|
|
|
CreateUser(user User, token string) (User, errors.SDKError)
|
2018-10-24 11:21:03 +02:00
|
|
|
|
2022-06-17 18:32:23 +03:00
|
|
|
// User returns user object by id.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// user, _ := sdk.User("userID", "token")
|
|
|
|
// fmt.Println(user)
|
2023-01-05 19:20:05 +03:00
|
|
|
User(id, token string) (User, errors.SDKError)
|
2022-06-17 18:32:23 +03:00
|
|
|
|
|
|
|
// Users returns list of users.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// pm := sdk.PageMetadata{
|
|
|
|
// Offset: 0,
|
|
|
|
// Limit: 10,
|
|
|
|
// Name: "John Doe",
|
|
|
|
// }
|
|
|
|
// users, _ := sdk.Users(pm, "token")
|
|
|
|
// fmt.Println(users)
|
2023-01-05 19:20:05 +03:00
|
|
|
Users(pm PageMetadata, token string) (UsersPage, errors.SDKError)
|
2020-03-04 18:37:41 +01:00
|
|
|
|
2023-06-14 12:40:37 +02:00
|
|
|
// UserProfile returns user logged in.
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// user, _ := sdk.UserProfile("token")
|
|
|
|
// fmt.Println(user)
|
|
|
|
UserProfile(token string) (User, errors.SDKError)
|
2018-10-24 11:21:03 +02:00
|
|
|
|
2020-03-04 18:37:41 +01:00
|
|
|
// UpdateUser updates existing user.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// user := sdk.User{
|
|
|
|
// ID: "userID",
|
|
|
|
// Name: "John Doe",
|
|
|
|
// Metadata: sdk.Metadata{
|
|
|
|
// "key": "value",
|
|
|
|
// },
|
|
|
|
// }
|
|
|
|
// user, _ := sdk.UpdateUser(user, "token")
|
|
|
|
// fmt.Println(user)
|
|
|
|
UpdateUser(user User, token string) (User, errors.SDKError)
|
|
|
|
|
|
|
|
// UpdateUserTags updates the user's tags.
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// user := sdk.User{
|
|
|
|
// ID: "userID",
|
|
|
|
// Tags: []string{"tag1", "tag2"},
|
|
|
|
// }
|
|
|
|
// user, _ := sdk.UpdateUserTags(user, "token")
|
|
|
|
// fmt.Println(user)
|
|
|
|
UpdateUserTags(user User, token string) (User, errors.SDKError)
|
|
|
|
|
|
|
|
// UpdateUserIdentity updates the user's identity
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// user := sdk.User{
|
|
|
|
// ID: "userID",
|
|
|
|
// Credentials: sdk.Credentials{
|
|
|
|
// Identity: "john.doe@example",
|
|
|
|
// },
|
|
|
|
// }
|
|
|
|
// user, _ := sdk.UpdateUserIdentity(user, "token")
|
|
|
|
// fmt.Println(user)
|
|
|
|
UpdateUserIdentity(user User, token string) (User, errors.SDKError)
|
|
|
|
|
|
|
|
// UpdateUserOwner updates the user's owner.
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// user := sdk.User{
|
|
|
|
// ID: "userID",
|
|
|
|
// Owner: "ownerID",
|
|
|
|
// }
|
|
|
|
// user, _ := sdk.UpdateUserOwner(user, "token")
|
|
|
|
// fmt.Println(user)
|
|
|
|
UpdateUserOwner(user User, token string) (User, errors.SDKError)
|
2020-03-04 18:37:41 +01:00
|
|
|
|
2023-08-01 18:03:18 +03:00
|
|
|
// ResetPasswordRequest sends a password request email to a user.
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// err := sdk.ResetPasswordRequest("example@email.com")
|
|
|
|
// fmt.Println(err)
|
|
|
|
ResetPasswordRequest(email string) errors.SDKError
|
|
|
|
|
|
|
|
// ResetPassword changes a user's password to the one passed in the argument.
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// err := sdk.ResetPassword("password","password","token")
|
|
|
|
// fmt.Println(err)
|
|
|
|
ResetPassword(password, confPass, token string) errors.SDKError
|
|
|
|
|
2020-03-04 18:37:41 +01:00
|
|
|
// UpdatePassword updates user password.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// user, _ := sdk.UpdatePassword("oldPass", "newPass", "token")
|
|
|
|
// fmt.Println(user)
|
|
|
|
UpdatePassword(oldPass, newPass, token string) (User, errors.SDKError)
|
2020-03-04 18:37:41 +01:00
|
|
|
|
2022-08-11 19:58:45 +03:00
|
|
|
// EnableUser changes the status of the user to enabled.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// user, _ := sdk.EnableUser("userID", "token")
|
|
|
|
// fmt.Println(user)
|
|
|
|
EnableUser(id, token string) (User, errors.SDKError)
|
2022-08-11 19:58:45 +03:00
|
|
|
|
|
|
|
// DisableUser changes the status of the user to disabled.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// user, _ := sdk.DisableUser("userID", "token")
|
|
|
|
// fmt.Println(user)
|
|
|
|
DisableUser(id, token string) (User, errors.SDKError)
|
|
|
|
|
|
|
|
// CreateToken receives credentials and returns user token.
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// user := sdk.User{
|
|
|
|
// Credentials: sdk.Credentials{
|
|
|
|
// Identity: "john.doe@example",
|
|
|
|
// Secret: "12345678",
|
|
|
|
// },
|
|
|
|
// }
|
|
|
|
// token, _ := sdk.CreateToken(user)
|
|
|
|
// fmt.Println(token)
|
|
|
|
CreateToken(user User) (Token, errors.SDKError)
|
|
|
|
|
|
|
|
// RefreshToken receives credentials and returns user token.
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// token, _ := sdk.RefreshToken("refresh_token")
|
|
|
|
// fmt.Println(token)
|
|
|
|
RefreshToken(token string) (Token, errors.SDKError)
|
2022-08-11 19:58:45 +03:00
|
|
|
|
NOISSUE: Listing of shared things with users & Update SDK (#1923)
* NOISSUE - Fix Bugs (#20)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add Connect Disconnect endpoints (#23)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Things share with users (#25)
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: things share with other users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Listing of things, channels, groups, users (#26)
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: List of user groups & removed repeating code in groups (#29)
* removed repeating code in list groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: list of user group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: otel handler operator name for endpoints
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* add: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: comment
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: sdk function names
Signed-off-by: Arvindh <arvindh91@gmail.com>
* update: api spec
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: channels connect request
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of clients and groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: CLI
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: array len comparision
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: nginx
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
2023-10-17 19:08:06 +05:30
|
|
|
// ListUserChannels list all channels belongs a particular user id.
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// pm := sdk.PageMetadata{
|
|
|
|
// Offset: 0,
|
|
|
|
// Limit: 10,
|
|
|
|
// Permission: "edit", // available Options: "administrator", "delete", edit", "view", "share", "owner", "admin", "editor", "viewer"
|
|
|
|
// }
|
|
|
|
// channels, _ := sdk.ListUserChannels("user_id_1", pm, "token")
|
|
|
|
// fmt.Println(channels)
|
|
|
|
ListUserChannels(userID string, pm PageMetadata, token string) (ChannelsPage, errors.SDKError)
|
|
|
|
|
|
|
|
// ListUserGroups list all groups belongs a particular user id.
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// pm := sdk.PageMetadata{
|
|
|
|
// Offset: 0,
|
|
|
|
// Limit: 10,
|
|
|
|
// Permission: "edit", // available Options: "administrator", "delete", edit", "view", "share", "owner", "admin", "editor", "viewer"
|
|
|
|
// }
|
|
|
|
// groups, _ := sdk.ListUserGroups("user_id_1", pm, "token")
|
|
|
|
// fmt.Println(channels)
|
|
|
|
ListUserGroups(userID string, pm PageMetadata, token string) (GroupsPage, errors.SDKError)
|
|
|
|
|
|
|
|
// ListUserThings list all things belongs a particular user id.
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// pm := sdk.PageMetadata{
|
|
|
|
// Offset: 0,
|
|
|
|
// Limit: 10,
|
|
|
|
// Permission: "edit", // available Options: "administrator", "delete", edit", "view", "share", "owner", "admin", "editor", "viewer"
|
|
|
|
// }
|
|
|
|
// things, _ := sdk.ListUserThings("user_id_1", pm, "token")
|
|
|
|
// fmt.Println(things)
|
|
|
|
ListUserThings(userID string, pm PageMetadata, token string) (ThingsPage, errors.SDKError)
|
|
|
|
|
2018-10-24 11:21:03 +02:00
|
|
|
// CreateThing registers new thing and returns its id.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// thing := sdk.Thing{
|
|
|
|
// Name: "My Thing",
|
|
|
|
// Metadata: sdk.Metadata{
|
|
|
|
// "key": "value",
|
|
|
|
// },
|
|
|
|
// }
|
|
|
|
// thing, _ := sdk.CreateThing(thing, "token")
|
|
|
|
// fmt.Println(thing)
|
|
|
|
CreateThing(thing Thing, token string) (Thing, errors.SDKError)
|
2018-10-24 11:21:03 +02:00
|
|
|
|
2019-10-29 05:59:54 -06:00
|
|
|
// CreateThings registers new things and returns their ids.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// things := []sdk.Thing{
|
|
|
|
// {
|
|
|
|
// Name: "My Thing 1",
|
|
|
|
// Metadata: sdk.Metadata{
|
|
|
|
// "key": "value",
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
// {
|
|
|
|
// Name: "My Thing 2",
|
|
|
|
// Metadata: sdk.Metadata{
|
|
|
|
// "key": "value",
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
// }
|
|
|
|
// things, _ := sdk.CreateThings(things, "token")
|
|
|
|
// fmt.Println(things)
|
2022-12-15 07:24:19 -08:00
|
|
|
CreateThings(things []Thing, token string) ([]Thing, errors.SDKError)
|
2019-10-29 05:59:54 -06:00
|
|
|
|
2023-06-14 12:40:37 +02:00
|
|
|
// Filters things and returns a page result.
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// pm := sdk.PageMetadata{
|
|
|
|
// Offset: 0,
|
|
|
|
// Limit: 10,
|
|
|
|
// Name: "My Thing",
|
|
|
|
// }
|
|
|
|
// things, _ := sdk.Things(pm, "token")
|
|
|
|
// fmt.Println(things)
|
2023-01-05 19:20:05 +03:00
|
|
|
Things(pm PageMetadata, token string) (ThingsPage, errors.SDKError)
|
2019-01-08 11:53:24 +01:00
|
|
|
|
2023-06-14 12:40:37 +02:00
|
|
|
// ThingsByChannel returns page of things that are connected to specified channel.
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// pm := sdk.PageMetadata{
|
|
|
|
// Offset: 0,
|
|
|
|
// Limit: 10,
|
|
|
|
// Name: "My Thing",
|
|
|
|
// }
|
|
|
|
// things, _ := sdk.ThingsByChannel("channelID", pm, "token")
|
|
|
|
// fmt.Println(things)
|
2023-01-05 19:20:05 +03:00
|
|
|
ThingsByChannel(chanID string, pm PageMetadata, token string) (ThingsPage, errors.SDKError)
|
2018-10-24 11:21:03 +02:00
|
|
|
|
|
|
|
// Thing returns thing object by id.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// thing, _ := sdk.Thing("thingID", "token")
|
|
|
|
// fmt.Println(thing)
|
2022-12-15 07:24:19 -08:00
|
|
|
Thing(id, token string) (Thing, errors.SDKError)
|
2018-10-24 11:21:03 +02:00
|
|
|
|
|
|
|
// UpdateThing updates existing thing.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// thing := sdk.Thing{
|
|
|
|
// ID: "thingID",
|
|
|
|
// Name: "My Thing",
|
|
|
|
// Metadata: sdk.Metadata{
|
|
|
|
// "key": "value",
|
|
|
|
// },
|
|
|
|
// }
|
|
|
|
// thing, _ := sdk.UpdateThing(thing, "token")
|
|
|
|
// fmt.Println(thing)
|
|
|
|
UpdateThing(thing Thing, token string) (Thing, errors.SDKError)
|
|
|
|
|
|
|
|
// UpdateThingTags updates the client's tags.
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// thing := sdk.Thing{
|
|
|
|
// ID: "thingID",
|
|
|
|
// Tags: []string{"tag1", "tag2"},
|
|
|
|
// }
|
|
|
|
// thing, _ := sdk.UpdateThingTags(thing, "token")
|
|
|
|
// fmt.Println(thing)
|
|
|
|
UpdateThingTags(thing Thing, token string) (Thing, errors.SDKError)
|
|
|
|
|
|
|
|
// UpdateThingSecret updates the client's secret
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// thing, err := sdk.UpdateThingSecret("thingID", "newSecret", "token")
|
|
|
|
// fmt.Println(thing)
|
|
|
|
UpdateThingSecret(id, secret, token string) (Thing, errors.SDKError)
|
|
|
|
|
|
|
|
// UpdateThingOwner updates the client's owner.
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// thing := sdk.Thing{
|
|
|
|
// ID: "thingID",
|
|
|
|
// Owner: "ownerID",
|
|
|
|
// }
|
|
|
|
// thing, _ := sdk.UpdateThingOwner(thing, "token")
|
|
|
|
// fmt.Println(thing)
|
|
|
|
UpdateThingOwner(thing Thing, token string) (Thing, errors.SDKError)
|
|
|
|
|
|
|
|
// EnableThing changes client status to enabled.
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// thing, _ := sdk.EnableThing("thingID", "token")
|
|
|
|
// fmt.Println(thing)
|
|
|
|
EnableThing(id, token string) (Thing, errors.SDKError)
|
|
|
|
|
|
|
|
// DisableThing changes client status to disabled - soft delete.
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// thing, _ := sdk.DisableThing("thingID", "token")
|
|
|
|
// fmt.Println(thing)
|
|
|
|
DisableThing(id, token string) (Thing, errors.SDKError)
|
2018-10-24 11:21:03 +02:00
|
|
|
|
2022-06-24 17:31:12 +03:00
|
|
|
// IdentifyThing validates thing's key and returns its ID
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// id, _ := sdk.IdentifyThing("thingKey")
|
|
|
|
// fmt.Println(id)
|
2022-12-15 07:24:19 -08:00
|
|
|
IdentifyThing(key string) (string, errors.SDKError)
|
2022-06-24 17:31:12 +03:00
|
|
|
|
NOISSUE: Listing of shared things with users & Update SDK (#1923)
* NOISSUE - Fix Bugs (#20)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add Connect Disconnect endpoints (#23)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Things share with users (#25)
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: things share with other users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Listing of things, channels, groups, users (#26)
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: List of user groups & removed repeating code in groups (#29)
* removed repeating code in list groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: list of user group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: otel handler operator name for endpoints
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* add: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: comment
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: sdk function names
Signed-off-by: Arvindh <arvindh91@gmail.com>
* update: api spec
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: channels connect request
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of clients and groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: CLI
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: array len comparision
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: nginx
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
2023-10-17 19:08:06 +05:30
|
|
|
// ShareThing shares thing with other users.
|
2023-06-20 16:48:25 +03:00
|
|
|
//
|
NOISSUE: Listing of shared things with users & Update SDK (#1923)
* NOISSUE - Fix Bugs (#20)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add Connect Disconnect endpoints (#23)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Things share with users (#25)
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: things share with other users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Listing of things, channels, groups, users (#26)
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: List of user groups & removed repeating code in groups (#29)
* removed repeating code in list groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: list of user group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: otel handler operator name for endpoints
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* add: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: comment
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: sdk function names
Signed-off-by: Arvindh <arvindh91@gmail.com>
* update: api spec
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: channels connect request
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of clients and groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: CLI
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: array len comparision
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: nginx
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
2023-10-17 19:08:06 +05:30
|
|
|
// example:
|
|
|
|
// req := sdk.UsersRelationRequest{
|
|
|
|
// Relation: "viewer", // available options: "owner", "admin", "editor", "viewer"
|
|
|
|
// UserIDs: ["user_id_1", "user_id_2", "user_id_3"]
|
|
|
|
// }
|
|
|
|
// err := sdk.ShareThing("thing_id", req, "token")
|
|
|
|
// fmt.Println(err)
|
|
|
|
ShareThing(thingID string, req UsersRelationRequest, token string) errors.SDKError
|
|
|
|
|
|
|
|
// UnshareThing unshare a thing with other users.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
NOISSUE: Listing of shared things with users & Update SDK (#1923)
* NOISSUE - Fix Bugs (#20)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add Connect Disconnect endpoints (#23)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Things share with users (#25)
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: things share with other users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Listing of things, channels, groups, users (#26)
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: List of user groups & removed repeating code in groups (#29)
* removed repeating code in list groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: list of user group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: otel handler operator name for endpoints
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* add: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: comment
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: sdk function names
Signed-off-by: Arvindh <arvindh91@gmail.com>
* update: api spec
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: channels connect request
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of clients and groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: CLI
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: array len comparision
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: nginx
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
2023-10-17 19:08:06 +05:30
|
|
|
// req := sdk.UsersRelationRequest{
|
|
|
|
// Relation: "viewer", // available options: "owner", "admin", "editor", "viewer"
|
|
|
|
// UserIDs: ["user_id_1", "user_id_2", "user_id_3"]
|
|
|
|
// }
|
|
|
|
// err := sdk.UnshareThing("thing_id", req, "token")
|
2023-06-14 12:40:37 +02:00
|
|
|
// fmt.Println(err)
|
NOISSUE: Listing of shared things with users & Update SDK (#1923)
* NOISSUE - Fix Bugs (#20)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add Connect Disconnect endpoints (#23)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Things share with users (#25)
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: things share with other users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Listing of things, channels, groups, users (#26)
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: List of user groups & removed repeating code in groups (#29)
* removed repeating code in list groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: list of user group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: otel handler operator name for endpoints
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* add: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: comment
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: sdk function names
Signed-off-by: Arvindh <arvindh91@gmail.com>
* update: api spec
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: channels connect request
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of clients and groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: CLI
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: array len comparision
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: nginx
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
2023-10-17 19:08:06 +05:30
|
|
|
UnshareThing(thingID string, req UsersRelationRequest, token string) errors.SDKError
|
|
|
|
|
|
|
|
// ListThingUsers all users in a thing.
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// pm := sdk.PageMetadata{
|
|
|
|
// Offset: 0,
|
|
|
|
// Limit: 10,
|
|
|
|
// Permission: "edit", // available Options: "administrator", "delete", edit", "view", "share", "owner", "admin", "editor", "viewer"
|
|
|
|
// }
|
|
|
|
// users, _ := sdk.ListThingUsers("thing_id", pm, "token")
|
|
|
|
// fmt.Println(users)
|
|
|
|
ListThingUsers(thingID string, pm PageMetadata, token string) (UsersPage, errors.SDKError)
|
2023-05-25 06:02:46 +08:00
|
|
|
|
2020-09-23 23:18:53 +02:00
|
|
|
// CreateGroup creates new group and returns its id.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// group := sdk.Group{
|
|
|
|
// Name: "My Group",
|
|
|
|
// Metadata: sdk.Metadata{
|
|
|
|
// "key": "value",
|
|
|
|
// },
|
|
|
|
// }
|
|
|
|
// group, _ := sdk.CreateGroup(group, "token")
|
|
|
|
// fmt.Println(group)
|
|
|
|
CreateGroup(group Group, token string) (Group, errors.SDKError)
|
|
|
|
|
2022-06-01 01:41:54 +02:00
|
|
|
// Groups returns page of groups.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// pm := sdk.PageMetadata{
|
|
|
|
// Offset: 0,
|
|
|
|
// Limit: 10,
|
|
|
|
// Name: "My Group",
|
|
|
|
// }
|
|
|
|
// groups, _ := sdk.Groups(pm, "token")
|
|
|
|
// fmt.Println(groups)
|
2023-01-05 19:20:05 +03:00
|
|
|
Groups(pm PageMetadata, token string) (GroupsPage, errors.SDKError)
|
2021-03-26 22:51:02 +01:00
|
|
|
|
|
|
|
// Parents returns page of users groups.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// pm := sdk.PageMetadata{
|
|
|
|
// Offset: 0,
|
|
|
|
// Limit: 10,
|
|
|
|
// Name: "My Group",
|
|
|
|
// }
|
|
|
|
// groups, _ := sdk.Parents("groupID", pm, "token")
|
|
|
|
// fmt.Println(groups)
|
2023-01-05 19:20:05 +03:00
|
|
|
Parents(id string, pm PageMetadata, token string) (GroupsPage, errors.SDKError)
|
2021-03-26 22:51:02 +01:00
|
|
|
|
|
|
|
// Children returns page of users groups.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// pm := sdk.PageMetadata{
|
|
|
|
// Offset: 0,
|
|
|
|
// Limit: 10,
|
|
|
|
// Name: "My Group",
|
|
|
|
// }
|
|
|
|
// groups, _ := sdk.Children("groupID", pm, "token")
|
|
|
|
// fmt.Println(groups)
|
2023-01-05 19:20:05 +03:00
|
|
|
Children(id string, pm PageMetadata, token string) (GroupsPage, errors.SDKError)
|
2020-09-23 23:18:53 +02:00
|
|
|
|
|
|
|
// Group returns users group object by id.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// group, _ := sdk.Group("groupID", "token")
|
|
|
|
// fmt.Println(group)
|
2022-12-15 07:24:19 -08:00
|
|
|
Group(id, token string) (Group, errors.SDKError)
|
2020-09-23 23:18:53 +02:00
|
|
|
|
|
|
|
// UpdateGroup updates existing group.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// group := sdk.Group{
|
|
|
|
// ID: "groupID",
|
|
|
|
// Name: "My Group",
|
|
|
|
// Metadata: sdk.Metadata{
|
|
|
|
// "key": "value",
|
|
|
|
// },
|
|
|
|
// }
|
|
|
|
// group, _ := sdk.UpdateGroup(group, "token")
|
|
|
|
// fmt.Println(group)
|
|
|
|
UpdateGroup(group Group, token string) (Group, errors.SDKError)
|
|
|
|
|
|
|
|
// EnableGroup changes group status to enabled.
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// group, _ := sdk.EnableGroup("groupID", "token")
|
|
|
|
// fmt.Println(group)
|
|
|
|
EnableGroup(id, token string) (Group, errors.SDKError)
|
|
|
|
|
|
|
|
// DisableGroup changes group status to disabled - soft delete.
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// group, _ := sdk.DisableGroup("groupID", "token")
|
|
|
|
// fmt.Println(group)
|
|
|
|
DisableGroup(id, token string) (Group, errors.SDKError)
|
2018-10-14 16:44:21 +02:00
|
|
|
|
NOISSUE: Listing of shared things with users & Update SDK (#1923)
* NOISSUE - Fix Bugs (#20)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add Connect Disconnect endpoints (#23)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Things share with users (#25)
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: things share with other users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Listing of things, channels, groups, users (#26)
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: List of user groups & removed repeating code in groups (#29)
* removed repeating code in list groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: list of user group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: otel handler operator name for endpoints
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* add: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: comment
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: sdk function names
Signed-off-by: Arvindh <arvindh91@gmail.com>
* update: api spec
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: channels connect request
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of clients and groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: CLI
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: array len comparision
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: nginx
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
2023-10-17 19:08:06 +05:30
|
|
|
// AddUserToGroup add user to a group.
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// req := sdk.UsersRelationRequest{
|
|
|
|
// Relation: "viewer", // available options: "owner", "admin", "editor", "viewer"
|
|
|
|
// UserIDs: ["user_id_1", "user_id_2", "user_id_3"]
|
|
|
|
// }
|
|
|
|
// group, _ := sdk.AddUserToGroup("groupID",req, "token")
|
|
|
|
// fmt.Println(group)
|
|
|
|
AddUserToGroup(groupID string, req UsersRelationRequest, token string) errors.SDKError
|
|
|
|
|
|
|
|
// RemoveUserFromGroup remove user from a group.
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// req := sdk.UsersRelationRequest{
|
|
|
|
// Relation: "viewer", // available options: "owner", "admin", "editor", "viewer"
|
|
|
|
// UserIDs: ["user_id_1", "user_id_2", "user_id_3"]
|
|
|
|
// }
|
|
|
|
// group, _ := sdk.RemoveUserFromGroup("groupID",req, "token")
|
|
|
|
// fmt.Println(group)
|
|
|
|
RemoveUserFromGroup(groupID string, req UsersRelationRequest, token string) errors.SDKError
|
|
|
|
|
|
|
|
// ListGroupUsers list all users in the group id .
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// pm := sdk.PageMetadata{
|
|
|
|
// Offset: 0,
|
|
|
|
// Limit: 10,
|
|
|
|
// Permission: "edit", // available Options: "administrator", "delete", edit", "view", "share", "owner", "admin", "editor", "viewer"
|
|
|
|
// }
|
|
|
|
// groups, _ := sdk.ListGroupUsers("groupID", pm, "token")
|
|
|
|
// fmt.Println(groups)
|
|
|
|
ListGroupUsers(groupID string, pm PageMetadata, token string) (GroupsPage, errors.SDKError)
|
|
|
|
|
|
|
|
// ListGroupChannels list all channels in the group id .
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// pm := sdk.PageMetadata{
|
|
|
|
// Offset: 0,
|
|
|
|
// Limit: 10,
|
|
|
|
// Permission: "edit", // available Options: "administrator", "delete", edit", "view", "share", "owner", "admin", "editor", "viewer"
|
|
|
|
// }
|
|
|
|
// groups, _ := sdk.ListGroupChannels("groupID", pm, "token")
|
|
|
|
// fmt.Println(groups)
|
|
|
|
ListGroupChannels(groupID string, pm PageMetadata, token string) (GroupsPage, errors.SDKError)
|
|
|
|
|
2018-10-24 11:21:03 +02:00
|
|
|
// CreateChannel creates new channel and returns its id.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// channel := sdk.Channel{
|
|
|
|
// Name: "My Channel",
|
|
|
|
// Metadata: sdk.Metadata{
|
|
|
|
// "key": "value",
|
|
|
|
// },
|
|
|
|
// }
|
|
|
|
// channel, _ := sdk.CreateChannel(channel, "token")
|
|
|
|
// fmt.Println(channel)
|
|
|
|
CreateChannel(channel Channel, token string) (Channel, errors.SDKError)
|
2018-10-24 11:21:03 +02:00
|
|
|
|
2019-10-29 05:59:54 -06:00
|
|
|
// CreateChannels registers new channels and returns their ids.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// channels := []sdk.Channel{
|
|
|
|
// {
|
|
|
|
// Name: "My Channel 1",
|
|
|
|
// Metadata: sdk.Metadata{
|
|
|
|
// "key": "value",
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
// {
|
|
|
|
// Name: "My Channel 2",
|
|
|
|
// Metadata: sdk.Metadata{
|
|
|
|
// "key": "value",
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
// }
|
|
|
|
// channels, _ := sdk.CreateChannels(channels, "token")
|
|
|
|
// fmt.Println(channels)
|
2022-12-15 07:24:19 -08:00
|
|
|
CreateChannels(channels []Channel, token string) ([]Channel, errors.SDKError)
|
2019-10-29 05:59:54 -06:00
|
|
|
|
2018-10-24 11:21:03 +02:00
|
|
|
// Channels returns page of channels.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// pm := sdk.PageMetadata{
|
|
|
|
// Offset: 0,
|
|
|
|
// Limit: 10,
|
|
|
|
// Name: "My Channel",
|
|
|
|
// }
|
|
|
|
// channels, _ := sdk.Channels(pm, "token")
|
|
|
|
// fmt.Println(channels)
|
2023-01-05 19:20:05 +03:00
|
|
|
Channels(pm PageMetadata, token string) (ChannelsPage, errors.SDKError)
|
2019-01-08 11:53:24 +01:00
|
|
|
|
2023-06-14 12:40:37 +02:00
|
|
|
// ChannelsByThing returns page of channels that are connected to specified thing.
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// pm := sdk.PageMetadata{
|
|
|
|
// Offset: 0,
|
|
|
|
// Limit: 10,
|
|
|
|
// Name: "My Channel",
|
|
|
|
// }
|
|
|
|
// channels, _ := sdk.ChannelsByThing("thingID", pm, "token")
|
|
|
|
// fmt.Println(channels)
|
2023-01-05 19:20:05 +03:00
|
|
|
ChannelsByThing(thingID string, pm PageMetadata, token string) (ChannelsPage, errors.SDKError)
|
2018-10-24 11:21:03 +02:00
|
|
|
|
|
|
|
// Channel returns channel data by id.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// channel, _ := sdk.Channel("channelID", "token")
|
|
|
|
// fmt.Println(channel)
|
2022-12-15 07:24:19 -08:00
|
|
|
Channel(id, token string) (Channel, errors.SDKError)
|
2018-10-24 11:21:03 +02:00
|
|
|
|
|
|
|
// UpdateChannel updates existing channel.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// channel := sdk.Channel{
|
|
|
|
// ID: "channelID",
|
|
|
|
// Name: "My Channel",
|
|
|
|
// Metadata: sdk.Metadata{
|
|
|
|
// "key": "value",
|
|
|
|
// },
|
|
|
|
// }
|
|
|
|
// channel, _ := sdk.UpdateChannel(channel, "token")
|
|
|
|
// fmt.Println(channel)
|
|
|
|
UpdateChannel(channel Channel, token string) (Channel, errors.SDKError)
|
|
|
|
|
|
|
|
// EnableChannel changes channel status to enabled.
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// channel, _ := sdk.EnableChannel("channelID", "token")
|
|
|
|
// fmt.Println(channel)
|
|
|
|
EnableChannel(id, token string) (Channel, errors.SDKError)
|
|
|
|
|
|
|
|
// DisableChannel changes channel status to disabled - soft delete.
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// channel, _ := sdk.DisableChannel("channelID", "token")
|
|
|
|
// fmt.Println(channel)
|
|
|
|
DisableChannel(id, token string) (Channel, errors.SDKError)
|
|
|
|
|
NOISSUE: Listing of shared things with users & Update SDK (#1923)
* NOISSUE - Fix Bugs (#20)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add Connect Disconnect endpoints (#23)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Things share with users (#25)
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: things share with other users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Listing of things, channels, groups, users (#26)
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: List of user groups & removed repeating code in groups (#29)
* removed repeating code in list groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: list of user group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: otel handler operator name for endpoints
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* add: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: comment
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: sdk function names
Signed-off-by: Arvindh <arvindh91@gmail.com>
* update: api spec
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: channels connect request
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of clients and groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: CLI
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: array len comparision
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: nginx
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
2023-10-17 19:08:06 +05:30
|
|
|
// AddUserToChannel add user to a channel.
|
2023-07-28 15:39:13 +03:00
|
|
|
//
|
|
|
|
// example:
|
NOISSUE: Listing of shared things with users & Update SDK (#1923)
* NOISSUE - Fix Bugs (#20)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add Connect Disconnect endpoints (#23)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Things share with users (#25)
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: things share with other users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Listing of things, channels, groups, users (#26)
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: List of user groups & removed repeating code in groups (#29)
* removed repeating code in list groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: list of user group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: otel handler operator name for endpoints
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* add: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: comment
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: sdk function names
Signed-off-by: Arvindh <arvindh91@gmail.com>
* update: api spec
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: channels connect request
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of clients and groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: CLI
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: array len comparision
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: nginx
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
2023-10-17 19:08:06 +05:30
|
|
|
// req := sdk.UsersRelationRequest{
|
|
|
|
// Relation: "viewer", // available options: "owner", "admin", "editor", "viewer"
|
|
|
|
// UserIDs: ["user_id_1", "user_id_2", "user_id_3"]
|
|
|
|
// }
|
|
|
|
// err := sdk.AddUserToChannel("channel_id", req, "token")
|
|
|
|
// fmt.Println(err)
|
|
|
|
AddUserToChannel(channelID string, req UsersRelationRequest, token string) errors.SDKError
|
2023-06-14 12:40:37 +02:00
|
|
|
|
NOISSUE: Listing of shared things with users & Update SDK (#1923)
* NOISSUE - Fix Bugs (#20)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add Connect Disconnect endpoints (#23)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Things share with users (#25)
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: things share with other users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Listing of things, channels, groups, users (#26)
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: List of user groups & removed repeating code in groups (#29)
* removed repeating code in list groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: list of user group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: otel handler operator name for endpoints
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* add: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: comment
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: sdk function names
Signed-off-by: Arvindh <arvindh91@gmail.com>
* update: api spec
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: channels connect request
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of clients and groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: CLI
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: array len comparision
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: nginx
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
2023-10-17 19:08:06 +05:30
|
|
|
// RemoveUserFromChannel remove user from a group.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
NOISSUE: Listing of shared things with users & Update SDK (#1923)
* NOISSUE - Fix Bugs (#20)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add Connect Disconnect endpoints (#23)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Things share with users (#25)
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: things share with other users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Listing of things, channels, groups, users (#26)
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: List of user groups & removed repeating code in groups (#29)
* removed repeating code in list groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: list of user group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: otel handler operator name for endpoints
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* add: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: comment
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: sdk function names
Signed-off-by: Arvindh <arvindh91@gmail.com>
* update: api spec
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: channels connect request
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of clients and groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: CLI
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: array len comparision
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: nginx
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
2023-10-17 19:08:06 +05:30
|
|
|
// req := sdk.UsersRelationRequest{
|
|
|
|
// Relation: "viewer", // available options: "owner", "admin", "editor", "viewer"
|
|
|
|
// UserIDs: ["user_id_1", "user_id_2", "user_id_3"]
|
|
|
|
// }
|
|
|
|
// err := sdk.RemoveUserFromChannel("channel_id", req, "token")
|
|
|
|
// fmt.Println(err)
|
|
|
|
RemoveUserFromChannel(channelID string, req UsersRelationRequest, token string) errors.SDKError
|
2023-06-14 12:40:37 +02:00
|
|
|
|
NOISSUE: Listing of shared things with users & Update SDK (#1923)
* NOISSUE - Fix Bugs (#20)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add Connect Disconnect endpoints (#23)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Things share with users (#25)
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: things share with other users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Listing of things, channels, groups, users (#26)
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: List of user groups & removed repeating code in groups (#29)
* removed repeating code in list groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: list of user group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: otel handler operator name for endpoints
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* add: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: comment
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: sdk function names
Signed-off-by: Arvindh <arvindh91@gmail.com>
* update: api spec
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: channels connect request
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of clients and groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: CLI
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: array len comparision
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: nginx
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
2023-10-17 19:08:06 +05:30
|
|
|
// ListChannelUsers list all users in a channel .
|
2023-07-28 15:39:13 +03:00
|
|
|
//
|
|
|
|
// example:
|
NOISSUE: Listing of shared things with users & Update SDK (#1923)
* NOISSUE - Fix Bugs (#20)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add Connect Disconnect endpoints (#23)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Things share with users (#25)
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: things share with other users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Listing of things, channels, groups, users (#26)
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: List of user groups & removed repeating code in groups (#29)
* removed repeating code in list groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: list of user group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: otel handler operator name for endpoints
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* add: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: comment
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: sdk function names
Signed-off-by: Arvindh <arvindh91@gmail.com>
* update: api spec
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: channels connect request
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of clients and groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: CLI
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: array len comparision
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: nginx
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
2023-10-17 19:08:06 +05:30
|
|
|
// pm := sdk.PageMetadata{
|
|
|
|
// Offset: 0,
|
|
|
|
// Limit: 10,
|
|
|
|
// Permission: "edit", // available Options: "administrator", "delete", edit", "view", "share", "owner", "admin", "editor", "viewer"
|
|
|
|
// }
|
|
|
|
// users, _ := sdk.ListChannelUsers("channel_id", pm, "token")
|
|
|
|
// fmt.Println(users)
|
|
|
|
ListChannelUsers(channelID string, pm PageMetadata, token string) (UsersPage, errors.SDKError)
|
2023-07-28 15:39:13 +03:00
|
|
|
|
NOISSUE: Listing of shared things with users & Update SDK (#1923)
* NOISSUE - Fix Bugs (#20)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add Connect Disconnect endpoints (#23)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Things share with users (#25)
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: things share with other users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Listing of things, channels, groups, users (#26)
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: List of user groups & removed repeating code in groups (#29)
* removed repeating code in list groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: list of user group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: otel handler operator name for endpoints
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* add: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: comment
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: sdk function names
Signed-off-by: Arvindh <arvindh91@gmail.com>
* update: api spec
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: channels connect request
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of clients and groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: CLI
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: array len comparision
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: nginx
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
2023-10-17 19:08:06 +05:30
|
|
|
// AddUserGroupToChannel add user group to a channel.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
NOISSUE: Listing of shared things with users & Update SDK (#1923)
* NOISSUE - Fix Bugs (#20)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add Connect Disconnect endpoints (#23)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Things share with users (#25)
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: things share with other users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Listing of things, channels, groups, users (#26)
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: List of user groups & removed repeating code in groups (#29)
* removed repeating code in list groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: list of user group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: otel handler operator name for endpoints
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* add: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: comment
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: sdk function names
Signed-off-by: Arvindh <arvindh91@gmail.com>
* update: api spec
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: channels connect request
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of clients and groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: CLI
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: array len comparision
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: nginx
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
2023-10-17 19:08:06 +05:30
|
|
|
// req := sdk.UserGroupsRequest{
|
|
|
|
// GroupsIDs: ["group_id_1", "group_id_2", "group_id_3"]
|
|
|
|
// }
|
|
|
|
// err := sdk.AddUserGroupToChannel("channel_id",req, "token")
|
|
|
|
// fmt.Println(err)
|
|
|
|
AddUserGroupToChannel(channelID string, req UserGroupsRequest, token string) errors.SDKError
|
2023-06-14 12:40:37 +02:00
|
|
|
|
NOISSUE: Listing of shared things with users & Update SDK (#1923)
* NOISSUE - Fix Bugs (#20)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add Connect Disconnect endpoints (#23)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Things share with users (#25)
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: things share with other users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Listing of things, channels, groups, users (#26)
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: List of user groups & removed repeating code in groups (#29)
* removed repeating code in list groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: list of user group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: otel handler operator name for endpoints
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* add: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: comment
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: sdk function names
Signed-off-by: Arvindh <arvindh91@gmail.com>
* update: api spec
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: channels connect request
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of clients and groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: CLI
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: array len comparision
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: nginx
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
2023-10-17 19:08:06 +05:30
|
|
|
// RemoveUserGroupFromChannel remove user group from a channel.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
NOISSUE: Listing of shared things with users & Update SDK (#1923)
* NOISSUE - Fix Bugs (#20)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add Connect Disconnect endpoints (#23)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Things share with users (#25)
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: things share with other users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Listing of things, channels, groups, users (#26)
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: List of user groups & removed repeating code in groups (#29)
* removed repeating code in list groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: list of user group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: otel handler operator name for endpoints
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* add: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: comment
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: sdk function names
Signed-off-by: Arvindh <arvindh91@gmail.com>
* update: api spec
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: channels connect request
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of clients and groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: CLI
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: array len comparision
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: nginx
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
2023-10-17 19:08:06 +05:30
|
|
|
// req := sdk.UserGroupsRequest{
|
|
|
|
// GroupsIDs: ["group_id_1", "group_id_2", "group_id_3"]
|
|
|
|
// }
|
|
|
|
// err := sdk.RemoveUserGroupFromChannel("channel_id",req, "token")
|
|
|
|
// fmt.Println(err)
|
|
|
|
RemoveUserGroupFromChannel(channelID string, req UserGroupsRequest, token string) errors.SDKError
|
2023-06-14 12:40:37 +02:00
|
|
|
|
NOISSUE: Listing of shared things with users & Update SDK (#1923)
* NOISSUE - Fix Bugs (#20)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add Connect Disconnect endpoints (#23)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Things share with users (#25)
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: things share with other users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Listing of things, channels, groups, users (#26)
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: List of user groups & removed repeating code in groups (#29)
* removed repeating code in list groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: list of user group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: otel handler operator name for endpoints
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* add: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: comment
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: sdk function names
Signed-off-by: Arvindh <arvindh91@gmail.com>
* update: api spec
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: channels connect request
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of clients and groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: CLI
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: array len comparision
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: nginx
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
2023-10-17 19:08:06 +05:30
|
|
|
// ListChannelUserGroups list all user groups in a channel.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
NOISSUE: Listing of shared things with users & Update SDK (#1923)
* NOISSUE - Fix Bugs (#20)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add Connect Disconnect endpoints (#23)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Things share with users (#25)
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: things share with other users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Listing of things, channels, groups, users (#26)
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: List of user groups & removed repeating code in groups (#29)
* removed repeating code in list groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: list of user group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: otel handler operator name for endpoints
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* add: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: comment
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: sdk function names
Signed-off-by: Arvindh <arvindh91@gmail.com>
* update: api spec
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: channels connect request
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of clients and groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: CLI
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: array len comparision
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: nginx
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
2023-10-17 19:08:06 +05:30
|
|
|
// pm := sdk.PageMetadata{
|
|
|
|
// Offset: 0,
|
|
|
|
// Limit: 10,
|
|
|
|
// Permission: "view",
|
|
|
|
// }
|
|
|
|
// groups, _ := sdk.ListChannelUserGroups("channel_id_1", pm, "token")
|
|
|
|
// fmt.Println(groups)
|
|
|
|
ListChannelUserGroups(channelID string, pm PageMetadata, token string) (GroupsPage, errors.SDKError)
|
2023-06-14 12:40:37 +02:00
|
|
|
|
|
|
|
// Connect bulk connects things to channels specified by id.
|
|
|
|
//
|
|
|
|
// example:
|
NOISSUE - Switch to Google Zanzibar Access control approach (#1919)
* Return Auth service
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update Compose to run with SpiceDB and Auth svc
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update auth gRPC API
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Remove Users' policies
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Move Groups to internal
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Use shared groups in Users
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Remove unused code
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Use pkg Groups in Things
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Remove Things groups
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Make imports consistent
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update Groups networking
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Remove things groups-specific API
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Move Things Clients to the root
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Move Clients to Users root
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Temporarily remove tracing
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Fix imports
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Add buffer config for gRPC
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update auth type for Things
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Use Auth for login
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Add temporary solution for refresh token
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update Tokenizer interface
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Updade tokens issuing
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Fix token issuing
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update JWT validator and refactor Tokenizer
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Rename access timeout
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Rename login to authenticate
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update Identify to use SubjectID
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Add Auth to Groups
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Use the Auth service for Groups
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update auth schema
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Fix Auth for Groups
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Add auth for addons (#14)
Signed-off-by: Arvindh <arvindh91@gmail.com>
Speparate Login and Refresh tokens
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Merge authN and authZ requests for things
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Add connect and disconnect
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update sharing
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Fix policies addition and removal
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update relation with roels
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Add gRPC to Things
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Assign and Unassign members to group and Listing of Group members (#15)
* add auth for addons
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add assign and unassign to group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add group incomplete repo implementation
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Move coap mqtt and ws policies to spicedb (#16)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Remove old policies
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
NOISSUE - Things authorize to return thingID (#18)
This commit modifies the authorize endpoint to the grpc endpoint to return thingID. The authorize endpoint allows adapters to get the publisher of the message.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Add Groups to users service (#17)
* add assign and unassign to group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add group incomplete repo implementation
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users stable 1
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users stable 2
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users & things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* Amend signature
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix merge error
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Fix es code (#21)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Fix Bugs (#20)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Test e2e (#19)
* fix: connect method
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* fix: e2e
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* fix changes in sdk and e2e
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(docker): remove unnecessary port mapping
Remove the port mapping for MQTT broker in the docker-compose.yml file.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* Enable group listing
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(responses): update ChannelsPage struct
The ChannelsPage struct in the responses.go file has been updated. The "Channels" field has been renamed to "Groups" to provide more accurate naming. This change ensures consistency and clarity in the codebase.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(things): add UpdateClientSecret method
Add the UpdateClientSecret method to the things service. This method allows updating the client secret for a specific client identified by the provided token, id, and key parameters.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
---------
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Use smaller buffers for gRPC
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Clean up tests (#22)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add Connect Disconnect endpoints (#23)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Things share with users (#25)
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: things share with other users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Rename gRPC Services (#24)
* Rename things and users auth service
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* docs: add authorization docs for gRPC services
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* Rename things and users grpc services
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* Remove mainflux.env package
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
---------
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Listing of things, channels, groups, users (#26)
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Clean Up Users (#27)
* feat(groups): rename redis package to events
- Renamed the `redis` package to `events` in the `internal/groups` directory.
- Updated the file paths and names accordingly.
- This change reflects the more accurate purpose of the package and improves code organization.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(auth): Modify identity method
Change request and response of identity method
Add accessToken and refreshToken to Token response
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* clean up users, remove dead code
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(users): add unit tests for user service
This commit adds unit tests for the user service in the `users` package. The tests cover various scenarios and ensure the correct behavior of the service.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
---------
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: List of user groups & removed repeating code in groups (#29)
* removed repeating code in list groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: list of user group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: otel handler operator name for endpoints
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Clean Up Things Service (#28)
* Rework things service
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* add tests
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
---------
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Clean Up Auth Service (#30)
* clean up auth service
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(auth): remove unused import
Remove the unused import of `emptypb` in `auth.pb.go`. This import is not being used in the codebase and can be safely removed.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
---------
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Update API docs (#31)
Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Remove TODO comments and cleanup the code
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Update dependenices
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
Co-authored-by: b1ackd0t <28790446+rodneyosodo@users.noreply.github.com>
Co-authored-by: Arvindh <30824765+arvindh123@users.noreply.github.com>
2023-10-15 22:02:13 +02:00
|
|
|
// conns := sdk.Connection{
|
NOISSUE: Listing of shared things with users & Update SDK (#1923)
* NOISSUE - Fix Bugs (#20)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add Connect Disconnect endpoints (#23)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Things share with users (#25)
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: things share with other users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Listing of things, channels, groups, users (#26)
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: List of user groups & removed repeating code in groups (#29)
* removed repeating code in list groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: list of user group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: otel handler operator name for endpoints
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* add: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: comment
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: sdk function names
Signed-off-by: Arvindh <arvindh91@gmail.com>
* update: api spec
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: channels connect request
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of clients and groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: CLI
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: array len comparision
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: nginx
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
2023-10-17 19:08:06 +05:30
|
|
|
// ChannelID: "channel_id_1",
|
|
|
|
// ThingID: "thing_id_1",
|
2023-06-14 12:40:37 +02:00
|
|
|
// }
|
|
|
|
// err := sdk.Connect(conns, "token")
|
|
|
|
// fmt.Println(err)
|
NOISSUE - Switch to Google Zanzibar Access control approach (#1919)
* Return Auth service
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update Compose to run with SpiceDB and Auth svc
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update auth gRPC API
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Remove Users' policies
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Move Groups to internal
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Use shared groups in Users
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Remove unused code
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Use pkg Groups in Things
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Remove Things groups
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Make imports consistent
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update Groups networking
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Remove things groups-specific API
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Move Things Clients to the root
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Move Clients to Users root
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Temporarily remove tracing
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Fix imports
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Add buffer config for gRPC
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update auth type for Things
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Use Auth for login
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Add temporary solution for refresh token
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update Tokenizer interface
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Updade tokens issuing
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Fix token issuing
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update JWT validator and refactor Tokenizer
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Rename access timeout
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Rename login to authenticate
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update Identify to use SubjectID
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Add Auth to Groups
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Use the Auth service for Groups
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update auth schema
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Fix Auth for Groups
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Add auth for addons (#14)
Signed-off-by: Arvindh <arvindh91@gmail.com>
Speparate Login and Refresh tokens
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Merge authN and authZ requests for things
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Add connect and disconnect
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update sharing
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Fix policies addition and removal
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update relation with roels
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Add gRPC to Things
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Assign and Unassign members to group and Listing of Group members (#15)
* add auth for addons
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add assign and unassign to group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add group incomplete repo implementation
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Move coap mqtt and ws policies to spicedb (#16)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Remove old policies
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
NOISSUE - Things authorize to return thingID (#18)
This commit modifies the authorize endpoint to the grpc endpoint to return thingID. The authorize endpoint allows adapters to get the publisher of the message.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Add Groups to users service (#17)
* add assign and unassign to group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add group incomplete repo implementation
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users stable 1
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users stable 2
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users & things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* Amend signature
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix merge error
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Fix es code (#21)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Fix Bugs (#20)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Test e2e (#19)
* fix: connect method
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* fix: e2e
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* fix changes in sdk and e2e
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(docker): remove unnecessary port mapping
Remove the port mapping for MQTT broker in the docker-compose.yml file.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* Enable group listing
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(responses): update ChannelsPage struct
The ChannelsPage struct in the responses.go file has been updated. The "Channels" field has been renamed to "Groups" to provide more accurate naming. This change ensures consistency and clarity in the codebase.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(things): add UpdateClientSecret method
Add the UpdateClientSecret method to the things service. This method allows updating the client secret for a specific client identified by the provided token, id, and key parameters.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
---------
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Use smaller buffers for gRPC
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Clean up tests (#22)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add Connect Disconnect endpoints (#23)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Things share with users (#25)
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: things share with other users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Rename gRPC Services (#24)
* Rename things and users auth service
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* docs: add authorization docs for gRPC services
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* Rename things and users grpc services
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* Remove mainflux.env package
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
---------
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Listing of things, channels, groups, users (#26)
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Clean Up Users (#27)
* feat(groups): rename redis package to events
- Renamed the `redis` package to `events` in the `internal/groups` directory.
- Updated the file paths and names accordingly.
- This change reflects the more accurate purpose of the package and improves code organization.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(auth): Modify identity method
Change request and response of identity method
Add accessToken and refreshToken to Token response
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* clean up users, remove dead code
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(users): add unit tests for user service
This commit adds unit tests for the user service in the `users` package. The tests cover various scenarios and ensure the correct behavior of the service.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
---------
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: List of user groups & removed repeating code in groups (#29)
* removed repeating code in list groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: list of user group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: otel handler operator name for endpoints
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Clean Up Things Service (#28)
* Rework things service
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* add tests
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
---------
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Clean Up Auth Service (#30)
* clean up auth service
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(auth): remove unused import
Remove the unused import of `emptypb` in `auth.pb.go`. This import is not being used in the codebase and can be safely removed.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
---------
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Update API docs (#31)
Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Remove TODO comments and cleanup the code
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Update dependenices
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
Co-authored-by: b1ackd0t <28790446+rodneyosodo@users.noreply.github.com>
Co-authored-by: Arvindh <30824765+arvindh123@users.noreply.github.com>
2023-10-15 22:02:13 +02:00
|
|
|
Connect(conns Connection, token string) errors.SDKError
|
2023-06-14 12:40:37 +02:00
|
|
|
|
|
|
|
// Disconnect
|
|
|
|
//
|
|
|
|
// example:
|
NOISSUE - Switch to Google Zanzibar Access control approach (#1919)
* Return Auth service
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update Compose to run with SpiceDB and Auth svc
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update auth gRPC API
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Remove Users' policies
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Move Groups to internal
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Use shared groups in Users
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Remove unused code
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Use pkg Groups in Things
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Remove Things groups
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Make imports consistent
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update Groups networking
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Remove things groups-specific API
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Move Things Clients to the root
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Move Clients to Users root
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Temporarily remove tracing
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Fix imports
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Add buffer config for gRPC
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update auth type for Things
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Use Auth for login
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Add temporary solution for refresh token
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update Tokenizer interface
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Updade tokens issuing
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Fix token issuing
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update JWT validator and refactor Tokenizer
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Rename access timeout
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Rename login to authenticate
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update Identify to use SubjectID
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Add Auth to Groups
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Use the Auth service for Groups
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update auth schema
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Fix Auth for Groups
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Add auth for addons (#14)
Signed-off-by: Arvindh <arvindh91@gmail.com>
Speparate Login and Refresh tokens
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Merge authN and authZ requests for things
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Add connect and disconnect
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update sharing
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Fix policies addition and removal
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update relation with roels
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Add gRPC to Things
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Assign and Unassign members to group and Listing of Group members (#15)
* add auth for addons
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add assign and unassign to group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add group incomplete repo implementation
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Move coap mqtt and ws policies to spicedb (#16)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Remove old policies
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
NOISSUE - Things authorize to return thingID (#18)
This commit modifies the authorize endpoint to the grpc endpoint to return thingID. The authorize endpoint allows adapters to get the publisher of the message.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Add Groups to users service (#17)
* add assign and unassign to group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add group incomplete repo implementation
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users stable 1
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users stable 2
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users & things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* Amend signature
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix merge error
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Fix es code (#21)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Fix Bugs (#20)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Test e2e (#19)
* fix: connect method
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* fix: e2e
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* fix changes in sdk and e2e
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(docker): remove unnecessary port mapping
Remove the port mapping for MQTT broker in the docker-compose.yml file.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* Enable group listing
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(responses): update ChannelsPage struct
The ChannelsPage struct in the responses.go file has been updated. The "Channels" field has been renamed to "Groups" to provide more accurate naming. This change ensures consistency and clarity in the codebase.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(things): add UpdateClientSecret method
Add the UpdateClientSecret method to the things service. This method allows updating the client secret for a specific client identified by the provided token, id, and key parameters.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
---------
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Use smaller buffers for gRPC
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Clean up tests (#22)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add Connect Disconnect endpoints (#23)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Things share with users (#25)
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: things share with other users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Rename gRPC Services (#24)
* Rename things and users auth service
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* docs: add authorization docs for gRPC services
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* Rename things and users grpc services
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* Remove mainflux.env package
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
---------
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Listing of things, channels, groups, users (#26)
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Clean Up Users (#27)
* feat(groups): rename redis package to events
- Renamed the `redis` package to `events` in the `internal/groups` directory.
- Updated the file paths and names accordingly.
- This change reflects the more accurate purpose of the package and improves code organization.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(auth): Modify identity method
Change request and response of identity method
Add accessToken and refreshToken to Token response
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* clean up users, remove dead code
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(users): add unit tests for user service
This commit adds unit tests for the user service in the `users` package. The tests cover various scenarios and ensure the correct behavior of the service.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
---------
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: List of user groups & removed repeating code in groups (#29)
* removed repeating code in list groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: list of user group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: otel handler operator name for endpoints
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Clean Up Things Service (#28)
* Rework things service
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* add tests
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
---------
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Clean Up Auth Service (#30)
* clean up auth service
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(auth): remove unused import
Remove the unused import of `emptypb` in `auth.pb.go`. This import is not being used in the codebase and can be safely removed.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
---------
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Update API docs (#31)
Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Remove TODO comments and cleanup the code
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Update dependenices
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
Co-authored-by: b1ackd0t <28790446+rodneyosodo@users.noreply.github.com>
Co-authored-by: Arvindh <30824765+arvindh123@users.noreply.github.com>
2023-10-15 22:02:13 +02:00
|
|
|
// conns := sdk.Connection{
|
NOISSUE: Listing of shared things with users & Update SDK (#1923)
* NOISSUE - Fix Bugs (#20)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add Connect Disconnect endpoints (#23)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Things share with users (#25)
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: things share with other users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Listing of things, channels, groups, users (#26)
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: List of user groups & removed repeating code in groups (#29)
* removed repeating code in list groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: list of user group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: otel handler operator name for endpoints
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* add: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of shared things and users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: new SDK
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: comment
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: sdk function names
Signed-off-by: Arvindh <arvindh91@gmail.com>
* update: api spec
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: channels connect request
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: listing of clients and groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: CLI
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: array len comparision
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: nginx
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
2023-10-17 19:08:06 +05:30
|
|
|
// ChannelID: "channel_id_1",
|
|
|
|
// ThingID: "thing_id_1",
|
2023-06-14 12:40:37 +02:00
|
|
|
// }
|
|
|
|
// err := sdk.Disconnect(conns, "token")
|
|
|
|
// fmt.Println(err)
|
NOISSUE - Switch to Google Zanzibar Access control approach (#1919)
* Return Auth service
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update Compose to run with SpiceDB and Auth svc
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update auth gRPC API
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Remove Users' policies
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Move Groups to internal
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Use shared groups in Users
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Remove unused code
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Use pkg Groups in Things
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Remove Things groups
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Make imports consistent
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update Groups networking
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Remove things groups-specific API
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Move Things Clients to the root
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Move Clients to Users root
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Temporarily remove tracing
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Fix imports
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Add buffer config for gRPC
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update auth type for Things
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Use Auth for login
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Add temporary solution for refresh token
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update Tokenizer interface
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Updade tokens issuing
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Fix token issuing
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update JWT validator and refactor Tokenizer
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Rename access timeout
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Rename login to authenticate
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update Identify to use SubjectID
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Add Auth to Groups
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Use the Auth service for Groups
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update auth schema
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Fix Auth for Groups
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Add auth for addons (#14)
Signed-off-by: Arvindh <arvindh91@gmail.com>
Speparate Login and Refresh tokens
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Merge authN and authZ requests for things
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Add connect and disconnect
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update sharing
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Fix policies addition and removal
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Update relation with roels
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Add gRPC to Things
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Assign and Unassign members to group and Listing of Group members (#15)
* add auth for addons
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add assign and unassign to group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add group incomplete repo implementation
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Move coap mqtt and ws policies to spicedb (#16)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Remove old policies
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
NOISSUE - Things authorize to return thingID (#18)
This commit modifies the authorize endpoint to the grpc endpoint to return thingID. The authorize endpoint allows adapters to get the publisher of the message.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Add Groups to users service (#17)
* add assign and unassign to group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add group incomplete repo implementation
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users stable 1
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users stable 2
Signed-off-by: Arvindh <arvindh91@gmail.com>
* groups for users & things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* Amend signature
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix merge error
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Fix es code (#21)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Fix Bugs (#20)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Test e2e (#19)
* fix: connect method
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* fix: e2e
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* fix changes in sdk and e2e
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(docker): remove unnecessary port mapping
Remove the port mapping for MQTT broker in the docker-compose.yml file.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* Enable group listing
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(responses): update ChannelsPage struct
The ChannelsPage struct in the responses.go file has been updated. The "Channels" field has been renamed to "Groups" to provide more accurate naming. This change ensures consistency and clarity in the codebase.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(things): add UpdateClientSecret method
Add the UpdateClientSecret method to the things service. This method allows updating the client secret for a specific client identified by the provided token, id, and key parameters.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
---------
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Use smaller buffers for gRPC
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Clean up tests (#22)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add Connect Disconnect endpoints (#23)
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix bugs
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Things share with users (#25)
* fix list of things in a channel and Add connect disconnect endpoint
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: things share with other users
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Rename gRPC Services (#24)
* Rename things and users auth service
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* docs: add authorization docs for gRPC services
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* Rename things and users grpc services
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* Remove mainflux.env package
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
---------
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: Listing of things, channels, groups, users (#26)
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: listing of channels, users, groups, things
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Clean Up Users (#27)
* feat(groups): rename redis package to events
- Renamed the `redis` package to `events` in the `internal/groups` directory.
- Updated the file paths and names accordingly.
- This change reflects the more accurate purpose of the package and improves code organization.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(auth): Modify identity method
Change request and response of identity method
Add accessToken and refreshToken to Token response
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* clean up users, remove dead code
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(users): add unit tests for user service
This commit adds unit tests for the user service in the `users` package. The tests cover various scenarios and ensure the correct behavior of the service.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
---------
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Add: List of user groups & removed repeating code in groups (#29)
* removed repeating code in list groups
Signed-off-by: Arvindh <arvindh91@gmail.com>
* add: list of user group
Signed-off-by: Arvindh <arvindh91@gmail.com>
* fix: otel handler operator name for endpoints
Signed-off-by: Arvindh <arvindh91@gmail.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Clean Up Things Service (#28)
* Rework things service
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* add tests
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
---------
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Clean Up Auth Service (#30)
* clean up auth service
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
* feat(auth): remove unused import
Remove the unused import of `emptypb` in `auth.pb.go`. This import is not being used in the codebase and can be safely removed.
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
---------
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* NOISSUE - Update API docs (#31)
Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Remove TODO comments and cleanup the code
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
* Update dependenices
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
---------
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
Co-authored-by: b1ackd0t <28790446+rodneyosodo@users.noreply.github.com>
Co-authored-by: Arvindh <30824765+arvindh123@users.noreply.github.com>
2023-10-15 22:02:13 +02:00
|
|
|
Disconnect(connIDs Connection, token string) errors.SDKError
|
2023-06-14 12:40:37 +02:00
|
|
|
|
2023-07-28 15:39:13 +03:00
|
|
|
// ConnectThing connects thing to specified channel by id.
|
|
|
|
//
|
|
|
|
// The `ConnectThing` method calls the `CreateThingPolicy` method under the hood.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// err := sdk.ConnectThing("thingID", "channelID", "token")
|
|
|
|
// fmt.Println(err)
|
|
|
|
ConnectThing(thingID, chanID, token string) errors.SDKError
|
|
|
|
|
|
|
|
// DisconnectThing disconnect thing from specified channel by id.
|
|
|
|
//
|
2023-07-28 15:39:13 +03:00
|
|
|
// The `DisconnectThing` method calls the `DeleteThingPolicy` method under the hood.
|
|
|
|
//
|
2023-06-14 12:40:37 +02:00
|
|
|
// example:
|
|
|
|
// err := sdk.DisconnectThing("thingID", "channelID", "token")
|
|
|
|
// fmt.Println(err)
|
|
|
|
DisconnectThing(thingID, chanID, token string) errors.SDKError
|
|
|
|
|
2018-10-24 11:21:03 +02:00
|
|
|
// SendMessage send message to specified channel.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// msg := '[{"bn":"some-base-name:","bt":1.276020076001e+09, "bu":"A","bver":5, "n":"voltage","u":"V","v":120.1}, {"n":"current","t":-5,"v":1.2}, {"n":"current","t":-4,"v":1.3}]'
|
|
|
|
// err := sdk.SendMessage("channelID", msg, "thingSecret")
|
|
|
|
// fmt.Println(err)
|
2023-01-05 19:20:05 +03:00
|
|
|
SendMessage(chanID, msg, key string) errors.SDKError
|
2018-10-24 11:21:03 +02:00
|
|
|
|
2019-02-06 13:57:12 +01:00
|
|
|
// ReadMessages read messages of specified channel.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// msgs, _ := sdk.ReadMessages("channelID", "token")
|
|
|
|
// fmt.Println(msgs)
|
2022-12-15 07:24:19 -08:00
|
|
|
ReadMessages(chanID, token string) (MessagesPage, errors.SDKError)
|
2018-12-18 22:04:34 +01:00
|
|
|
|
2018-10-24 11:21:03 +02:00
|
|
|
// SetContentType sets message content type.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// err := sdk.SetContentType("application/json")
|
|
|
|
// fmt.Println(err)
|
2022-12-15 07:24:19 -08:00
|
|
|
SetContentType(ct ContentType) errors.SDKError
|
2018-10-24 11:21:03 +02:00
|
|
|
|
2023-08-08 15:42:32 +03:00
|
|
|
// Health returns service health check.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
2023-08-08 15:42:32 +03:00
|
|
|
// health, _ := sdk.Health("service")
|
2023-06-14 12:40:37 +02:00
|
|
|
// fmt.Println(health)
|
2023-08-08 15:42:32 +03:00
|
|
|
Health(service string) (HealthInfo, errors.SDKError)
|
2020-04-15 17:38:20 +02:00
|
|
|
|
2020-05-06 16:53:32 +02:00
|
|
|
// AddBootstrap add bootstrap configuration
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// cfg := sdk.BootstrapConfig{
|
|
|
|
// ThingID: "thingID",
|
|
|
|
// Name: "bootstrap",
|
|
|
|
// ExternalID: "externalID",
|
|
|
|
// ExternalKey: "externalKey",
|
|
|
|
// Channels: []string{"channel1", "channel2"},
|
|
|
|
// }
|
|
|
|
// id, _ := sdk.AddBootstrap(cfg, "token")
|
|
|
|
// fmt.Println(id)
|
2023-01-05 19:20:05 +03:00
|
|
|
AddBootstrap(cfg BootstrapConfig, token string) (string, errors.SDKError)
|
2020-04-15 17:38:20 +02:00
|
|
|
|
2020-04-29 20:05:08 +02:00
|
|
|
// View returns Thing Config with given ID belonging to the user identified by the given token.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// bootstrap, _ := sdk.ViewBootstrap("id", "token")
|
|
|
|
// fmt.Println(bootstrap)
|
2023-01-05 19:20:05 +03:00
|
|
|
ViewBootstrap(id, token string) (BootstrapConfig, errors.SDKError)
|
2020-04-15 17:38:20 +02:00
|
|
|
|
|
|
|
// Update updates editable fields of the provided Config.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// cfg := sdk.BootstrapConfig{
|
|
|
|
// ThingID: "thingID",
|
|
|
|
// Name: "bootstrap",
|
|
|
|
// ExternalID: "externalID",
|
|
|
|
// ExternalKey: "externalKey",
|
|
|
|
// Channels: []string{"channel1", "channel2"},
|
|
|
|
// }
|
|
|
|
// err := sdk.UpdateBootstrap(cfg, "token")
|
|
|
|
// fmt.Println(err)
|
2023-01-05 19:20:05 +03:00
|
|
|
UpdateBootstrap(cfg BootstrapConfig, token string) errors.SDKError
|
2020-04-15 17:38:20 +02:00
|
|
|
|
2023-06-14 12:40:37 +02:00
|
|
|
// Update bootstrap config certificates.
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// err := sdk.UpdateBootstrapCerts("id", "clientCert", "clientKey", "ca", "token")
|
|
|
|
// fmt.Println(err)
|
2023-07-31 15:17:14 +03:00
|
|
|
UpdateBootstrapCerts(id string, clientCert, clientKey, ca string, token string) (BootstrapConfig, errors.SDKError)
|
2020-07-29 14:20:43 +02:00
|
|
|
|
2023-05-25 06:02:46 +08:00
|
|
|
// UpdateBootstrapConnection updates connections performs update of the channel list corresponding Thing is connected to.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// err := sdk.UpdateBootstrapConnection("id", []string{"channel1", "channel2"}, "token")
|
|
|
|
// fmt.Println(err)
|
2023-05-25 06:02:46 +08:00
|
|
|
UpdateBootstrapConnection(id string, channels []string, token string) errors.SDKError
|
|
|
|
|
2020-04-29 20:05:08 +02:00
|
|
|
// Remove removes Config with specified token that belongs to the user identified by the given token.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// err := sdk.RemoveBootstrap("id", "token")
|
|
|
|
// fmt.Println(err)
|
2023-01-05 19:20:05 +03:00
|
|
|
RemoveBootstrap(id, token string) errors.SDKError
|
2020-04-15 17:38:20 +02:00
|
|
|
|
2020-04-29 20:05:08 +02:00
|
|
|
// Bootstrap returns Config to the Thing with provided external ID using external key.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// bootstrap, _ := sdk.Bootstrap("externalID", "externalKey")
|
|
|
|
// fmt.Println(bootstrap)
|
2023-01-10 13:13:09 +03:00
|
|
|
Bootstrap(externalID, externalKey string) (BootstrapConfig, errors.SDKError)
|
2020-04-29 00:39:23 +02:00
|
|
|
|
2023-05-25 06:02:46 +08:00
|
|
|
// BootstrapSecure retrieves a configuration with given external ID and encrypted external key.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// bootstrap, _ := sdk.BootstrapSecure("externalID", "externalKey")
|
|
|
|
// fmt.Println(bootstrap)
|
2023-05-25 06:02:46 +08:00
|
|
|
BootstrapSecure(externalID, externalKey string) (BootstrapConfig, errors.SDKError)
|
|
|
|
|
|
|
|
// Bootstraps retrieves a list of managed configs.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// pm := sdk.PageMetadata{
|
|
|
|
// Offset: 0,
|
|
|
|
// Limit: 10,
|
|
|
|
// }
|
|
|
|
// bootstraps, _ := sdk.Bootstraps(pm, "token")
|
|
|
|
// fmt.Println(bootstraps)
|
2023-07-13 13:52:39 +03:00
|
|
|
Bootstraps(pm PageMetadata, token string) (BootstrapPage, errors.SDKError)
|
2023-05-25 06:02:46 +08:00
|
|
|
|
2020-04-29 00:39:23 +02:00
|
|
|
// Whitelist updates Thing state Config with given ID belonging to the user identified by the given token.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// cfg := sdk.BootstrapConfig{
|
|
|
|
// ThingID: "thingID",
|
|
|
|
// Name: "bootstrap",
|
|
|
|
// ExternalID: "externalID",
|
|
|
|
// ExternalKey: "externalKey",
|
|
|
|
// Channels: []string{"channel1", "channel2"},
|
|
|
|
// }
|
|
|
|
// err := sdk.Whitelist(cfg, "token")
|
|
|
|
// fmt.Println(err)
|
2023-01-05 19:20:05 +03:00
|
|
|
Whitelist(cfg BootstrapConfig, token string) errors.SDKError
|
2020-04-29 00:39:23 +02:00
|
|
|
|
2023-06-14 12:40:37 +02:00
|
|
|
// IssueCert issues a certificate for a thing required for mTLS.
|
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// cert, _ := sdk.IssueCert("thingID", "valid", "token")
|
|
|
|
// fmt.Println(cert)
|
2023-01-13 16:33:00 +03:00
|
|
|
IssueCert(thingID, valid, token string) (Cert, errors.SDKError)
|
2020-04-29 00:39:23 +02:00
|
|
|
|
2023-01-13 16:33:00 +03:00
|
|
|
// ViewCert returns a certificate given certificate ID
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// cert, _ := sdk.ViewCert("certID", "token")
|
|
|
|
// fmt.Println(cert)
|
2023-01-13 16:33:00 +03:00
|
|
|
ViewCert(certID, token string) (Cert, errors.SDKError)
|
MF-1179 - Add a certificate service and certs endpoint to SDK (#1188)
* adding certificate issuing
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* adding cert endpoint
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* update envs
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* update envs
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* move certs creation to sdk
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* move certs creation to sdk
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* move certs creation to sdk
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* fix env vars
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* add comment
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* update sdk
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* fix vars
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* add volumes
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* fix merge config for int
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* remove env
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* fix error handling
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* add cert test, change receiver to pointer
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* add docs
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* fix var naming
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* correct error naming
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* adding certs service
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* add certs
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* add certs
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* change func receiever
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* add default cert issue method
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* add config
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* small fix
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* remove some testing code
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* add cert issue
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* add vault api client
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* additional endpoints
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* add swagger for certs
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* remove certs from provision
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* clean provision from certs
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* add list certificates endpoint
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* add vault api in vendor
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* add certs
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* add revoke, fix bugs
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* fix sdk for certs
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* minor changes, add env, doc
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* minor changes, add env, doc
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* minor changes, add env, doc
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* small changes
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* remove CA for signing from provision
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* add docker file for certs
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* fix mock sdk
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* add line
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* fix RevokeCert
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* renam ENV
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* remove tests temporarily
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* fix naming
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* renam vars
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* add cli for issue cert
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* add cli for issue cert
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* add cli for issue cert
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* add cli for issue cert
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* remove not needed envs
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* fix linter errors, add cli
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* fix linter errors, add cli, var rename
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* fix reviews, add viewcert, fix view all certs
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* remove view cert, as it will be retrieved from PKI
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* change endpoints
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* add default env val
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* remove some errors
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* refactor, make wrapper lib for vault
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* refactor, make wrapper lib for vault
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* refactor, make wrapper lib for vault
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* fix revoking
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* refactor, make wrapper lib for vault
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* update vendor
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* fix comment
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* add comments
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* remove unused
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* remove unused field
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* update vendor
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* refactor pki
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* refactor pki
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* refactor pki, update vendor
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* refactor pki
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* fix comment
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* minor fix
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* remove methods, use fields
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* fix comments and package desc
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
* fix comments and package desc
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
2020-07-21 12:53:21 +02:00
|
|
|
|
2023-05-25 06:02:46 +08:00
|
|
|
// ViewCertByThing retrieves a list of certificates' serial IDs for a given thing ID.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// cserial, _ := sdk.ViewCertByThing("thingID", "token")
|
|
|
|
// fmt.Println(cserial)
|
2023-05-25 06:02:46 +08:00
|
|
|
ViewCertByThing(thingID, token string) (CertSerials, errors.SDKError)
|
|
|
|
|
2023-01-13 16:33:00 +03:00
|
|
|
// RevokeCert revokes certificate for thing with thingID
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// tm, _ := sdk.RevokeCert("thingID", "token")
|
|
|
|
// fmt.Println(tm)
|
2023-01-13 16:33:00 +03:00
|
|
|
RevokeCert(thingID, token string) (time.Time, errors.SDKError)
|
2022-01-12 13:24:51 +01:00
|
|
|
|
2023-05-25 06:02:46 +08:00
|
|
|
// CreateSubscription creates a new subscription
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// subscription, _ := sdk.CreateSubscription("topic", "contact", "token")
|
|
|
|
// fmt.Println(subscription)
|
2023-05-25 06:02:46 +08:00
|
|
|
CreateSubscription(topic, contact, token string) (string, errors.SDKError)
|
|
|
|
|
|
|
|
// ListSubscriptions list subscriptions given list parameters.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// pm := sdk.PageMetadata{
|
|
|
|
// Offset: 0,
|
|
|
|
// Limit: 10,
|
|
|
|
// }
|
|
|
|
// subscriptions, _ := sdk.ListSubscriptions(pm, "token")
|
|
|
|
// fmt.Println(subscriptions)
|
2023-05-25 06:02:46 +08:00
|
|
|
ListSubscriptions(pm PageMetadata, token string) (SubscriptionPage, errors.SDKError)
|
|
|
|
|
|
|
|
// ViewSubscription retrieves a subscription with the provided id.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// subscription, _ := sdk.ViewSubscription("id", "token")
|
|
|
|
// fmt.Println(subscription)
|
2023-05-25 06:02:46 +08:00
|
|
|
ViewSubscription(id, token string) (Subscription, errors.SDKError)
|
|
|
|
|
|
|
|
// DeleteSubscription removes a subscription with the provided id.
|
2023-06-14 12:40:37 +02:00
|
|
|
//
|
|
|
|
// example:
|
|
|
|
// err := sdk.DeleteSubscription("id", "token")
|
|
|
|
// fmt.Println(err)
|
2023-05-25 06:02:46 +08:00
|
|
|
DeleteSubscription(id, token string) errors.SDKError
|
2018-10-24 11:21:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type mfSDK struct {
|
2021-08-11 16:58:10 +02:00
|
|
|
bootstrapURL string
|
|
|
|
certsURL string
|
|
|
|
httpAdapterURL string
|
|
|
|
readerURL string
|
|
|
|
thingsURL string
|
|
|
|
usersURL string
|
2023-08-01 18:03:18 +03:00
|
|
|
HostURL string
|
2021-08-11 16:58:10 +02:00
|
|
|
|
|
|
|
msgContentType ContentType
|
|
|
|
client *http.Client
|
2018-10-14 16:44:21 +02:00
|
|
|
}
|
|
|
|
|
2018-10-24 11:21:03 +02:00
|
|
|
// Config contains sdk configuration parameters.
|
|
|
|
type Config struct {
|
2021-08-11 16:58:10 +02:00
|
|
|
BootstrapURL string
|
|
|
|
CertsURL string
|
|
|
|
HTTPAdapterURL string
|
|
|
|
ReaderURL string
|
|
|
|
ThingsURL string
|
|
|
|
UsersURL string
|
2023-08-01 18:03:18 +03:00
|
|
|
HostURL string
|
2021-08-11 16:58:10 +02:00
|
|
|
|
|
|
|
MsgContentType ContentType
|
|
|
|
TLSVerification bool
|
2018-10-14 16:44:21 +02:00
|
|
|
}
|
|
|
|
|
2018-10-24 11:21:03 +02:00
|
|
|
// NewSDK returns new mainflux SDK instance.
|
|
|
|
func NewSDK(conf Config) SDK {
|
|
|
|
return &mfSDK{
|
2021-08-11 16:58:10 +02:00
|
|
|
bootstrapURL: conf.BootstrapURL,
|
|
|
|
certsURL: conf.CertsURL,
|
|
|
|
httpAdapterURL: conf.HTTPAdapterURL,
|
|
|
|
readerURL: conf.ReaderURL,
|
|
|
|
thingsURL: conf.ThingsURL,
|
|
|
|
usersURL: conf.UsersURL,
|
2023-08-01 18:03:18 +03:00
|
|
|
HostURL: conf.HostURL,
|
2021-08-11 16:58:10 +02:00
|
|
|
|
|
|
|
msgContentType: conf.MsgContentType,
|
2018-10-24 11:21:03 +02:00
|
|
|
client: &http.Client{
|
|
|
|
Transport: &http.Transport{
|
|
|
|
TLSClientConfig: &tls.Config{
|
|
|
|
InsecureSkipVerify: !conf.TLSVerification,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2018-10-14 16:44:21 +02:00
|
|
|
}
|
2018-10-24 11:21:03 +02:00
|
|
|
}
|
2018-10-14 16:44:21 +02:00
|
|
|
|
2022-12-15 07:24:19 -08:00
|
|
|
// processRequest creates and send a new HTTP request, and checks for errors in the HTTP response.
|
|
|
|
// It then returns the response headers, the response body, and the associated error(s) (if any).
|
2023-08-01 18:03:18 +03:00
|
|
|
func (sdk mfSDK) processRequest(method, url, token string, data []byte, headers map[string]string, expectedRespCodes ...int) (http.Header, []byte, errors.SDKError) {
|
2022-12-15 07:24:19 -08:00
|
|
|
req, err := http.NewRequest(method, url, bytes.NewReader(data))
|
|
|
|
if err != nil {
|
|
|
|
return make(http.Header), []byte{}, errors.NewSDKError(err)
|
2018-10-14 16:44:21 +02:00
|
|
|
}
|
|
|
|
|
2023-08-01 18:03:18 +03:00
|
|
|
// Sets a default value for the Content-Type.
|
|
|
|
// Overridden if Content-Type is passed in the headers arguments.
|
|
|
|
req.Header.Add("Content-Type", string(CTJSON))
|
|
|
|
|
|
|
|
for key, value := range headers {
|
|
|
|
req.Header.Add(key, value)
|
|
|
|
}
|
|
|
|
|
2022-12-15 07:24:19 -08:00
|
|
|
if token != "" {
|
2023-06-14 12:40:37 +02:00
|
|
|
if !strings.Contains(token, ThingPrefix) {
|
|
|
|
token = BearerPrefix + token
|
2022-12-15 07:24:19 -08:00
|
|
|
}
|
|
|
|
req.Header.Set("Authorization", token)
|
|
|
|
}
|
2018-10-24 11:21:03 +02:00
|
|
|
|
2022-12-15 07:24:19 -08:00
|
|
|
resp, err := sdk.client.Do(req)
|
|
|
|
if err != nil {
|
|
|
|
return make(http.Header), []byte{}, errors.NewSDKError(err)
|
|
|
|
}
|
|
|
|
defer resp.Body.Close()
|
2022-03-06 01:49:34 +01:00
|
|
|
|
2022-12-15 07:24:19 -08:00
|
|
|
sdkerr := errors.CheckError(resp, expectedRespCodes...)
|
|
|
|
if sdkerr != nil {
|
|
|
|
return make(http.Header), []byte{}, sdkerr
|
2022-03-06 01:49:34 +01:00
|
|
|
}
|
|
|
|
|
2023-06-14 12:40:37 +02:00
|
|
|
body, err := io.ReadAll(resp.Body)
|
2022-12-15 07:24:19 -08:00
|
|
|
if err != nil {
|
|
|
|
return make(http.Header), []byte{}, errors.NewSDKError(err)
|
2022-03-06 01:49:34 +01:00
|
|
|
}
|
|
|
|
|
2022-12-15 07:24:19 -08:00
|
|
|
return resp.Header, body, nil
|
2022-03-06 01:49:34 +01:00
|
|
|
}
|
2022-06-17 18:32:23 +03:00
|
|
|
|
|
|
|
func (sdk mfSDK) withQueryParams(baseURL, endpoint string, pm PageMetadata) (string, error) {
|
|
|
|
q, err := pm.query()
|
|
|
|
if err != nil {
|
|
|
|
return "", err
|
|
|
|
}
|
2023-06-14 12:40:37 +02:00
|
|
|
|
2022-06-17 18:32:23 +03:00
|
|
|
return fmt.Sprintf("%s/%s?%s", baseURL, endpoint, q), nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (pm PageMetadata) query() (string, error) {
|
|
|
|
q := url.Values{}
|
2023-06-14 12:40:37 +02:00
|
|
|
if pm.Offset != 0 {
|
|
|
|
q.Add("offset", strconv.FormatUint(pm.Offset, 10))
|
|
|
|
}
|
|
|
|
if pm.Limit != 0 {
|
|
|
|
q.Add("limit", strconv.FormatUint(pm.Limit, 10))
|
|
|
|
}
|
|
|
|
if pm.Total != 0 {
|
|
|
|
q.Add("total", strconv.FormatUint(pm.Total, 10))
|
|
|
|
}
|
2022-06-17 18:32:23 +03:00
|
|
|
if pm.Level != 0 {
|
|
|
|
q.Add("level", strconv.FormatUint(pm.Level, 10))
|
|
|
|
}
|
|
|
|
if pm.Email != "" {
|
|
|
|
q.Add("email", pm.Email)
|
|
|
|
}
|
|
|
|
if pm.Name != "" {
|
|
|
|
q.Add("name", pm.Name)
|
|
|
|
}
|
|
|
|
if pm.Type != "" {
|
|
|
|
q.Add("type", pm.Type)
|
|
|
|
}
|
2023-06-14 12:40:37 +02:00
|
|
|
if pm.Visibility != "" {
|
|
|
|
q.Add("visibility", pm.Visibility)
|
|
|
|
}
|
2022-08-11 19:58:45 +03:00
|
|
|
if pm.Status != "" {
|
|
|
|
q.Add("status", pm.Status)
|
|
|
|
}
|
2022-06-17 18:32:23 +03:00
|
|
|
if pm.Metadata != nil {
|
|
|
|
md, err := json.Marshal(pm.Metadata)
|
|
|
|
if err != nil {
|
2022-12-15 07:24:19 -08:00
|
|
|
return "", errors.NewSDKError(err)
|
2022-06-17 18:32:23 +03:00
|
|
|
}
|
|
|
|
q.Add("metadata", string(md))
|
|
|
|
}
|
2023-06-14 12:40:37 +02:00
|
|
|
if pm.Action != "" {
|
|
|
|
q.Add("action", pm.Action)
|
|
|
|
}
|
|
|
|
if pm.Subject != "" {
|
|
|
|
q.Add("subject", pm.Subject)
|
|
|
|
}
|
|
|
|
if pm.Object != "" {
|
|
|
|
q.Add("object", pm.Object)
|
|
|
|
}
|
|
|
|
if pm.Tag != "" {
|
|
|
|
q.Add("tag", pm.Tag)
|
|
|
|
}
|
|
|
|
if pm.Owner != "" {
|
|
|
|
q.Add("owner", pm.Owner)
|
|
|
|
}
|
|
|
|
if pm.SharedBy != "" {
|
|
|
|
q.Add("shared_by", pm.SharedBy)
|
|
|
|
}
|
|
|
|
if pm.Topic != "" {
|
|
|
|
q.Add("topic", pm.Topic)
|
|
|
|
}
|
|
|
|
if pm.Contact != "" {
|
|
|
|
q.Add("contact", pm.Contact)
|
|
|
|
}
|
|
|
|
if pm.State != "" {
|
|
|
|
q.Add("state", pm.State)
|
|
|
|
}
|
|
|
|
|
2022-06-17 18:32:23 +03:00
|
|
|
return q.Encode(), nil
|
|
|
|
}
|