models

package
v2.2.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package models contains the models for gLyrics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lyrics

type Lyrics struct {
	Url         string        `json:"url"`
	Title       string        `json:"title"`
	Artist      string        `json:"artist"`
	Lyrics      string        `json:"lyrics"`
	ReleaseDate time.Time     `json:"release_date,omitempty"`
	Origin      *LyricsOrigin `json:"origin,omitempty"`
}

Lyrics represents a song's lyrics and metadata. The object is JSONifiable.

type LyricsOrigin

type LyricsOrigin struct {
	Name string `json:"name"`
	Url  string `json:"url"`
}

LyricsOrigin contains metadata regarding the extractor which extracted the lyrics.

type Request

type Request struct {
	Url string
	// contains filtered or unexported fields
}

Request is a wrapper around a url which makes it easy to access the data it points to.

func NewRequest

func NewRequest(url string) *Request

NewRequest creates a new request and initialises it with the provided url.

func (*Request) Close

func (req *Request) Close()

Close performs cleanup for the Request. This is a no-op if the Request doesn't need cleanup

func (*Request) Document

func (req *Request) Document() (*goquery.Document, error)

Document returns a goquery.Document for the Request.Response The Document is internally cached.

func (*Request) Request

func (req *Request) Request() *http.Request

Request creates an http.Request (GET) for the url and returns it. The request is internally cached so calling this method multiple times will return the same http.Request.

func (*Request) Response

func (req *Request) Response() (*http.Response, error)

Response performs the Request.Request and returns the response/error. The Response is internally cached and will be cleaned up by Request.Close.

func (*Request) Text

func (req *Request) Text() (string, error)

Text retrieves the text response. It reads the text from the Request.Response body. The text is internally cached

Jump to

Keyboard shortcuts

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