@@ -4,15 +4,34 @@ import (
4
4
"context"
5
5
"net/url"
6
6
"strconv"
7
+ "time"
7
8
)
8
9
9
10
// ListChargesRequest is the request input to the [Client.ListCharges] method.
10
11
type ListChargesRequest struct {
11
12
PageFilters
12
- // TeamID allows to filter list of charges points by a team ID.
13
- TeamID * int64
14
- // ChargePointID allows to filter list of charges points by a charge point ID.
13
+
14
+ // Filter to retrieve charges with specified chargePointId.
15
15
ChargePointID * int64
16
+
17
+ // Filter to retrieve charges with specified teamId.
18
+ TeamID * int64
19
+
20
+ // Filter to retrieve charges with specified siteId.
21
+ SiteID * int64
22
+
23
+ // Filter to retrieve charges by state.
24
+ State * ChargeState
25
+
26
+ // Filter to retrieve charges by the charge authentication type, must be combined with chargeAuthId.
27
+ ChargeAuthType * ChargeAuthType
28
+
29
+ // Filter to retrieve charges by the charge authentication ID, must be combined with chargeAuthType
30
+ // Note: for type vehicleId, chargeAuthId must not include the VID: prefix.
31
+ ChargeAuthID * string
32
+
33
+ // Filter to retrieve charges where createdAt >= fromDate.
34
+ FromDate * time.Time
16
35
}
17
36
18
37
// ListChargesResponse is the response output from the [Client.ListCharges] method.
@@ -28,11 +47,26 @@ func (c *Client) ListCharges(ctx context.Context, request *ListChargesRequest) (
28
47
path := "/v1/charges"
29
48
query := url.Values {}
30
49
request .PageFilters .Apply (query )
50
+ if request .ChargePointID != nil {
51
+ query .Set ("chargePointId" , strconv .Itoa (int (* request .ChargePointID )))
52
+ }
31
53
if request .TeamID != nil {
32
54
query .Set ("teamId" , strconv .Itoa (int (* request .TeamID )))
33
55
}
34
- if request .ChargePointID != nil {
35
- query .Set ("chargePointId" , strconv .Itoa (int (* request .ChargePointID )))
56
+ if request .SiteID != nil {
57
+ query .Set ("siteId" , strconv .Itoa (int (* request .SiteID )))
58
+ }
59
+ if request .State != nil {
60
+ query .Set ("state" , string (* request .State ))
61
+ }
62
+ if request .ChargeAuthType != nil {
63
+ query .Set ("chargeAuthType" , string (* request .ChargeAuthType ))
64
+ }
65
+ if request .ChargeAuthID != nil {
66
+ query .Set ("chargeAuthId" , * request .ChargeAuthID )
67
+ }
68
+ if request .FromDate != nil {
69
+ query .Set ("fromDate" , request .FromDate .UTC ().Format (time .RFC3339 ))
36
70
}
37
71
return doGet [ListChargesResponse ](ctx , c , path , query )
38
72
}
0 commit comments