mothistory

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2023 License: MIT Imports: 3 Imported by: 0

README

MOT History Go SDK

Release Go Report Card Go Reference License

The SDK provides convenient access to the MOT History API for applications written in the Go Programming Language.

Usage Example

package main

import (
	"fmt"

	mothistory "github.com/0xnu/mothistory"
)

const apiKey = "<your-api-key>"

func main() {
	client := mothistory.NewClient(apiKey)

	// Get data by registration
	json, err := client.GetByRegistration("ML58FOU")
	if err != nil {
		fmt.Printf("failed to get data by registration: %v", err)
		return
	}
	fmt.Println(json)

    // Get data by page
    json, err = client.GetByPage(2)
    if err != nil {
        fmt.Printf("failed to get data by page: %v", err)
        return
    }
    fmt.Println(json)

    // Get data by date and page
    json, err = client.GetByDateAndPage("20230201", 1)
    if err != nil {
        fmt.Printf("failed to get data by date and page: %v", err)
        return
    }
    fmt.Println(json)

    // Get data by vehicle ID
    json, err = client.GetByVehicleID("<enter your vehicle id here>")
    if err != nil {
        fmt.Printf("failed to get data by vehicle ID: %v", err)
        return
    }
    fmt.Println(json)

}

Setting up a MOT History API

You can use this support form to request an API Key.

Using the MOT History API

You can read the API documentation to understand what's possible with the MOT History API. If you need further assistance, don't hesitate to contact the DVSA.

License

This project is licensed under the MIT License.

(c) 2023 Finbarrs Oketunji.

The MOT History API Go SDK is Licensed under the Open Government Licence v3.0

Documentation

Index

Constants

View Source
const BaseURL = "https://beta.check-mot.service.gov.uk/trade/vehicles/mot-tests"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(apiKey string) *Client

func (*Client) GetByDateAndPage

func (c *Client) GetByDateAndPage(date string, page int) (*simplejson.Json, error)

func (*Client) GetByPage

func (c *Client) GetByPage(page int) (*simplejson.Json, error)

func (*Client) GetByRegistration

func (c *Client) GetByRegistration(registration string) (*simplejson.Json, error)

func (*Client) GetByVehicleID

func (c *Client) GetByVehicleID(vehicleId string) (*simplejson.Json, error)

Jump to

Keyboard shortcuts

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