api

package
v0.0.0-...-5ced276 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddToCache

func AddToCache(key string, value interface{})

func AddToCacheWithExpiration

func AddToCacheWithExpiration(key string, value interface{}, expiration time.Duration)

func GetFromCache

func GetFromCache(key string) (interface{}, bool)

func HandleAPIRequestBest

func HandleAPIRequestBest(c *gin.Context)

func HandleItemRequest

func HandleItemRequest(c *gin.Context)

HandleItemRequest handles the request for an individual item.

func InitializeCache

func InitializeCache()

Types

type Base

type Base struct {
	ID          int    `json:"id" binding:"required"`
	Type        string `json:"type" binding:"required"`
	By          string `json:"by"`
	Time        int    `json:"time"`
	Kids        []int  `json:"kids,omitempty"`
	Dead        bool   `json:"-"`
	Deleted     bool   `json:"-"`
	Descendants int    `json:"descendants"`
	Score       int    `json:"score"`
	Title       string `json:"title,omitempty"`
	Parent      int    `json:"parent,omitempty"`
	URL         string `json:"url,omitempty"`
	Text        string `json:"text,omitempty"`
}

Base contains possible fields for any response non-required fields are optional and may not exist

type BaseWithKids

type BaseWithKids struct {
	ID          int           `json:"id" binding:"required"`
	Type        string        `json:"type" binding:"required"`
	By          string        `json:"by"`
	Time        int           `json:"time"`
	Kids        []interface{} `json:"kids,omitempty"`
	Dead        bool          `json:"-"`
	Deleted     bool          `json:"-"`
	Descendants int           `json:"descendants"`
	Score       int           `json:"score"`
	Title       string        `json:"title,omitempty"`
	Parent      int           `json:"parent,omitempty"`
	URL         string        `json:"url,omitempty"`
	Text        string        `json:"text,omitempty"`
}

type Comment

type Comment struct {
	ID          int           `json:"id" binding:"required"`
	Type        string        `json:"type" binding:"required"`
	By          string        `json:"by"`
	Time        int           `json:"time"`
	Kids        []interface{} `json:"kids,omitempty"`
	Dead        bool          `json:"-"`
	Deleted     bool          `json:"-"`
	Descendants int           `json:"descendants"`
	Score       int           `json:"score"`
	Parent      int           `json:"parent,omitempty"`
	Text        string        `json:"text,omitempty"`
}

Jump to

Keyboard shortcuts

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