126 lines
4.4 KiB
Go
126 lines
4.4 KiB
Go
package client
|
|
|
|
type HttpResponse[D any] struct {
|
|
Data D `json:"data"`
|
|
ErrData string `json:"errData"`
|
|
Status int `json:"status"`
|
|
}
|
|
|
|
// ClientResponse represents a generic response structure
|
|
type ClientResponse[T any] struct {
|
|
NeedSeq bool `json:"needSeq,omitempty"`
|
|
Seq int `json:"seq,omitempty"`
|
|
Status string `json:"status,omitempty"`
|
|
Result T `json:"result,omitempty"`
|
|
IsInsnLimit bool `json:"isInsnLimit,omitempty"`
|
|
TotalGas int `json:"totalGas,omitempty"`
|
|
ExecutionGas int `json:"executionGas,omitempty"`
|
|
ExtraGas int `json:"extraGas,omitempty"`
|
|
Size int `json:"size,omitempty"`
|
|
EventRelated bool `json:"eventRelated,omitempty"`
|
|
ResponseID string `json:"responseID,omitempty"`
|
|
Action string `json:"action,omitempty"`
|
|
ExecuteTime string `json:"executeTime,omitempty"`
|
|
}
|
|
|
|
// PingResponse is a specific response type for ping operations
|
|
type PingResponse struct {
|
|
Action string `json:"action"`
|
|
}
|
|
|
|
// SaveFileRequest represents the request structure for saving files
|
|
type SaveFileRequest struct {
|
|
Content string `json:"content"`
|
|
IsAppend bool `json:"isAppend"`
|
|
IsPrivate bool `json:"isPrivate"`
|
|
Path string `json:"path"`
|
|
}
|
|
|
|
// ListProjectPermissionRequest represents the request for listing project permissions
|
|
type ListProjectPermissionRequest struct {
|
|
IsPrivate bool `json:"isPrivate"`
|
|
Path string `json:"path"`
|
|
}
|
|
|
|
// ListProjectPermissionResponseData contains permission response data
|
|
type ListProjectPermissionResponseData struct {
|
|
Permissions []string `json:"permissions"`
|
|
YPK string `json:"ypk"`
|
|
}
|
|
|
|
// StartContractByYpkRequest represents the request for starting a contract
|
|
type StartContractByYpkRequest struct {
|
|
IsPrivate bool `json:"isPrivate"`
|
|
Path string `json:"path"`
|
|
Script string `json:"script"`
|
|
}
|
|
|
|
// ListAllUsersResponseDataListItem represents a key-value pair
|
|
type ListAllUsersResponseDataListItem struct {
|
|
Key string `json:"key"`
|
|
Value string `json:"value"`
|
|
}
|
|
|
|
// ListAllUsersResponseData contains user listing response data
|
|
type ListAllUsersResponseData struct {
|
|
KV []ListAllUsersResponseDataListItem `json:"kv"`
|
|
Time []ListAllUsersResponseDataListItem `json:"time"`
|
|
}
|
|
|
|
// OnlineContractsItem represents an online contract
|
|
type OnlineContractsItem struct {
|
|
ContractID string `json:"contractID"`
|
|
ContractName string `json:"contractName"`
|
|
IsMaster bool `json:"isMaster"`
|
|
Type string `json:"type"`
|
|
YjsType string `json:"yjsType"`
|
|
Extra map[string]interface{} `json:"-"`
|
|
}
|
|
|
|
// OnlineItem represents an online node
|
|
type OnlineItem struct {
|
|
CIManager string `json:"cimanager"`
|
|
ContractVersion int `json:"contractVersion"`
|
|
Events int `json:"events"`
|
|
IPPort string `json:"ipPort"`
|
|
MasterAddress string `json:"masterAddress"`
|
|
NodeName string `json:"nodeName"`
|
|
PeerID string `json:"peerID"`
|
|
PubKey string `json:"pubKey"`
|
|
Contracts []OnlineContractsItem `json:"contracts"`
|
|
}
|
|
|
|
// ListNodesResponse represents the response for listing nodes
|
|
type ListNodesResponse struct {
|
|
Action string `json:"action"`
|
|
Offline []string `json:"offline"`
|
|
Online []OnlineItem `json:"online"`
|
|
}
|
|
|
|
// DistributeContractResponse represents the response for contract distribution
|
|
type DistributeContractResponse struct {
|
|
Action string `json:"action"`
|
|
Progress string `json:"progress"`
|
|
}
|
|
|
|
// ExecuteContractResponse represents the response from contract execution
|
|
type ExecuteContractResponse[T any] struct {
|
|
ClientResponse[T]
|
|
}
|
|
|
|
// ConfigNodeArgs represents configuration arguments for a node
|
|
type ConfigNodeArgs struct {
|
|
NodeName string `json:"nodeName,omitempty"`
|
|
DataChain string `json:"dataChain,omitempty"`
|
|
MasterAddress string `json:"masterAddress,omitempty"`
|
|
NodeCenter string `json:"nodeCenter,omitempty"`
|
|
LHSProxyAddress string `json:"LHSProxyAddress,omitempty"`
|
|
ExtraConfig map[string]string `json:"-"`
|
|
}
|
|
|
|
// LoadNodeConfigResponseData represents the response data for node configuration
|
|
type LoadNodeConfigResponseData struct {
|
|
DoipConfig string `json:"doipConfig"`
|
|
ExtraData map[string]string `json:"-"`
|
|
}
|