imb_8chanmoe

package
v0.0.0-...-921f456 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseBoardPages

func ParseBoardPages(body []byte) (int, error)

func ParseBoards

func ParseBoards(body []byte) ([]imageboard.Board, error)

func ParseCatalog

func ParseCatalog(body []byte) *u.OrderedMap[int, imageboard.Thread]

func ParseThread

func ParseThread(body []byte, threadNumber int) (imageboard.Thread, error)

Types

type Board8chanmoe

type Board8chanmoe struct {
	Acronym  string
	Title    string
	Worksafe bool

	Threads *u.OrderedMap[int, imageboard.Thread]
}

func (Board8chanmoe) GetAcronym

func (b Board8chanmoe) GetAcronym() string

func (Board8chanmoe) GetThreads

func (b Board8chanmoe) GetThreads() *u.OrderedMap[int, imageboard.Thread]

func (Board8chanmoe) GetTitle

func (b Board8chanmoe) GetTitle() string

func (Board8chanmoe) IsWorksafe

func (b Board8chanmoe) IsWorksafe() bool

func (Board8chanmoe) RemoveThread

func (b Board8chanmoe) RemoveThread(postId int) bool

func (*Board8chanmoe) SetThreads

func (b *Board8chanmoe) SetThreads(threads *u.OrderedMap[int, imageboard.Thread])

type Catalog8chanmoeResponse

type Catalog8chanmoeResponse struct {
	Page    int32 `json:"page"`
	Threads []*Thread8chanmoeResponse
}

type ExtraFile

type ExtraFile struct {
	TnH         int32  `json:"tn_h"`
	TnW         int32  `json:"tn_w"`
	H           int    `json:"h"`
	W           int    `json:"w"`
	Fsize       int64  `json:"fsize"`
	Filename    string `json:"filename"`
	Ext         string `json:"ext"`
	Tim         string `json:"tim"`
	Spoiler     int    `json:"spoiler"`
	FileDeleted int    `json:"filedeleted"`
	Md5         string `json:"md5"`
}

type File8chanmoe

type File8chanmoe struct {
	Tim      string
	Filename string
	Ext      string
	Fsize    int64
	Md5      string
	W        int
	H        int
	TnW      int32
	TnH      int32
	Deleted  bool
	Spoiler  bool
}

func (File8chanmoe) GetCustomSpoiler

func (f File8chanmoe) GetCustomSpoiler() int32

func (File8chanmoe) GetExt

func (f File8chanmoe) GetExt() string

func (File8chanmoe) GetFilename

func (f File8chanmoe) GetFilename() string

func (File8chanmoe) GetFilesize

func (f File8chanmoe) GetFilesize() int64

func (File8chanmoe) GetHeight

func (f File8chanmoe) GetHeight() int

func (File8chanmoe) GetTim

func (f File8chanmoe) GetTim() string

func (File8chanmoe) GetWidth

func (f File8chanmoe) GetWidth() int

func (File8chanmoe) IsDeleted

func (f File8chanmoe) IsDeleted() bool

func (File8chanmoe) IsSpoiler

func (f File8chanmoe) IsSpoiler() bool

type Imageboard8chanmoe

type Imageboard8chanmoe struct {
	Name           string
	Configurations *imageboard.ImageboardConfigurations
	MyBoards       *u.OrderedMap[string, imageboard.Board]
	Boards         *u.OrderedMap[string, imageboard.Board]
	News           []*News
}

func (Imageboard8chanmoe) GetBoards

func (Imageboard8chanmoe) GetCatalogURI

func (im Imageboard8chanmoe) GetCatalogURI(b imageboard.Board) string

func (Imageboard8chanmoe) GetConfigurations

func (im Imageboard8chanmoe) GetConfigurations() *imageboard.ImageboardConfigurations

func (Imageboard8chanmoe) GetDeletedURI

func (im Imageboard8chanmoe) GetDeletedURI() string

func (Imageboard8chanmoe) GetMyBoards

