url

package
v4.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 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,string"`
	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,string"`
	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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL