gohn

package module
v0.0.0-...-f14fbcf Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2015 License: MIT Imports: 3 Imported by: 0

README

gohn

GoDoc Build Status

Golang package for the new hacker news api at firebaseio.com.

It uses bndr/gopencils for the http communication and json unmarshalling.

TODO

See issue #1.

Documentation

Overview

Package gohn implements a client for the Hacker News REST API from firebaseio

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Items ItemService
	Users UserService
}

Client exposes the different services for the HackerNews api

func NewClient

func NewClient(httpClient *http.Client) *Client

NewClient returns a new api client

type Item

type Item struct {
	ID      int              `json:"id"`
	Deleted bool             `json:"deleted"`
	Type    string           `json:"type"`
	By      string           `json:"by"`
	Time    encodedTime.Unix `json:"time"`
	Text    string           `json:"text"`
	Dead    bool             `json:"dead"`
	Parent  int              `json:"parent"`
	Kids    []int            `json:"kids"`
	URL     string           `json:"url"`
	Score   int              `json:"score"`
	Title   string           `json:"title"`
	Parts   []int            `json:"parts"`
}

Item represents a Story, Comments, Job, 'Ask HN' or a Poll see https://github.com/HackerNews/API#items for more

type ItemService

type ItemService interface {
	TopStoryIDs() ([]int, error)
	TopStories() ([]*Item, error)
	MaxItemID() (int, error)
	Item(int) (*Item, error)
}

ItemService has all methods that the firebase api exposes for items

type User

type User struct {
	About     string           `json:"about"`
	Created   encodedTime.Unix `json:"created"`
	Delay     int              `json:"delay"`
	ID        string           `json:"id"`
	Karma     int              `json:"karma"`
	Submitted []int            `json:"submitted"`
}

User is a user of HN see https://github.com/HackerNews/API#users for more

type UserService

type UserService interface {
	Get(id string) (*User, error)
}

UserService has all methods that the firebase api exposes for users

Directories

Path Synopsis
cmd
hnui command
simple command

Jump to

Keyboard shortcuts

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