func (im Imageboard8chanmoe) GetMyBoards() *u.OrderedMap[string, imageboard.Board]

func (Imageboard8chanmoe) GetName

func (im Imageboard8chanmoe) GetName() string

func (Imageboard8chanmoe) GetSpoilerURI

func (im Imageboard8chanmoe) GetSpoilerURI() string

func (Imageboard8chanmoe) GetThreadURI

func (im Imageboard8chanmoe) GetThreadURI(b imageboard.Board, threadNumber int) string

func (Imageboard8chanmoe) GetThumbnailURL

func (im Imageboard8chanmoe) GetThumbnailURL(boardAcronym string, tim string, ext string) string

func (*Imageboard8chanmoe) Initialize

func (im *Imageboard8chanmoe) Initialize()

func (*Imageboard8chanmoe) RequestBoards

func (im *Imageboard8chanmoe) RequestBoards() ([]imageboard.Board, error)

func (Imageboard8chanmoe) RequestCatalog

func (im Imageboard8chanmoe) RequestCatalog(board imageboard.Board) (*u.OrderedMap[int, imageboard.Thread], error)

func (Imageboard8chanmoe) RequestNews

func (im Imageboard8chanmoe) RequestNews() ([]*News, error)

func (Imageboard8chanmoe) RequestPosts

func (im Imageboard8chanmoe) RequestPosts(b imageboard.Board, threadNumber int) (imageboard.Thread, error)

func (*Imageboard8chanmoe) SetBoards

func (im *Imageboard8chanmoe) SetBoards(boardMap *u.OrderedMap[string, imageboard.Board])

func (*Imageboard8chanmoe) SetMyBoards

func (im *Imageboard8chanmoe) SetMyBoards(boardMap *u.OrderedMap[string, imageboard.Board])

type News

type News struct {
	Title string
	Text  string
}

func ParseNews

func ParseNews(body []byte) ([]*News, error)

type Post8chanmoe

type Post8chanmoe struct {
	OP     bool
	Number int
	Sticky bool
	Closed bool

	Time int64

	Name             string
	Subject          string
	RawComment       string
	SanitizedComment string

	Trip              string
	UserId            string
	Capcode           string
	Country           string
	TrollCountry      string
	CountryName       string
	IdBackgroundColor u.Color
	IdTextColor       u.Color

	TotalReplies int
	Images       int
	Bumplimit    bool
	Imagelimit   bool
	LastModified int32
	Embed        string

	NumPosts  int
	QuotedBy  []int
	RepliedTo []int
	Files     []imageboard.File
}

func NewPost8chanmoe

func NewPost8chanmoe(post *Post8chanmoeResponse, threadNumber int, op bool) *Post8chanmoe

func (Post8chanmoe) GetEmbed

func (p Post8chanmoe) GetEmbed() string

func (Post8chanmoe) GetFiles

func (p Post8chanmoe) GetFiles() []imageboard.File

func (Post8chanmoe) GetIdBackgroundColor

func (p Post8chanmoe) GetIdBackgroundColor() u.Color

func (Post8chanmoe) GetIdTextColor

func (p Post8chanmoe) GetIdTextColor() u.Color

func (Post8chanmoe) GetName

func (p Post8chanmoe) GetName() string

func (Post8chanmoe) GetNumPosts

func (p Post8chanmoe) GetNumPosts() int

func (Post8chanmoe) GetNumReplies

func (p Post8chanmoe) GetNumReplies() int

func (Post8chanmoe) GetNumber

func (p Post8chanmoe) GetNumber() int

func (Post8chanmoe) GetQuotedBy

func (p Post8chanmoe) GetQuotedBy() []int

func (Post8chanmoe) GetRawComment

func (p Post8chanmoe) GetRawComment() string

func (Post8chanmoe) GetRepliedTo

func (p Post8chanmoe) GetRepliedTo() []int

func (Post8chanmoe) GetSubject

func (p Post8chanmoe) GetSubject() string

func (Post8chanmoe) GetTime

func (p Post8chanmoe) GetTime() int64

func (Post8chanmoe) GetTrip

func (p Post8chanmoe) GetTrip() string

func (Post8chanmoe) GetUserId

func (p Post8chanmoe) GetUserId() string

func (Post8chanmoe) HasFiles

func (p Post8chanmoe) HasFiles() bool

func (Post8chanmoe) IsEmbed

func (p Post8chanmoe) IsEmbed() bool

func (Post8chanmoe) IsOP

func (p Post8chanmoe) IsOP() bool

func (*Post8chanmoe) SetIdBackgroundColor

func (p *Post8chanmoe) SetIdBackgroundColor(color u.Color)

func (*Post8chanmoe) SetIdTextColor

func (p *Post8chanmoe) SetIdTextColor(color u.Color)

func (*Post8chanmoe) SetNumPosts

func (p *Post8chanmoe) SetNumPosts(numPosts int)

func (*Post8chanmoe) SetQuotedBy

func (p *Post8chanmoe) SetQuotedBy(posts []int)

func (*Post8chanmoe) SetRawComment

func (p *Post8chanmoe) SetRawComment(comment string)

func (*Post8chanmoe) SetRepliedTo

func (p *Post8chanmoe) SetRepliedTo(posts []int)

type Post8chanmoeResponse

type Post8chanmoeResponse struct {
	Number        int    `json:"no"`            //always, 	The numeric post ID 	any positive integer
	Subject       string `json:"sub"`           //OP only, if subject was included 	OP Subject text 	any string
	Comment       string `json:"com"`           //if comment was included, 	Comment (HTML escaped) 	any HTML escaped string
	Name          string `json:"name"`          //always, 	Name user posted with. Defaults to Anonymous 	any string
	Resto         int32  `json:"resto"`         //always, 	For replies: this is the ID of the thread being replied to. For OP: this value is zero 	0 or Any positive integer
	Sticky        int    `json:"sticky"`        //OP only, if thread is currently stickied 	If the thread is being pinned to the top of the page 	1 or not set
	Closed        int    `json:"closed"`        //OP only, if thread is currently closed 	If the thread is closed to replies 	1 or not set
	Time          int64  `json:"time"`          //always, 	UNIX timestamp the post was created 	UNIX timestamp
	Trip          string `json:"trip"`          //if post has tripcode, 	The user's tripcode, in format: !tripcode or !!securetripcode 	any string
	Id            string `json:"id"`            //if post has ID, 	The poster's ID 	any 8 characters
	Capcode       string `json:"capcode"`       //if post has capcode, 	The capcode identifier for a post 	Not set, mod, admin, admin_highlight, manager, developer, founder
	Country       string `json:"country"`       //if country flags, are enabled 	Poster's ISO 3166-1 alpha-2 country code 	2 character string or XX if unknown
	CountryName   string `json:"country_name"`  //if country flags, are enabled 	Poster's country name 	Name of any country
	Tim           string `json:"tim"`           //always, if post has attachment 	Unix timestamp + microtime that an image was uploaded 	integer
	Filename      string `json:"filename"`      //always, if post has attachment 	Filename as it appeared on the poster's device 	any string
	Ext           string `json:"ext"`           //always, if post has attachment 	Filetype 	.jpg, .png, .gif, .pdf, .swf, .webm
	Fsize         int64  `json:"fsize"`         //always, if post has attachment 	Size of uploaded file in bytes 	any integer
	Md5           string `json:"md5"`           //always, if post has attachment 	24 character, packed base64 MD5 hash of file
	W             int    `json:"w"`             //always, if post has attachment 	Image width dimension 	any integer
	H             int    `json:"h"`             //always, if post has attachment 	Image height dimension 	any integer
	TnW           int32  `json:"tn_w"`          //always, if post has attachment 	Thumbnail image width dimension 	any integer
	TnH           int32  `json:"tn_h"`          //always, if post has attachment 	Thumbnail image height dimension 	any integer
	Filedeleted   int    `json:"filedeleted"`   //if post had attachment and attachment is deleted, 	If the file was deleted from the post 	1 or not set
	Spoiler       int    `json:"spoiler"`       //if post has attachment and attachment is spoilered, 	If the image was spoilered or not 	1 or not set
	TotalReplies  int    `json:"replies"`       //OP only, 	Number of replies minus the number of previewed replies 	any integer
	Images        int    `json:"images"`        //OP only, 	Number of image replies minus the number of previewed image replies 	any integer
	Bumplimit     int    `json:"bumplimit"`     //OP only, only if bump limit has been reached 	If a thread has reached bumplimit, it will no longer bump 	1 or not set
	Imagelimit    int    `json:"imagelimit"`    //OP only, only if image limit has been reached 	If an image has reached image limit, no more image replies can be made 	1 or not set
	LastModified  int32  `json:"last_modified"` //OP only, 	Total number of replies to a thread 	any integer
	Embed         string `json:"embed"`
	OmittedPosts  int32  `json:"omitted_posts"`
	OmittedImages int32  `json:"omitted_images"`

	ExtraFiles []ExtraFile `json:"extra_files"`
}

