Public holidays API (#212)

This commit is contained in:
Dominic Wong
2021-09-21 18:51:19 +01:00
committed by GitHub
parent 09b06bd66f
commit 33653f7698
29 changed files with 1816 additions and 7 deletions

View File

@@ -0,0 +1,4 @@
curl "https://api.m3o.com/v1/holidays/Countries" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MICRO_API_TOKEN" \
-d '{}'

View File

@@ -0,0 +1,14 @@
package example
import (
"fmt"
"github.com/micro/services/clients/go/holidays"
"os"
)
//
func ListCountries() {
holidaysService := holidays.NewHolidaysService(os.Getenv("MICRO_API_TOKEN"))
rsp, err := holidaysService.Countries(&holidays.CountriesRequest{})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,12 @@
import * as holidays from "m3o/holidays";
//
async function ListCountries() {
let holidaysService = new holidays.HolidaysService(
process.env.MICRO_API_TOKEN
);
let rsp = await holidaysService.countries({});
console.log(rsp);
}
await ListCountries();

View File

@@ -0,0 +1,7 @@
curl "https://api.m3o.com/v1/holidays/List" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MICRO_API_TOKEN" \
-d '{
"country_code": "GB",
"year": 2022
}'

View File

@@ -0,0 +1,16 @@
package example
import (
"fmt"
"github.com/micro/services/clients/go/holidays"
"os"
)
//
func GetHolidays() {
holidaysService := holidays.NewHolidaysService(os.Getenv("MICRO_API_TOKEN"))
rsp, err := holidaysService.List(&holidays.ListRequest{
Year: 2022,
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,15 @@
import * as holidays from "m3o/holidays";
//
async function GetHolidays() {
let holidaysService = new holidays.HolidaysService(
process.env.MICRO_API_TOKEN
);
let rsp = await holidaysService.list({
country_code: "GB",
year: 2022,
});
console.log(rsp);
}
await GetHolidays();

View File

@@ -11,9 +11,9 @@ func PublishAmessage() {
streamService := stream.NewStreamService(os.Getenv("MICRO_API_TOKEN"))
rsp, err := streamService.Publish(&stream.PublishRequest{
Message: map[string]interface{}{
"type": "signup",
"user": "john",
"id": "1",
"type": "signup",
},
Topic: "events",
})