gx

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

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

Go to latest
Published: Nov 1, 2022 License: Zlib Imports: 5 Imported by: 0

README

gx

Go Report Card

A Go library for vichan compatible APIs.

As of now this project is fairly bare bones, and only wraps around the read-only API. The goal of this library eventually is to allow full clients to be written in Go.

This project is licensed under the permissive zlib license, which you can read in the COPYING file.

Pull requests and issues are welcome.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Catalog

type Catalog struct {
	Pages []CatalogPage
}

Catalog Represents a full catalog of pages

type CatalogPage

type CatalogPage struct {
	PageNumber int    `json:"page"`
	Threads    []Post `json:"threads"`
}

CatalogPage Represents a page of the catalog

type Client

type Client struct {
	Mutex      sync.RWMutex
	UserAgent  string
	Domain     string
	HTTPClient *http.Client
}

Client represents a client accessing a site's API

func New

func New(domain string) *Client

New returns a Client struct configured to work with a given domain.

func (*Client) GetCatalog

func (c *Client) GetCatalog(board string) (*Catalog, error)

GetCatalog gets a catalog struct from a given board's name.

func (*Client) GetThread

func (c *Client) GetThread(board string, number uint64) (*Thread, error)

GetThread gets a Thread struct from a given thread number and board name.

type File

type File struct {
	Extension       string `json:"ext"`
	Filename        string `json:"file"`
	Filesize        int    `json:"fsize"`
	Height          int    `json:"h"`
	Width           int    `json:"w"`
	ThumbnailHeight int    `json:"tn_h"`
	ThumbnailWidth  int    `json:"tn_w"`
}

File represents a file, only ever used in the context of extra files attached to a post

type Post

type Post struct {
	No              int    `json:"no"`
	LastModified    int    `json:"last_modified"`
	Comment         string `json:"com"`
	Cyclical        string `json:"cyclical"`
	Time            int    `json:"time"`
	Filesize        int    `json:"fsize"`
	Filename        string `json:"filename"`
	Images          int    `json:"images"`
	Locked          int    `json:"locked"`
	OmittedImages   int    `json:"omitted_images"`
	OmittedPosts    int    `json:"omitted_posts"`
	Name            string `json:"name"`
	Replies         int    `json:"replies"`
	ReplyTo         int    `json:"resto"`
	Sticky          int    `json:"sticky"`
	MD5             string `json:"md5"`
	Extension       string `json:"ext"`
	RenamedFilename string `json:"tim"`
	ThumbnailHeight int    `json:"tn_h"`
	ThumbnailWidth  int    `json:"tn_w"`
	Height          int    `json:"h"`
	Width           int    `json:"w"`
	ExtraFiles      []File `json:"extra_files"`
}

Post represents a post or thread post in the context of the catalog.

type Thread

type Thread struct {
	Posts []Post `json:"posts"`
}

Thread represents a true thread

Jump to

Keyboard shortcuts

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