type Thread8chanmoe

type Thread8chanmoe struct {
	Number int
	Sticky bool
	Closed bool

	Time int64

	Name             string
	Subject          string
	RawComment       string
	SanitizedComment string

	Trip              string
	UserId            string
	Capcode           string
	Country           string
	TrollCountry      string
	CountryName       string
	IdBackgroundColor u.Color
	IdTextColor       u.Color

	TotalReplies int
	TotalImages  int
	Bumplimit    bool
	Imagelimit   bool
	LastModified int32
	Embed        string

	Posts *u.OrderedMap[int, imageboard.Post]
	Files []imageboard.File
}

func NewThread8chanmoe

func NewThread8chanmoe(thread *Thread8chanmoeResponse) *Thread8chanmoe

func NewThread8chanmoeFromPost

func NewThread8chanmoeFromPost(post *Post8chanmoeResponse) *Thread8chanmoe

func (Thread8chanmoe) GetEmbed

func (t Thread8chanmoe) GetEmbed() string

func (Thread8chanmoe) GetFiles

func (t Thread8chanmoe) GetFiles() []imageboard.File

func (Thread8chanmoe) GetNumber

func (t Thread8chanmoe) GetNumber() int

func (Thread8chanmoe) GetPosts

func (t Thread8chanmoe) GetPosts() *u.OrderedMap[int, imageboard.Post]

func (Thread8chanmoe) GetSanitizedComment

func (t Thread8chanmoe) GetSanitizedComment() string

func (Thread8chanmoe) GetSubject

func (t Thread8chanmoe) GetSubject() string

func (Thread8chanmoe) GetTotalImages

func (t Thread8chanmoe) GetTotalImages() int

func (Thread8chanmoe) GetTotalReplies

func (t Thread8chanmoe) GetTotalReplies() int

func (Thread8chanmoe) GetTrip

func (t Thread8chanmoe) GetTrip() string

func (Thread8chanmoe) GetUserId

func (t Thread8chanmoe) GetUserId() string

func (Thread8chanmoe) HasFiles

func (t Thread8chanmoe) HasFiles() bool

func (Thread8chanmoe) IsClosed

func (t Thread8chanmoe) IsClosed() bool

func (Thread8chanmoe) IsEmbed

func (t Thread8chanmoe) IsEmbed() bool

func (Thread8chanmoe) IsSticky

func (t Thread8chanmoe) IsSticky() bool

func (*Thread8chanmoe) SetIdBackgroundColor

func (t *Thread8chanmoe) SetIdBackgroundColor(color u.Color)

func (*Thread8chanmoe) SetIdTextColor

func (t *Thread8chanmoe) SetIdTextColor(color u.Color)

type Thread8chanmoeResponse

