stackoverflow

package
v0.0.0-...-c5d5a31 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package stackoverflow fetches stackoverflow data

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Key        string
	HTTPClient *http.Client
}

API retrieves information from the Stack Overflow API

func (*API) Fetch

func (a *API) Fetch(query string, tags []string) (Response, error)

Fetch retrieves a Stack Overflow response

type Answer

type Answer struct {
	Owner `json:"owner"`
	Score int    `json:"score"`
	Body  string `json:"body"`
}

Answer is a single answer

type Fetcher

type Fetcher interface {
	Fetch(query string, tags []string) (Response, error)
}

Fetcher retrieves a StackOverflowResponse

type Item

type Item struct {
	Answers []Answer `json:"answers"`
	Link    string   `json:"link"`
	Title   string   `json:"title"`
}

Item is a question with answers, a link, and a title

type Owner

type Owner struct {
	DisplayName string `json:"display_name"`
}

Owner is the person who answered the question TODO: I wasn't able to get both the User's display name and link to their profile or id. Can select one or the other but not both in their filter.

type Response

type Response struct {
	Items          []Item `json:"items"`
	QuotaMax       int    `json:"quota_max"`
	QuotaRemaining int    `json:"quota_remaining"`
}

Response is the raw response from Stack Overflow

Jump to

Keyboard shortcuts

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