github.com/bitfinexcom/bitfinex-api-go@v0.0.0-20210608095005-9e0b26f200fb/v1/credits.go (about)

     1  package bitfinex
     2  
     3  type CreditsService struct {
     4  	client *Client
     5  }
     6  
     7  type Credit struct {
     8  	Id        int
     9  	Currency  string
    10  	Status    string
    11  	Rate      float64 `json:",string"`
    12  	Period    float64
    13  	Amount    float64 `json:",string"`
    14  	Timestamp string
    15  }
    16  
    17  // Returns an array of Credit
    18  func (c *CreditsService) All() ([]Credit, error) {
    19  	req, err := c.client.newAuthenticatedRequest("GET", "credits", nil)
    20  	if err != nil {
    21  		return nil, err
    22  	}
    23  
    24  	credits := make([]Credit, 0)
    25  	_, err = c.client.do(req, &credits)
    26  	if err != nil {
    27  		return nil, err
    28  	}
    29  
    30  	return credits, nil
    31  }