type Thread8chanmoeResponse struct {
	Number        int         `json:"no"`            //always, 	The numeric post ID 	any positive integer
	Subject       string      `json:"sub"`           //OP only, if subject was included 	OP Subject text 	any string
	Comment       string      `json:"com"`           //if comment was included, 	Comment (HTML escaped) 	any HTML escaped string
	Name          string      `json:"name"`          //always, 	Name user posted with. Defaults to Anonymous 	any string
	Resto         int32       `json:"resto"`         //always, 	For replies: this is the ID of the thread being replied to. For OP: this value is zero 	0 or Any positive integer
	Sticky        int         `json:"sticky"`        //OP only, if thread is currently stickied 	If the thread is being pinned to the top of the page 	1 or not set
	Closed        int         `json:"closed"`        //OP only, if thread is currently closed 	If the thread is closed to replies 	1 or not set
	Time          int64       `json:"time"`          //always, 	UNIX timestamp the post was created 	UNIX timestamp
	Trip          string      `json:"trip"`          //if post has tripcode, 	The user's tripcode, in format: !tripcode or !!securetripcode 	any string
	Id            string      `json:"id"`            //if post has ID, 	The poster's ID 	any 8 characters
	Capcode       string      `json:"capcode"`       //if post has capcode, 	The capcode identifier for a post 	Not set, mod, admin, admin_highlight, manager, developer, founder
	Country       string      `json:"country"`       //if country flags, are enabled 	Poster's ISO 3166-1 alpha-2 country code 	2 character string or XX if unknown
	CountryName   string      `json:"country_name"`  //if country flags, are enabled 	Poster's country name 	Name of any country
	Tim           string      `json:"tim"`           //always, if post has attachment 	Unix timestamp + microtime that an image was uploaded 	integer
	Filename      string      `json:"filename"`      //always, if post has attachment 	Filename as it appeared on the poster's device 	any string
	Ext           string      `json:"ext"`           //always, if post has attachment 	Filetype 	.jpg, .png, .gif, .pdf, .swf, .webm
	Fsize         int64       `json:"fsize"`         //always, if post has attachment 	Size of uploaded file in bytes 	any integer
	Md5           string      `json:"md5"`           //always, if post has attachment 	24 character, packed base64 MD5 hash of file
	W             int         `json:"w"`             //always, if post has attachment 	Image width dimension 	any integer
	H             int         `json:"h"`             //always, if post has attachment 	Image height dimension 	any integer
	TnW           int32       `json:"tn_w"`          //always, if post has attachment 	Thumbnail image width dimension 	any integer
	TnH           int32       `json:"tn_h"`          //always, if post has attachment 	Thumbnail image height dimension 	any integer
	Filedeleted   int         `json:"filedeleted"`   //if post had attachment and attachment is deleted, 	If the file was deleted from the post 	1 or not set
	Spoiler       int         `json:"spoiler"`       //if post has attachment and attachment is spoilered, 	If the image was spoilered or not 	1 or not set
	TotalReplies  int         `json:"replies"`       //OP only, 	Number of replies minus the number of previewed replies 	any integer
	Images        int         `json:"images"`        //OP only, 	Number of image replies minus the number of previewed image replies 	any integer
	Bumplimit     int         `json:"bumplimit"`     //OP only, only if bump limit has been reached 	If a thread has reached bumplimit, it will no longer bump 	1 or not set
	Imagelimit    int         `json:"imagelimit"`    //OP only, only if image limit has been reached 	If an image has reached image limit, no more image replies can be made 	1 or not set
	LastModified  int32       `json:"last_modified"` //OP only, 	Total number of replies to a thread 	any integer
	Embed         string      `json:"embed"`
	OmittedPosts  int32       `json:"omitted_posts"`
	OmittedImages int32       `json:"omitted_images"`
	ExtraFiles    []ExtraFile `json:"extra_files"`
}

type ThreadPosts8chanmoeResponse

type ThreadPosts8chanmoeResponse struct {
	Posts []*Post8chanmoeResponse `json:"posts"`
}

Jump to

Keyboard shortcuts

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