newsapi

package
v0.0.0-...-720374e Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Article

type Article struct {
	Source      Source      `json:"source"`
	Author      interface{} `json:"author"`
	Title       string      `json:"title"`
	Description string      `json:"description"`
	URL         string      `json:"url"`
	URLToImage  string      `json:"urlToImage"`
	PublishedAt time.Time   `json:"publishedAt"`
	Content     string      `json:"content"`
}

type HTTP

type HTTP interface {
	Do(req *http.Request) (*http.Response, error)
}

type HeadlinesResponse

type HeadlinesResponse struct {
	Status       string    `json:"status"`
	TotalResults int       `json:"totalResults"`
	Articles     []Article `json:"articles"`
}

type NewsAPI

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

func New

func New(key string) *NewsAPI

func (*NewsAPI) Get

func (n *NewsAPI) Get(url string, params *url.Values, v interface{}) error

func (*NewsAPI) Headlines

func (n *NewsAPI) Headlines(country, category, q string, pageSize, page int) (*HeadlinesResponse, error)

type Source

type Source struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

Jump to

Keyboard shortcuts

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