-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from Chia-Network/get-connections
Get Connections
- Loading branch information
Showing
4 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package rpc | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/chia-network/go-chia-libs/pkg/rpcinterface" | ||
) | ||
|
||
// FarmerService encapsulates farmer RPC methods | ||
type FarmerService struct { | ||
client *Client | ||
} | ||
|
||
// NewRequest returns a new request specific to the wallet service | ||
func (s *FarmerService) NewRequest(rpcEndpoint rpcinterface.Endpoint, opt interface{}) (*rpcinterface.Request, error) { | ||
return s.client.NewRequest(rpcinterface.ServiceFarmer, rpcEndpoint, opt) | ||
} | ||
|
||
// Do is just a shortcut to the client's Do method | ||
func (s *FarmerService) Do(req *rpcinterface.Request, v interface{}) (*http.Response, error) { | ||
return s.client.Do(req, v) | ||
} | ||
|
||
// GetConnections returns connections | ||
func (s *FarmerService) GetConnections(opts *GetConnectionsOptions) (*GetConnectionsResponse, *http.Response, error) { | ||
request, err := s.NewRequest("get_connections", opts) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
|
||
c := &GetConnectionsResponse{} | ||
resp, err := s.Do(request, c) | ||
if err != nil { | ||
return nil, resp, err | ||
} | ||
|
||
return c, resp, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters