mirror of
https://github.com/mainflux/mainflux.git
synced 2025-04-29 13:49:28 +08:00

* initial commit update api docs Signed-off-by: rodneyosodo <socials@rodneyosodo.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * initial commit enrich sdk Signed-off-by: rodneyosodo <socials@rodneyosodo.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * initial commit enrich cli Signed-off-by: rodneyosodo <socials@rodneyosodo.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * add consumers test Signed-off-by: rodneyosodo <socials@rodneyosodo.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * remove dead code Signed-off-by: rodneyosodo <socials@rodneyosodo.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * add certs sdk tests Signed-off-by: rodneyosodo <socials@rodneyosodo.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * change contact name Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * fix tests Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Rename Disconnect Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix subscription typo Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix Swagger File Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Add Tests Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Change Limit to 10 Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Remove empty line Signed-off-by: rodneyosodo <blackd0t@protonmail.com> --------- Signed-off-by: rodneyosodo <socials@rodneyosodo.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> Co-authored-by: rodneyosodo <socials@rodneyosodo.com>
122 lines
2.4 KiB
Go
122 lines
2.4 KiB
Go
// Copyright (c) Mainflux
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package sdk
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
|
|
"github.com/mainflux/mainflux/pkg/transformers/senml"
|
|
)
|
|
|
|
type tokenRes struct {
|
|
Token string `json:"token,omitempty"`
|
|
}
|
|
|
|
type createThingsRes struct {
|
|
Things []Thing `json:"things"`
|
|
}
|
|
|
|
type createChannelsRes struct {
|
|
Channels []Channel `json:"channels"`
|
|
}
|
|
|
|
type pageRes struct {
|
|
Total uint64 `json:"total"`
|
|
Offset uint64 `json:"offset"`
|
|
Limit uint64 `json:"limit"`
|
|
}
|
|
|
|
// ThingsPage contains list of things in a page with proper metadata.
|
|
type ThingsPage struct {
|
|
Things []Thing `json:"things"`
|
|
pageRes
|
|
}
|
|
|
|
// ChannelsPage contains list of channels in a page with proper metadata.
|
|
type ChannelsPage struct {
|
|
Channels []Channel `json:"channels"`
|
|
pageRes
|
|
}
|
|
|
|
// MessagesPage contains list of messages in a page with proper metadata.
|
|
type MessagesPage struct {
|
|
Messages []senml.Message `json:"messages,omitempty"`
|
|
pageRes
|
|
}
|
|
|
|
type GroupsPage struct {
|
|
Groups []Group `json:"groups"`
|
|
pageRes
|
|
}
|
|
|
|
type UsersPage struct {
|
|
Users []User `json:"users"`
|
|
pageRes
|
|
}
|
|
|
|
type MembersPage struct {
|
|
Members []string `json:"members"`
|
|
pageRes
|
|
}
|
|
|
|
type KeyRes struct {
|
|
ID string `json:"id,omitempty"`
|
|
Value string `json:"value,omitempty"`
|
|
IssuedAt time.Time `json:"issued_at,omitempty"`
|
|
ExpiresAt *time.Time `json:"expires_at,omitempty"`
|
|
}
|
|
|
|
func (res KeyRes) Code() int {
|
|
return http.StatusCreated
|
|
}
|
|
|
|
func (res KeyRes) Headers() map[string]string {
|
|
return map[string]string{}
|
|
}
|
|
|
|
func (res KeyRes) Empty() bool {
|
|
return res.Value == ""
|
|
}
|
|
|
|
type retrieveKeyRes struct {
|
|
ID string `json:"id,omitempty"`
|
|
IssuerID string `json:"issuer_id,omitempty"`
|
|
Subject string `json:"subject,omitempty"`
|
|
IssuedAt time.Time `json:"issued_at,omitempty"`
|
|
ExpiresAt *time.Time `json:"expires_at,omitempty"`
|
|
}
|
|
|
|
func (res retrieveKeyRes) Code() int {
|
|
return http.StatusOK
|
|
}
|
|
|
|
func (res retrieveKeyRes) Headers() map[string]string {
|
|
return map[string]string{}
|
|
}
|
|
|
|
func (res retrieveKeyRes) Empty() bool {
|
|
return false
|
|
}
|
|
|
|
type revokeCertsRes struct {
|
|
RevocationTime time.Time `json:"revocation_time"`
|
|
}
|
|
|
|
// BoostrapsPage contains list of boostrap configs in a page with proper metadata.
|
|
type BoostrapsPage struct {
|
|
Configs []BootstrapConfig `json:"configs"`
|
|
pageRes
|
|
}
|
|
|
|
type CertSerials struct {
|
|
Serials []string `json:"serials"`
|
|
pageRes
|
|
}
|
|
|
|
type SubscriptionPage struct {
|
|
Subscriptions []Subscription `json:"subscriptions"`
|
|
pageRes
|
|
}
|