mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-16 21:14:36 +00:00
Public holidays API (#212)
This commit is contained in:
4
examples/holidays/countries/curl/listCountries.sh
Executable file
4
examples/holidays/countries/curl/listCountries.sh
Executable 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 '{}'
|
||||
14
examples/holidays/countries/go/listCountries.go
Executable file
14
examples/holidays/countries/go/listCountries.go
Executable 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)
|
||||
}
|
||||
12
examples/holidays/countries/node/listCountries.js
Executable file
12
examples/holidays/countries/node/listCountries.js
Executable 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();
|
||||
7
examples/holidays/list/curl/getHolidays.sh
Executable file
7
examples/holidays/list/curl/getHolidays.sh
Executable 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
|
||||
}'
|
||||
16
examples/holidays/list/go/getHolidays.go
Executable file
16
examples/holidays/list/go/getHolidays.go
Executable 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)
|
||||
}
|
||||
15
examples/holidays/list/node/getHolidays.js
Executable file
15
examples/holidays/list/node/getHolidays.js
Executable 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();
|
||||
@@ -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",
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user