holidayapi

package module
v0.0.0-...-9c712ca Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2019 License: MIT Imports: 6 Imported by: 0

README

go-holidayapi

Official Go library for Holiday API

Usage

package main

import (
    "fmt"
    "github.com/joshtronic/go-holidayapi"
)

func main() {
    hapi := holidayapi.NewV1("_MY_API_KEY_")

    holidays, err := hapi.Holidays(map[string]interface{}{
        // Required
        "country": "US",
        "year":    "2016",
        // Optional
        // "month":    "7",
        // "day":      "4",
        // "previous": "true",
        // "upcoming": "true",
        // "public":   "true",
        // "pretty":   "true",
    })

    if err != nil {
        // Error handling...
    }

    fmt.Println("%#v\n", holidays)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Holiday

type Holiday struct {
	Name     string         `json:"name"`
	Date     timeutils.Time `json:"date,omniempty"`
	Observed timeutils.Time `json:"observed"`
	Public   bool           `json:"public"`
}

type Request

type Request struct {
	Used      int32          `json:"used"`
	Available int32          `json:"available"`
	Resets    timeutils.Time `json:"resets"`
}

type Respone

type Respone struct {
	Status   int32     `json:"status"`
	Requests Request   `json:"requests"`
	Holidays []Holiday `json:"holidays"`
}

type V1

type V1 struct {
	Url string
	Key string
}

func NewV1

func NewV1(key string) *V1

func (*V1) Holidays

func (v1 *V1) Holidays(args map[string]string) (Respone, error)

Jump to

Keyboard shortcuts

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