gitlab.com/jokerrs1/Sia@v1.3.2/node/api/client/host.go (about)

     1  package client
     2  
     3  import (
     4  	"net/url"
     5  	"strconv"
     6  
     7  	"github.com/NebulousLabs/Sia/node/api"
     8  )
     9  
    10  // HostAnnouncePost uses the /host/announce endpoint to announce the host to
    11  // the network
    12  func (c *Client) HostAnnouncePost() (err error) {
    13  	err = c.post("/host/announce", "", nil)
    14  	return
    15  }
    16  
    17  // HostAcceptingContractsPost uses the /host endpoint to change the acceptingcontracts field of the host's settings
    18  func (c *Client) HostAcceptingContractsPost(acceptingContracts bool) (err error) {
    19  	values := url.Values{}
    20  	values.Set("acceptingcontracts", strconv.FormatBool(acceptingContracts))
    21  	err = c.post("/host", values.Encode(), nil)
    22  	return
    23  }
    24  
    25  // HostStorageFoldersAddPost uses the /host/storage/folders/add api endpoint to
    26  // add a storage folder to a host
    27  func (c *Client) HostStorageFoldersAddPost(path string, size uint64) (err error) {
    28  	values := url.Values{}
    29  	values.Set("path", path)
    30  	values.Set("size", strconv.FormatUint(size, 10))
    31  	err = c.post("/host/storage/folders/add", values.Encode(), nil)
    32  	return
    33  }
    34  
    35  // HostGet requests the /host endpoint.
    36  func (c *Client) HostGet() (hg api.HostGET, err error) {
    37  	err = c.get("/host", &hg)
    38  	return
    39  }