FetchStatus returns the calnex status
()
| 722 | } |
| 723 | |
| 724 | // FetchStatus returns the calnex status |
| 725 | func (a *API) FetchStatus() (*Status, error) { |
| 726 | url := fmt.Sprintf(getStatusURL, a.source) |
| 727 | resp, err := a.Client.Get(url) |
| 728 | if err != nil { |
| 729 | return nil, err |
| 730 | } |
| 731 | defer resp.Body.Close() |
| 732 | |
| 733 | if resp.StatusCode != http.StatusOK { |
| 734 | return nil, errors.New(http.StatusText(resp.StatusCode)) |
| 735 | } |
| 736 | |
| 737 | s := &Status{} |
| 738 | if err = json.NewDecoder(resp.Body).Decode(s); err != nil { |
| 739 | return nil, err |
| 740 | } |
| 741 | |
| 742 | return s, nil |
| 743 | } |
| 744 | |
| 745 | // FetchInstrumentStatus returns the calnex instrument status |