Documentation ¶
Overview ¶
Package urlshortener provides access to the URL Shortener API.
See https://developers.google.com/url-shortener/v1/getting_started
Usage example:
import "google.golang.org/api/urlshortener/v1" ... urlshortenerService, err := urlshortener.New(oauthHttpClient)
Index ¶
Constants ¶
const (
// Manage your goo.gl short URLs
UrlshortenerScope = "https://www.googleapis.com/auth/urlshortener"
)
OAuth2 scopes used by this API.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnalyticsSnapshot ¶
type AnalyticsSnapshot struct { // Browsers: Top browsers, e.g. "Chrome"; sorted by (descending) click // counts. Only present if this data is available. Browsers []*StringCount `json:"browsers,omitempty"` // Countries: Top countries (expressed as country codes), e.g. "US" or // "DE"; sorted by (descending) click counts. Only present if this data // is available. Countries []*StringCount `json:"countries,omitempty"` // LongUrlClicks: Number of clicks on all goo.gl short URLs pointing to // this long URL. LongUrlClicks int64 `json:"longUrlClicks,omitempty,string"` // Platforms: Top platforms or OSes, e.g. "Windows"; sorted by // (descending) click counts. Only present if this data is available. Platforms []*StringCount `json:"platforms,omitempty"` // Referrers: Top referring hosts, e.g. "www.google.com"; sorted by // (descending) click counts. Only present if this data is available. Referrers []*StringCount `json:"referrers,omitempty"` // ShortUrlClicks: Number of clicks on this short URL. ShortUrlClicks int64 `json:"shortUrlClicks,omitempty,string"` }
type AnalyticsSummary ¶
type AnalyticsSummary struct { // AllTime: Click analytics over all time. AllTime *AnalyticsSnapshot `json:"allTime,omitempty"` // Day: Click analytics over the last day. Day *AnalyticsSnapshot `json:"day,omitempty"` // Month: Click analytics over the last month. Month *AnalyticsSnapshot `json:"month,omitempty"` // TwoHours: Click analytics over the last two hours. TwoHours *AnalyticsSnapshot `json:"twoHours,omitempty"` // Week: Click analytics over the last week. Week *AnalyticsSnapshot `json:"week,omitempty"` }
type Service ¶
type Service struct { BasePath string // API endpoint base URL Url *UrlService // contains filtered or unexported fields }
type StringCount ¶
type Url ¶
type Url struct { // Analytics: A summary of the click analytics for the short and long // URL. Might not be present if not requested or currently unavailable. Analytics *AnalyticsSummary `json:"analytics,omitempty"` // Created: Time the short URL was created; ISO 8601 representation // using the yyyy-MM-dd'T'HH:mm:ss.SSSZZ format, e.g. // "2010-10-14T19:01:24.944+00:00". Created string `json:"created,omitempty"` // Id: Short URL, e.g. "http://goo.gl/l6MS". Id string `json:"id,omitempty"` // Kind: The fixed string "urlshortener#url". Kind string `json:"kind,omitempty"` // LongUrl: Long URL, e.g. "http://www.google.com/". Might not be // present if the status is "REMOVED". LongUrl string `json:"longUrl,omitempty"` // Status: Status of the target URL. Possible values: "OK", "MALWARE", // "PHISHING", or "REMOVED". A URL might be marked "REMOVED" if it was // flagged as spam, for example. Status string `json:"status,omitempty"` }
type UrlGetCall ¶
type UrlGetCall struct {
// contains filtered or unexported fields
}
func (*UrlGetCall) Do ¶
func (c *UrlGetCall) Do() (*Url, error)
func (*UrlGetCall) Fields ¶
func (c *UrlGetCall) Fields(s ...googleapi.Field) *UrlGetCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.
func (*UrlGetCall) Projection ¶
func (c *UrlGetCall) Projection(projection string) *UrlGetCall
Projection sets the optional parameter "projection": Additional information to return.
type UrlHistory ¶
type UrlHistory struct { // Items: A list of URL resources. Items []*Url `json:"items,omitempty"` // ItemsPerPage: Number of items returned with each full "page" of // results. Note that the last page could have fewer items than the // "itemsPerPage" value. ItemsPerPage int64 `json:"itemsPerPage,omitempty"` // Kind: The fixed string "urlshortener#urlHistory". Kind string `json:"kind,omitempty"` // NextPageToken: A token to provide to get the next page of results. NextPageToken string `json:"nextPageToken,omitempty"` // TotalItems: Total number of short URLs associated with this user (may // be approximate). TotalItems int64 `json:"totalItems,omitempty"` }
type UrlInsertCall ¶
type UrlInsertCall struct {
// contains filtered or unexported fields
}
func (*UrlInsertCall) Do ¶
func (c *UrlInsertCall) Do() (*Url, error)
func (*UrlInsertCall) Fields ¶
func (c *UrlInsertCall) Fields(s ...googleapi.Field) *UrlInsertCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.
type UrlListCall ¶
type UrlListCall struct {
// contains filtered or unexported fields
}
func (*UrlListCall) Do ¶
func (c *UrlListCall) Do() (*UrlHistory, error)
func (*UrlListCall) Fields ¶
func (c *UrlListCall) Fields(s ...googleapi.Field) *UrlListCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.
func (*UrlListCall) Projection ¶
func (c *UrlListCall) Projection(projection string) *UrlListCall
Projection sets the optional parameter "projection": Additional information to return.
func (*UrlListCall) StartToken ¶
func (c *UrlListCall) StartToken(startToken string) *UrlListCall
StartToken sets the optional parameter "start-token": Token for requesting successive pages of results.
type UrlService ¶
type UrlService struct {
// contains filtered or unexported fields
}
func NewUrlService ¶
func NewUrlService(s *Service) *UrlService
func (*UrlService) Get ¶
func (r *UrlService) Get(shortUrl string) *UrlGetCall
Get: Expands a short URL or gets creation time and analytics.
func (*UrlService) Insert ¶
func (r *UrlService) Insert(url *Url) *UrlInsertCall
Insert: Creates a new short URL.
func (*UrlService) List ¶
func (r *UrlService) List() *UrlListCall
List: Retrieves a list of URLs shortened by a user.