Files
m3o-go/examples/holidays/README.md
2022-02-16 17:43:49 +00:00

1.1 KiB
Executable File

Holidays

An m3o.com API. For example usage see m3o.com/holidays/api.

Endpoints:

Countries

Get the list of countries that are supported by this API

https://m3o.com/holidays/api#Countries

package example

import(
	"fmt"
	"os"

	"go.m3o.com/holidays"
)

// Get the list of countries that are supported by this API
func ListCountries() {
	holidaysService := holidays.NewHolidaysService(os.Getenv("M3O_API_TOKEN"))
	rsp, err := holidaysService.Countries(&holidays.CountriesRequest{
		
	})
	fmt.Println(rsp, err)
	
}

List

List the holiday dates for a given country and year

https://m3o.com/holidays/api#List

package example

import(
	"fmt"
	"os"

	"go.m3o.com/holidays"
)

// List the holiday dates for a given country and year
func GetHolidays() {
	holidaysService := holidays.NewHolidaysService(os.Getenv("M3O_API_TOKEN"))
	rsp, err := holidaysService.List(&holidays.ListRequest{
		Year: 2022,

	})
	fmt.Println(rsp, err)
	
}