Skip to content

Commit

Permalink
Add subscribe endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
cmmarslender committed Oct 3, 2024
1 parent a29c613 commit e7644d8
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions pkg/rpc/datalayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,34 @@ func (s *DataLayerService) AddMirror(opts *DatalayerAddMirrorOptions) (*Datalaye
return r, resp, nil
}

// DatalayerSubscribeOptions options for subscribe
type DatalayerSubscribeOptions struct {
ID string `json:"id"` // hex string datastore id
URLs []string `json:"urls,omitempty"`
}

// DatalayerSubscribeResponse Response from subscribe. Always empty aside from standard fields
type DatalayerSubscribeResponse struct {
Response
}

// Subscribe deletes a datalayer mirror
func (s *DataLayerService) Subscribe(opts *DatalayerSubscribeOptions) (*DatalayerSubscribeResponse, *http.Response, error) {
request, err := s.NewRequest("subscribe", opts)
if err != nil {
return nil, nil, err
}

r := &DatalayerSubscribeResponse{}

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

return r, resp, nil
}

// DatalayerUnsubscribeOptions options for unsubscribing to a datastore
type DatalayerUnsubscribeOptions struct {
ID string `json:"id"` // hex string datastore id
Expand Down

0 comments on commit e7644d8

Please sign in to comment.