forum

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Forum

type Forum struct {
	ID           int      `xml:"id,attr"`
	Title        string   `xml:"title,attr"`
	NumThreads   int      `xml:"numthreads,attr"`
	NumPosts     int      `xml:"numposts,attr"`
	LastPostDate string   `xml:"lastpostdate,attr"`
	NoPosting    int      `xml:"noposting,attr"`
	Threads      []Thread `xml:"threads>thread"`
}

func Query

func Query(id int) (*Forum, error)

Query retrieves detailed information about a specific forum from the BoardGameGeek API.

The function accepts a forum ID and returns a structured representation of the forum details including the forum title, threads within the forum, and metadata such as post counts and dates.

Parameters:

  • id: An integer ID corresponding to a forum in the BGG database

Returns:

  • *Forum: A pointer to a Forum struct containing the forum information and threads
  • error: An error if the API request fails or if the response cannot be parsed

Example:

forum, err := forum.Query(1234)
if err != nil {
    log.Fatalf("Failed to get forum: %v", err)
}
fmt.Printf("Forum title: %s (contains %d threads)\n", forum.Title, forum.NumThreads)

type Thread

type Thread struct {
	ID           int    `xml:"id,attr"`
	Subject      string `xml:"subject,attr"`
	Author       string `xml:"author,attr"`
	NumArticles  int    `xml:"numarticles,attr"`
	PostDate     string `xml:"postdate,attr"`
	LastPostDate string `xml:"lastpostdate,attr"`
}

Jump to

Keyboard shortcuts

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