checkmot

package
v0.0.0-...-7841a0e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoResults        = errors.New("no results")
	ErrMultipleVehicles = errors.New("multiple vehicles returned")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	*jsonclient.Client
}

func NewClient

func NewClient(baseURL, key string) *Client

NewClient creates a new vehicle service client.

func (*Client) GetRecordByVRM

func (c *Client) GetRecordByVRM(ctx context.Context, vrm string) (res *Vehicle, err error)

type Date

type Date string

Date accepts the DVSA's silly date format (2006.01.02) and converts it to ISO8601 while unmarshalling. When marshalling, it remains as ISO8601.

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(data []byte) (err error)

type MOTTest

type MOTTest struct {
	CompletedDate      Time   `json:"completedDate"`
	TestResult         string `json:"testResult"`
	ExpiryDate         *Date  `json:"expiryDate"`
	OdometerValue      string `json:"odometerValue"`
	OdometerUnit       string `json:"odometerUnit"`
	OdometerResultType string `json:"odometerResultType"`
	MOTTestNumber      string `json:"motTestNumber"`

	// RfRAndComments provide any "reasons for rejection" and comments
	RfRAndComments []*RfROrComment `json:"rfrAndComments"`
}

type MOTTestsByCompletedDate

type MOTTestsByCompletedDate []*MOTTest

func (MOTTestsByCompletedDate) Len

func (a MOTTestsByCompletedDate) Len() int

func (MOTTestsByCompletedDate) Less

func (a MOTTestsByCompletedDate) Less(i, j int) bool

func (MOTTestsByCompletedDate) Swap

func (a MOTTestsByCompletedDate) Swap(i, j int)

type RfROrComment

type RfROrComment struct {
	Text      string `json:"text"`
	Type      string `json:"type"`
	Dangerous bool   `json:"dangerous"`
}

type Time

type Time struct {
	time.Time
}

Time accepts the DVSA's silly time format (2006.01.02 15:04:05) and converts it to ISO8601 while unmarshalling. When marshalling, it remains as ISO8601.

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) (err error)

type Vehicle

type Vehicle struct {
	Registration  string `json:"registration"`
	Make          string `json:"make"`
	Model         string `json:"model"`
	FuelType      string `json:"fuelType"`
	PrimaryColour string `json:"primaryColour"`

	ManufactureYear *string `json:"manufactureYear"`
	DVLAID          *string `json:"dvlaId"`
	MOTTestDueDate  *string `json:"motTestDueDate"`

	FirstUsedDate *Date      `json:"firstUsedDate"`
	MOTTests      []*MOTTest `json:"motTests"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL