-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwholesale_market.go
38 lines (34 loc) · 1.02 KB
/
wholesale_market.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package gorte
import (
"net/http"
"time"
)
type FrancePowerExchangesValue struct {
StartDate time.Time `json:"start_date"`
EndDate time.Time `json:"end_date"`
Value float64 `json:"value"`
Price float64 `json:"price"`
}
type FrancePowerExchangesResp struct {
FrancePowerExchanges []struct {
StartDate time.Time `json:"start_date"`
EndDate time.Time `json:"end_date"`
UpdatedDate time.Time `json:"updated_date"`
Values []FrancePowerExchangesValue `json:"values"`
} `json:"france_power_exchanges"`
}
func (s *market) GetFrancePowerExchanges() (*FrancePowerExchangesResp, *http.Response, error) {
c := s.client
req, err := c.NewRequest(http.MethodGet, "open_api/wholesale_market/v2/france_power_exchanges", nil)
if err != nil {
c.logger.Err(err.Error())
return nil, nil, err
}
fpe := &FrancePowerExchangesResp{}
resp, err := c.Do(req, fpe)
if err != nil {
c.logger.Err(err.Error())
return nil, resp, err
}
return fpe, resp, err
}