mirror of
https://github.com/kevin-DL/m3o-go.git
synced 2026-01-11 18:44:26 +00:00
Commit from m3o/m3o action
This commit is contained in:
61
vehicle/vehicle.go
Executable file
61
vehicle/vehicle.go
Executable file
@@ -0,0 +1,61 @@
|
||||
package vehicle
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
)
|
||||
|
||||
func NewVehicleService(token string) *VehicleService {
|
||||
return &VehicleService{
|
||||
client: client.NewClient(&client.Options{
|
||||
Token: token,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
type VehicleService struct {
|
||||
client *client.Client
|
||||
}
|
||||
|
||||
// Lookup a UK vehicle by it's registration number
|
||||
func (t *VehicleService) Lookup(request *LookupRequest) (*LookupResponse, error) {
|
||||
rsp := &LookupResponse{}
|
||||
return rsp, t.client.Call("vehicle", "Lookup", request, rsp)
|
||||
}
|
||||
|
||||
type LookupRequest struct {
|
||||
// the vehicle registration number
|
||||
Registration string `json:"registration"`
|
||||
}
|
||||
|
||||
type LookupResponse struct {
|
||||
// co2 emmissions
|
||||
Co2emissions float64 `json:"co2emissions"`
|
||||
// colour of vehicle
|
||||
Colour string `json:"colour"`
|
||||
// engine capacity
|
||||
EngineCapacity int32 `json:"engineCapacity"`
|
||||
// fuel type e.g petrol, diesel
|
||||
FuelType string `json:"fuelType"`
|
||||
// date of last v5 issue
|
||||
LastV5issued string `json:"lastV5issued"`
|
||||
// make of vehicle
|
||||
Make string `json:"make"`
|
||||
// month of first registration
|
||||
MonthOfFirstRegistration string `json:"monthOfFirstRegistration"`
|
||||
// mot expiry
|
||||
MotExpiry string `json:"motExpiry"`
|
||||
// mot status
|
||||
MotStatus string `json:"motStatus"`
|
||||
// registration number
|
||||
Registration string `json:"registration"`
|
||||
// tax due data
|
||||
TaxDueDate string `json:"taxDueDate"`
|
||||
// tax status
|
||||
TaxStatus string `json:"taxStatus"`
|
||||
// type approvale
|
||||
TypeApproval string `json:"typeApproval"`
|
||||
// wheel plan
|
||||
Wheelplan string `json:"wheelplan"`
|
||||
// year of manufacture
|
||||
YearOfManufacture int32 `json:"yearOfManufacture"`
|
||||
}
|
||||
Reference in New Issue
Block a user