checkiday

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2019 License: MIT Imports: 5 Imported by: 0

README

Checkiday

Godoc

Checkiday.com is the world's most complete holiday listing website. There are at least 4300 unique holidays on the site that checkiday has verified for authenticity. This Go package, not endorsed by checkiday.com, serves as a simple wrapper on their API so that you can use their awesome data in your awesome app.

Usage

Get today's holidays

import "github.com/retgits/checkiday"

days, err := checkiday.Today()
if err != nil {
    fmt.Printf("Oh noes, an error occured: %s", err.Error())
}

for idx := range days.Holidays {
    fmt.Printf("Today is %s\n", days.Holidays[idx].Name)
}

Get the holidays of a specific date (must be formatted as mm/dd/yyyy)

import "github.com/retgits/checkiday"

days, err := checkiday.On("07/30/2018")
if err != nil {
    fmt.Printf("Oh noes, an error occured: %s", err.Error())
}

for idx := range days.Holidays {
    fmt.Printf("On 07/30/2018 we celebrated %s\n", days.Holidays[idx].Name)
}

July 30th is a special day, since we celebrate National Cheesecake Day

License

See the LICENSE file in the repository

Acknowledgements

A most sincere thanks to the team of Checkiday, for building such an awesome service that I enjoy every day!

This package is not endorsed by Checkiday.com

Documentation

Overview

Package checkiday allows you to make use of the world's most complete holiday listing website, checkiday.com. There are at least 4300 unique holidays on the site that checkiday has verified for authenticity. This Go package is not endorsed by checkiday.com and serves as a simple wrapper on their API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checkiday

type Checkiday struct {
	Error      string    `json:"error"`
	Date       string    `json:"date"`
	Holidays   []Holiday `json:"holidays"`
	Number     int64     `json:"number"`
	LastUpdate int64     `json:"lastUpdate"`
}

Checkiday is the result coming from checkiday.com

func On

func On(date string) (Checkiday, error)

On calls the checkiday.com API and returns all the holidays for the mentioned date or an error. The date must be in form of mm/dd/yyyy.

func Today

func Today() (Checkiday, error)

Today calls the checkiday.com API and returns all the holidays that are today (based on the locale of the machine) or an error.

type Holiday

type Holiday struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

Holiday is a struct to capture the details of every holiday sent back by checkiday

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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