googl

package module
v0.0.0-...-20c95f0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2018 License: MIT Imports: 4 Imported by: 1

README

googl


A library (and CLI) for Google Url Shortener service.

Installation

To install the library:

go get github.com/bscott/googl

To install the library with the CLI:

go get github.com/bscott/googl/cli/googl

Usage

// Shorten an url
googl shorten -k <your-api-key> <url-to-be-shortened>

// Expand an url
googl expand -k <your-api-key> <url-to-be-expanded>

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Googl

type Googl struct {
	Key string
}

Googl struct

func NewClient

func NewClient(key string) *Googl

NewClient returns a Client of Googl

func (*Googl) Expand

func (c *Googl) Expand(shortURL string) string

Expand takes a shortURL & returns the expanded URL

func (*Googl) Shorten

func (c *Googl) Shorten(url string) (ShortMsg, error)

Shorten function takes a longUrl and return a struct with the shorten data

type LongMsg

type LongMsg struct {
	Kind    string `json:"kind"`
	ID      string `json:"id"`
	LongURL string `json:"longUrl"`
	Status  string `json:"status"`
}

LongMsg struct

type ShortMsg

type ShortMsg struct {
	Kind    string `json:"kind"`
	ID      string `json:"id"`
	LongURL string `json:"longUrl"`
}

ShortMsg struct

Directories

Path Synopsis
cli

Jump to

Keyboard shortcuts

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