-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
vehicle_lock_status.go
44 lines (37 loc) · 1.56 KB
/
vehicle_lock_status.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
39
40
41
42
43
44
package merche
import (
"context"
"fmt"
"net/http"
)
// VehicleLockStatus defines the response from VehicleLockStatus.
type VehicleLockStatus struct {
Doorlockstatusvehicle *Resource `json:"doorlockstatusvehicle,omitempty"`
Doorlockstatusdecklid *Resource `json:"doorlockstatusdecklid,omitempty"`
Doorlockstatusgas *Resource `json:"doorlockstatusgas,omitempty"`
PositionHeading *Resource `json:"positionHeading,omitempty"`
}
// VehicleLockStatusService handles communication with vehicle lock status related
// methods of the Mercedes API.
//
// Mercedes API docs: https://developer.mercedes-benz.com/products/vehicle_lock_status/docs
type VehicleLockStatusService service
// GetVehicleLockStatus gets containers resource of the Vehicle lock tatus API
// to get the values of all resources that are available for readout.
// The response contains the available resource values and the corresponding
// readout timestamp for the corresponding car.
//
// Mercedes API docs: https://developer.mercedes-benz.com/products/vehicle_lock_status/docs#_3_get_all_values_of_the_vehicle_lock_status_api
func (s *VehicleLockStatusService) GetVehicleLockStatus(ctx context.Context, opts *Options) ([]*VehicleLockStatus, *Response, error) {
path := fmt.Sprintf("%v/%v/containers/vehiclelockstatus", apiPathPrefix, opts.VehicleID)
req, err := s.client.NewRequest(ctx, http.MethodGet, path, http.NoBody)
if err != nil {
return nil, nil, err
}
var status []*VehicleLockStatus
resp, err := s.client.Do(req, &status)
if err != nil {
return nil, resp, err
}
return status, resp, nil
}