Files
m3o-go/examples/time/README.md
2022-02-19 18:01:25 +00:00

963 B
Executable File

Time

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

Endpoints:

Zone

Get the timezone info for a specific location

https://m3o.com/time/api#Zone

package example

import(
	"fmt"
	"os"

	"go.m3o.com/time"
)

// Get the timezone info for a specific location
func GetTheTimezoneInfoForAspecificLocation() {
	timeService := time.NewTimeService(os.Getenv("M3O_API_TOKEN"))
	rsp, err := timeService.Zone(&time.ZoneRequest{
		Location: "London",

	})
	fmt.Println(rsp, err)
	
}

Now

Get the current time

https://m3o.com/time/api#Now

package example

import(
	"fmt"
	"os"

	"go.m3o.com/time"
)

// Get the current time
func ReturnsCurrentTimeOptionallyWithLocation() {
	timeService := time.NewTimeService(os.Getenv("M3O_API_TOKEN"))
	rsp, err := timeService.Now(&time.NowRequest{
		
	})
	fmt.Println(rsp, err)
	
}