mirror of
https://github.com/kevin-DL/m3o-go.git
synced 2026-01-11 18:44:26 +00:00
Url
An m3o.com API. For example usage see m3o.com/url/api.
Endpoints:
List
List all the shortened URLs
package example
import(
"fmt"
"os"
"go.m3o.com/url"
)
// List all the shortened URLs
func ListYourShortenedUrls() {
urlService := url.NewUrlService(os.Getenv("M3O_API_TOKEN"))
rsp, err := urlService.List(&url.ListRequest{
})
fmt.Println(rsp, err)
}
Shorten
Shorten a long URL
https://m3o.com/url/api#Shorten
package example
import(
"fmt"
"os"
"go.m3o.com/url"
)
// Shorten a long URL
func ShortenAlongUrl() {
urlService := url.NewUrlService(os.Getenv("M3O_API_TOKEN"))
rsp, err := urlService.Shorten(&url.ShortenRequest{
})
fmt.Println(rsp, err)
}
Proxy
Proxy returns the destination URL of a short URL.
package example
import(
"fmt"
"os"
"go.m3o.com/url"
)
// Proxy returns the destination URL of a short URL.
func ResolveAshortUrlToAlongDestinationUrl() {
urlService := url.NewUrlService(os.Getenv("M3O_API_TOKEN"))
rsp, err := urlService.Proxy(&url.ProxyRequest{
})
fmt.Println(rsp, err)
}