This commit is contained in:
2026-06-05 17:30:36 +03:00
parent 3e2edf53a5
commit f1112e5a11
1246 changed files with 6117 additions and 1589 deletions

View File

@@ -0,0 +1,46 @@
package node
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// GetNetworkInfoRequest struct to get network information of a node
type GetNetworkInfoRequest struct {
// Node ID
// Required: true
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
}
// GetNetworkInfo gets network information of a node as a RecordNodeNetworkInfo struct
func (n Node) GetNetworkInfo(ctx context.Context, req GetNetworkInfoRequest) (*RecordNodeNetworkInfo, error) {
res, err := n.GetNetworkInfoRaw(ctx, req)
if err != nil {
return nil, err
}
info := RecordNodeNetworkInfo{}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}
// GetNetworkInfoRaw gets network information of a node as an array of bytes
func (n Node) GetNetworkInfoRaw(ctx context.Context, req GetNetworkInfoRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/node/get_network_info"
res, err := n.client.DecortApiCall(ctx, http.MethodGet, url, req)
return res, err
}