Skip to content
This repository has been archived by the owner on Jan 25, 2021. It is now read-only.

Adding Options to API Calls

Alessandro Sanino edited this page Aug 23, 2017 · 1 revision

Adding Options to the requests

Let’s start by defining the Options type:

type Options struct {
    ConnTimeout time.Duration
}

Where:

ConnTimeout

The timeout for the connection before it expires if it does not receive a response from Bittrex servers

NOT IMPLEMENTED YET

You can add Options to calls by using special WithOpts functions. Let’s take GetMarketSummary as an example:

// Instead of
summaries, err := bittrex.GetMarketSummary("BTC-ETH")
if err != nil {
    // Handle error
}
// Use
summaries, err := bittrex.GetMarketSummaryWithOpts("BTC-ETH", &bittrex.Options{
    // Add options, like
    ConnTimeout: time.Second * 30,
})
if err != nil {
    // Handle error
}