Skip to content
Snippets Groups Projects
Select Git revision
  • 4421d75ab544973343bd36714ef78ca87f73325f
  • main default protected
2 results

models.go

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    models.go 1.18 KiB
    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"`
    }