1
0
mirror of https://github.com/mainflux/mainflux.git synced 2025-04-24 13:48:49 +08:00

NOISSUE - Fix bootstrap SDK args naming (#1151)

Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
This commit is contained in:
Manuel Imperiale 2020-04-29 20:05:08 +02:00 committed by GitHub
parent 9d5202c46b
commit f872546925
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 20 deletions

View File

@ -83,7 +83,7 @@ type Service interface {
// Remove removes Config with specified token that belongs to the user identified by the given token.
Remove(token, id string) error
// Bootstrap returns Config to the Thing with provided external ID using external token.
// Bootstrap returns Config to the Thing with provided external ID using external key.
Bootstrap(externalKey, externalID string, secure bool) (Config, error)
// ChangeState changes state of the Thing with given ID and owner.

View File

@ -39,7 +39,7 @@ type BoostrapConfig struct {
State int `json:"state,omitempty"`
}
func (sdk mfSDK) AddBootstrap(key string, cfg BoostrapConfig) (string, error) {
func (sdk mfSDK) AddBootstrap(token string, cfg BoostrapConfig) (string, error) {
data, err := json.Marshal(cfg)
if err != nil {
return "", err
@ -52,7 +52,7 @@ func (sdk mfSDK) AddBootstrap(key string, cfg BoostrapConfig) (string, error) {
return "", err
}
resp, err := sdk.sendRequest(req, key, string(CTJSON))
resp, err := sdk.sendRequest(req, token, string(CTJSON))
if err != nil {
return "", err
}
@ -97,7 +97,7 @@ func (sdk mfSDK) Whitelist(token string, cfg BoostrapConfig) error {
return nil
}
func (sdk mfSDK) ViewBoostrap(key, id string) (BoostrapConfig, error) {
func (sdk mfSDK) ViewBoostrap(token, id string) (BoostrapConfig, error) {
endpoint := fmt.Sprintf("%s/%s", configsEndpoint, id)
url := createURL(sdk.bootstrapURL, sdk.bootstrapPrefix, endpoint)
@ -106,7 +106,7 @@ func (sdk mfSDK) ViewBoostrap(key, id string) (BoostrapConfig, error) {
return BoostrapConfig{}, err
}
resp, err := sdk.sendRequest(req, key, string(CTJSON))
resp, err := sdk.sendRequest(req, token, string(CTJSON))
if err != nil {
return BoostrapConfig{}, err
}
@ -129,7 +129,7 @@ func (sdk mfSDK) ViewBoostrap(key, id string) (BoostrapConfig, error) {
return bc, nil
}
func (sdk mfSDK) UpdateBoostrap(key string, cfg BoostrapConfig) error {
func (sdk mfSDK) UpdateBoostrap(token string, cfg BoostrapConfig) error {
data, err := json.Marshal(cfg)
if err != nil {
return err
@ -143,7 +143,7 @@ func (sdk mfSDK) UpdateBoostrap(key string, cfg BoostrapConfig) error {
return err
}
resp, err := sdk.sendRequest(req, key, string(CTJSON))
resp, err := sdk.sendRequest(req, token, string(CTJSON))
if err != nil {
return err
}
@ -155,7 +155,7 @@ func (sdk mfSDK) UpdateBoostrap(key string, cfg BoostrapConfig) error {
return nil
}
func (sdk mfSDK) RemoveBoostrap(key, id string) error {
func (sdk mfSDK) RemoveBoostrap(token, id string) error {
endpoint := fmt.Sprintf("%s/%s", configsEndpoint, id)
url := createURL(sdk.bootstrapURL, sdk.bootstrapPrefix, endpoint)
@ -164,7 +164,7 @@ func (sdk mfSDK) RemoveBoostrap(key, id string) error {
return err
}
resp, err := sdk.sendRequest(req, key, string(CTJSON))
resp, err := sdk.sendRequest(req, token, string(CTJSON))
if err != nil {
return err
}
@ -176,8 +176,8 @@ func (sdk mfSDK) RemoveBoostrap(key, id string) error {
return nil
}
func (sdk mfSDK) Boostrap(key, id string) (BoostrapConfig, error) {
endpoint := fmt.Sprintf("%s/%s", bootstrapEndpoint, id)
func (sdk mfSDK) Boostrap(externalKey, externalID string) (BoostrapConfig, error) {
endpoint := fmt.Sprintf("%s/%s", bootstrapEndpoint, externalID)
url := createURL(sdk.bootstrapURL, sdk.bootstrapPrefix, endpoint)
req, err := http.NewRequest(http.MethodGet, url, nil)
@ -185,7 +185,7 @@ func (sdk mfSDK) Boostrap(key, id string) (BoostrapConfig, error) {
return BoostrapConfig{}, err
}
resp, err := sdk.sendRequest(req, key, string(CTJSON))
resp, err := sdk.sendRequest(req, externalKey, string(CTJSON))
if err != nil {
return BoostrapConfig{}, err
}

View File

@ -175,19 +175,19 @@ type SDK interface {
Version() (string, error)
// AddBootstrap add boostrap configuration
AddBootstrap(key string, cfg BoostrapConfig) (string, error)
AddBootstrap(token string, cfg BoostrapConfig) (string, error)
// View returns Thing Config with given ID belonging to the user identified by the given key.
ViewBoostrap(key, id string) (BoostrapConfig, error)
// View returns Thing Config with given ID belonging to the user identified by the given token.
ViewBoostrap(token, id string) (BoostrapConfig, error)
// Update updates editable fields of the provided Config.
UpdateBoostrap(key string, cfg BoostrapConfig) error
UpdateBoostrap(token string, cfg BoostrapConfig) error
// Remove removes Config with specified key that belongs to the user identified by the given key.
RemoveBoostrap(key, id string) error
// Remove removes Config with specified token that belongs to the user identified by the given token.
RemoveBoostrap(token, id string) error
// View returns Thing Config with given ID belonging to the user identified by the given key.
Boostrap(key, id string) (BoostrapConfig, error)
// Bootstrap returns Config to the Thing with provided external ID using external key.
Boostrap(externalKey, externalID string) (BoostrapConfig, error)
// Whitelist updates Thing state Config with given ID belonging to the user identified by the given token.
Whitelist(token string, cfg BoostrapConfig) error