NewAPI returns an pointer of API struct with default values.
(source string, insecureTLS bool, timeout time.Duration)
| 571 | } |
| 572 | |
| 573 | // NewAPI returns an pointer of API struct with default values. |
| 574 | func NewAPI(source string, insecureTLS bool, timeout time.Duration) (*API, error) { |
| 575 | host, err := formatHost(source) |
| 576 | if err != nil { |
| 577 | return nil, err |
| 578 | } |
| 579 | return &API{ |
| 580 | Client: &http.Client{ |
| 581 | Transport: &http.Transport{ |
| 582 | TLSClientConfig: &tls.Config{InsecureSkipVerify: insecureTLS}, |
| 583 | }, |
| 584 | Timeout: timeout, |
| 585 | }, |
| 586 | source: host, |
| 587 | }, nil |
| 588 | } |
| 589 | |
| 590 | // FetchCsv takes channel name (like 1, 2, c, d) |
searching dependent graphs…