diff --git a/models/models.go b/models/models.go new file mode 100644 index 0000000000000000000000000000000000000000..ea40e159a23c620b2a9958bb486e1a7041d37a02 --- /dev/null +++ b/models/models.go @@ -0,0 +1,33 @@ +package models + +// ... Other models + +// GutenbergBook represents the structure of a book from the Gutenberg API. +type GutenbergBook struct { + ID int `json:"id"` + Title string `json:"title"` + Authors []Person `json:"authors"` + Translators []Person `json:"translators"` + Subjects []string `json:"subjects"` + Bookshelves []string `json:"bookshelves"` + Languages []string `json:"languages"` + Copyright bool `json:"copyright"` + MediaType string `json:"media_type"` + Formats map[string]string `json:"formats"` + DownloadCount int `json:"download_count"` +} + +// GutenbergResponse represents the paginated response from Gutenberg API. +type GutenbergResponse struct { + Count int `json:"count"` + Next string `json:"next"` + Previous string `json:"previous"` + Results []GutenbergBook `json:"results"` +} + +// Person represents an author or translator. +type Person struct { + BirthYear *int `json:"birth_year"` + DeathYear *int `json:"death_year"` + Name string `json:"name"` +}