HelixSpiral / SomersetCountyAPIWrapper

An API wrapper for the Somerset County API at https://api.somersetcounty-me.org/

Home Page:https://api.somersetcounty-me.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Somerset County API Wrapper

This is a simple wrapper for the Somerset County API provided here: https://api.somersetcounty-me.org/

Currently only the DispatchLog endpoint is working so that's all this wrapper provides.

This API also has some oddities, like returning values having random whitespace characters in them. This package trims all results from the API before returning the results.

If you need the values with the whitespaces not removed, fork the project and look at structInternal.go. You should be able to remove the custom unmarshaler and get the whitespaces.

Usage:

package main

import (
	"log"
	"time"

	somersetcountywrapper "github.com/HelixSpiral/SomersetCountyAPIWrapper"
)

func main() {
	currentDate := time.Now()

	sw := somersetcountywrapper.NewWrapper()

	logs, err := sw.GetDispatch(currentDate.Format("20060102"))
	if err != nil {
		panic(err)
	}

	for x, y := range logs {
		log.Printf("[%d]: %+v\r\n", x, y)
	}
}

About

An API wrapper for the Somerset County API at https://api.somersetcounty-me.org/

https://api.somersetcounty-me.org/

License:GNU General Public License v3.0


Languages

Language:Go 100.0%