Categorygithub.com/0xnu/mothistory
modulepackage
1.0.7
Repository: https://github.com/0xnu/mothistory.git
Documentation: pkg.go.dev

# README

MOT History Go SDK

Test 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.

Tests

Execute this command: go test -v

Integration Example

package main

import (
	"encoding/json"
	"fmt"
	"log"

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

const (
	clientID     = "enter_your_client_id>"
	clientSecret = "enter_your_client_secret>"
	apiKey       = "enter_your_api_key"
)

func main() {
	config := mothistory.ClientConfig{
		ClientID:     clientID,
		ClientSecret: clientSecret,
		APIKey:       apiKey,
	}
	client := mothistory.NewClient(config, nil)

	// Get data by registration
	data, err := client.GetByRegistration("ML58FOU")
	if err != nil {
		log.Fatalf("failed to get data by registration: %v", err)
	}
	printJSON(data)

	// Get data by VIN
	data, err = client.GetByVIN("AISXXXTEST1239617")
	if err != nil {
		log.Fatalf("failed to get data by VIN: %v", err)
	}
	printJSON(data)

	// Get bulk download data
	data, err = client.GetBulkDownload()
	if err != nil {
		log.Fatalf("failed to get bulk download data: %v", err)
	}
	printJSON(data)

	// Renew credentials
	data, err = client.RenewCredentials(apiKey, "[email protected]")
	if err != nil {
		log.Fatalf("failed to renew credentials: %v", err)
	}
	printJSON(data)
}

func printJSON[T any](data *T) {
	prettyData, err := json.MarshalIndent(data, "", "  ")
    if err != nil {
			log.Fatalf("failed to marshal vehicle data: %v", err)
    }
    fmt.Println(string(prettyData))
}

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.

Copyright

(c) 2023 - 2024 Finbarrs Oketunji.

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

# Functions

No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

No description provided by the author

# Structs

No description provided by the author
Response for {baseURL}/[bulk-download].
No description provided by the author
No description provided by the author
Response for v1/trade/[credentials].
No description provided by the author
No description provided by the author
Response for {baseURL}/[registration|vin]/<registration|vin>.