Skip to content

Commit

Permalink
Add get_subscriptions endpoint + fix config parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
cmmarslender committed Aug 1, 2024
1 parent f278718 commit 22af725
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 9 deletions.
18 changes: 9 additions & 9 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,15 @@ type PoolConfig struct {

// FarmerConfig farmer configuration section
type FarmerConfig struct {
FullNodePeers []Peer `yaml:"full_node_peers"`
PoolPublicKeys []string `yaml:"pool_public_keys"` // @TODO test if the !!set notation parses correctly
XCHTargetAddress string `yaml:"xch_target_address,omitempty"`
StartRPCServer bool `yaml:"start_rpc_server"`
EnableProfiler bool `yaml:"enable_profiler"`
PoolShareThreshold uint32 `yaml:"pool_share_threshold"`
Logging LoggingConfig `yaml:"logging"`
NetworkOverrides NetworkOverrides `yaml:"network_overrides"`
SelectedNetwork string `yaml:"selected_network"`
FullNodePeers []Peer `yaml:"full_node_peers"`
PoolPublicKeys map[string]string `yaml:"pool_public_keys"`
XCHTargetAddress string `yaml:"xch_target_address,omitempty"`
StartRPCServer bool `yaml:"start_rpc_server"`
EnableProfiler bool `yaml:"enable_profiler"`
PoolShareThreshold uint32 `yaml:"pool_share_threshold"`
Logging LoggingConfig `yaml:"logging"`
NetworkOverrides NetworkOverrides `yaml:"network_overrides"`
SelectedNetwork string `yaml:"selected_network"`
PortConfig `yaml:",inline"`
SSL SSLConfig `yaml:"ssl"`
}
Expand Down
32 changes: 32 additions & 0 deletions pkg/rpc/datalayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,35 @@ func (s *DataLayerService) GetVersion(opts *GetVersionOptions) (*GetVersionRespo

return r, resp, nil
}

// DatalayerGetSubscriptionsOptions options for get_subscriptions
type DatalayerGetSubscriptionsOptions struct{}

// DatalayerGetSubscriptionsResponse response for get_subscriptions
type DatalayerGetSubscriptionsResponse struct {
Response
StoreIDs []string `json:"store_ids"`
}

// GetSubscriptions is just an alias for Subscriptions, since the CLI command is get_subscriptions
// Makes this easier to find
func (s *DataLayerService) GetSubscriptions(opts *DatalayerGetSubscriptionsOptions) (*DatalayerGetSubscriptionsResponse, *http.Response, error) {
return s.Subscriptions(opts)
}

// Subscriptions calls the subscriptions endpoint to list all subscriptions
func (s *DataLayerService) Subscriptions(opts *DatalayerGetSubscriptionsOptions) (*DatalayerGetSubscriptionsResponse, *http.Response, error) {
request, err := s.NewRequest("subscriptions", opts)
if err != nil {
return nil, nil, err
}

r := &DatalayerGetSubscriptionsResponse{}

resp, err := s.Do(request, r)
if err != nil {
return nil, resp, err
}

return r, resp, nil
}

0 comments on commit 22af725

Please sign in to comment.