models

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package models defines the data structures that map to the API's responses.

Package models defines the data structures that map to the API's responses.

Package models defines the data structures that map to the API's responses.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	XMLName   xml.Name               `xml:"comment"`
	CreatedAt unmarshaling.CreatedAt `xml:"created_at,attr"`
	PostID    string                 `xml:"post_id,attr"`
	Body      string                 `xml:"body,attr"`
	Creator   string                 `xml:"creator,attr"`
	ID        string                 `xml:"id,attr"`
	CreatorID string                 `xml:"creator_id,attr"`
}

Comment represents a single comment object with its associated metadata. The struct tags map the XML attributes from the API response to the fields.

type Comments

type Comments struct {
	XMLName xml.Name  `xml:"comments"`
	Type    string    `xml:"type,attr"`
	Comment []Comment `xml:"comment"`
}

Comments represents the top-level structure for a comments API response, typically returned in XML format.

type Post

type Post struct {
	PreviewURL   string            `json:"preview_url"`
	SampleURL    string            `json:"sample_url"`
	FileURL      string            `json:"file_url"`
	Directory    int               `json:"directory"`
	Hash         string            `json:"hash"`
	Width        int               `json:"width"`
	Height       int               `json:"height"`
	ID           int               `json:"id"`
	Image        string            `json:"image"`
	Change       int               `json:"change"`
	Owner        string            `json:"owner"`
	ParentID     int               `json:"parent_id"`
	Rating       string            `json:"rating"`
	Sample       bool              `json:"sample"`
	SampleHeight int               `json:"sample_height"`
	SampleWidth  int               `json:"sample_width"`
	Score        int               `json:"score"`
	Tags         unmarshaling.Tags `json:"tags"` // Custom type to handle space-separated string
	Source       string            `json:"source"`
	Status       string            `json:"status"`
	HasNotes     bool              `json:"has_notes"`
	CommentCount int               `json:"comment_count"`
}

Post represents a single post object and its associated metadata. The struct tags map the JSON keys from the API response to the fields.

type Posts

type Posts []Post

Posts is a slice of Post objects, representing a collection of posts returned by the API, typically in JSON format.

type Tag

type Tag struct {
	XMLName   xml.Name `xml:"tag"`
	Type      int      `xml:"type,attr"`
	Count     int      `xml:"count,attr"`
	Name      string   `xml:"name,attr"`
	Ambiguous bool     `xml:"ambiguous,attr"`
	ID        int      `xml:"id,attr"`
}

Tag represents a single tag object with its associated metadata such as its type, count, and name. The struct tags map the XML attributes from the API response to the fields.

type Tags

type Tags struct {
	XMLName xml.Name `xml:"tags"`
	Type    string   `xml:"type,attr"`
	Tag     []Tag    `xml:"tag"`
}

Tags represents the top-level structure for a tags API response, typically returned in XML format.

Jump to

Keyboard shortcuts

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