url

package
Version: v0.0.0-...-795d1ad Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ListRequest

type ListRequest struct {
	// filter by short URL, optional
	ShortUrl string `json:"shortUrl"`
}

type ListResponse

type ListResponse struct {
	UrlPairs *URLPair `json:"urlPairs"`
}

type ProxyRequest

type ProxyRequest struct {
	// short url ID, without the domain, eg. if your short URL is
	// `m3o.one/u/someshorturlid` then pass in `someshorturlid`
	ShortUrl string `json:"shortUrl"`
}

type ProxyResponse

type ProxyResponse struct {
	DestinationUrl string `json:"destinationUrl"`
}

type ShortenRequest

type ShortenRequest struct {
	DestinationUrl string `json:"destinationUrl"`
}

type ShortenResponse

type ShortenResponse struct {
	ShortUrl string `json:"shortUrl"`
}

type URLPair

type URLPair struct {
	Created        int64  `json:"created"`
	DestinationUrl string `json:"destinationUrl"`
	// HitCount keeps track many times the short URL has been resolved.
	// Hitcount only gets saved to disk (database) after every 10th hit, so
	// its not intended to be 100% accurate, more like an almost correct estimate.
	HitCount int64  `json:"hitCount"`
	Owner    string `json:"owner"`
	ShortUrl string `json:"shortUrl"`
}

type UrlService

type UrlService struct {
	// contains filtered or unexported fields
}

func NewUrlService

func NewUrlService(token string) *UrlService

func (*UrlService) List

func (t *UrlService) List(request *ListRequest) (*ListResponse, error)

List information on all the shortened URLs that you have created

func (*UrlService) Proxy

func (t *UrlService) Proxy(request *ProxyRequest) (*ProxyResponse, error)

Proxy returns the destination URL of a short URL.

func (*UrlService) Shorten

func (t *UrlService) Shorten(request *ShortenRequest) (*ShortenResponse, error)

Shortens a destination URL and returns a full short URL.

Source Files

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL