news

package
v0.0.0-...-a0cc06e Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2021 License: MIT Imports: 6 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 struct {
		ID   interface{} `json:"id"`
		Name string      `json:"name"`
	} `json:"source"`
	Author      string    `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"`
}

Article is a struct

func (*Article) FormatPublishedDate

func (a *Article) FormatPublishedDate() string

type Client

type Client struct {
	PageSize int
	// contains filtered or unexported fields
}

Client is a struct for a HTTP Client

func NewClient

func NewClient(httpClient *http.Client, key string, pageSize int) *Client

NewClient creates a new HTTP Client

func (*Client) FetchEverything

func (c *Client) FetchEverything(query, page string) (*Results, error)

FetchEverything is a function to, you guessed it, fetch all results for a search query

type Results

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

Results is a struct

Jump to

Keyboard shortcuts

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