Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2021-10-29 06:38:17 +00:00
parent 87f310675d
commit ae73a4aca1
170 changed files with 6189 additions and 42 deletions

59
examples/holidays/README.md Executable file
View File

@@ -0,0 +1,59 @@
# Holidays
An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Holidays/api](https://m3o.com/Holidays/api).
Endpoints:
## Countries
Get the list of countries that are supported by this API
[https://m3o.com/holidays/api#Countries](https://m3o.com/holidays/api#Countries)
```go
package example
import(
"fmt"
"os"
"github.com/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](https://m3o.com/holidays/api#List)
```go
package example
import(
"fmt"
"os"
"github.com/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)
}
```

View File

@@ -0,0 +1,15 @@
package example
import (
"fmt"
"os"
"github.com/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)
}

View File

@@ -0,0 +1,17 @@
package example
import (
"fmt"
"os"
"github.com/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)
}