cmart

package module
v0.0.0-...-d9750ef Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: MIT Imports: 8 Imported by: 0

README

cmart

API client for Cleveland Museum of Art written in Go.

CLI

Usage

cmart.exe {artwork,creator,exhibit} {get,list}

Example

// cmart.exe artwork get -id 111811
{
  "Id": 111811,
  "Accession_number": "1930.331",
  "Collection": "Indian Art",
  "Creation_date": "1000s",
  "Creation_date_earliest": 1000,
  "Creation_date_latest": 1099,
  "Creditline": "Purchase from the J. H. Wade Fund",
  "Current_location": "244 Indian and Southeast Asian",
  "Fun_fact": "The trampled figure holds a serpent in his left hand and with his right points up to Shiva."
  // ...snip...
}
Package
// Create API client
CMA := cmart.NewCmaApi()

// Get an Artwork, Creator, or Exhibit by ID
artwork := CMA.GetArtworkById(111811)
fmt.Println(artwork.Title)

// List Artworks, Creators, and Exhibits; optionally apply filters
artworks, meta := CMA.ListArtworks(cmart.ArtworksFilter{
    Created_after:            2019,
    African_american_artists: true,
})
if len(artworks) > 0 {
    fmt.Println(artworks[0].Title)
}

Documentation

Overview

Provides a client for the Cleveland Museum of Art Open Access API. https://openaccess-api.clevelandart.org/

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artwork

type Artwork struct {
	Id                          int          `json:",omitempty"`
	Accession_number            string       `json:",omitempty"`
	Catalogue_raisonne          string       `json:",omitempty"`
	Citations                   []Citation   `json:",omitempty"`
	Collection                  string       `json:",omitempty"`
	Copyright                   string       `json:",omitempty"`
	Creation_date               string       `json:",omitempty"`
	Creation_date_earliest      int          `json:",omitempty"`
	Creation_date_latest        int          `json:",omitempty"`
	Creators                    []Creator    `json:",omitempty"`
	Creditline                  string       `json:",omitempty"`
	Culture                     []string     `json:",omitempty"`
	Current_location            string       `json:",omitempty"`
	Department                  string       `json:",omitempty"`
	Digital_description         string       `json:",omitempty"`
	Edition_of_the_work         string       `json:",omitempty"`
	Find_spot                   string       `json:",omitempty"`
	Former_accession_numbers    []string     `json:",omitempty"`
	Fun_fact                    string       `json:",omitempty"`
	Measurements                string       `json:",omitempty"`
	Provenance                  []Provenance `json:",omitempty"`
	Series                      string       `json:",omitempty"`
	Series_in_original_language string       `json:",omitempty"`
	Share_license_status        string       `json:",omitempty"`
	Sketchfab_id                string       `json:",omitempty"`
	Sketchfab_url               string       `json:",omitempty"`
	State_of_the_work           string       `json:",omitempty"`
	Technique                   string       `json:",omitempty"`
	Title                       string       `json:",omitempty"`
	Title_in_original_language  string       `json:",omitempty"`
	Tombstone                   string       `json:",omitempty"`
	Type                        string       `json:",omitempty"`
	Updated_at                  string       `json:",omitempty"`
	Url                         string       `json:",omitempty"`
	Wall_description            string       `json:",omitempty"`
	Dimensions                  struct {
		Base    Dimension `json:",omitempty"`
		Overall Dimension `json:",omitempty"`
	}
	Exhibitions struct {
		Current []Exhibition `json:",omitempty"`
		Legacy  []string     `json:",omitempty"`
	}
	External_resources struct {
		Internet_archive []string `json:",omitempty"`
		Wikidata         []string `json:",omitempty"`
	}
	Images struct {
		Full  Image `json:",omitempty"`
		Print Image `json:",omitempty"`
		Web   Image `json:",omitempty"`
	}
	Inscriptions []struct {
		Inscription             string `json:",omitempty"`
		Inscription_translation string `json:",omitempty"`
		Inscription_remark      string `json:",omitempty"`
	}
	Support_materials []struct {
		Description string   `json:",omitempty"`
		Watermarks  []string `json:",omitempty"`
	}
}

Top-level API response object

type ArtworksFilter

type ArtworksFilter struct {
	African_american_artists bool   // Filters by works created by African American artists.
	Artists                  string // Filter by name of artist.
	Catalogue_raisonne       string // Filter by catalogue raisonne.
	Cc0                      bool   // Filters by works that have share license cc0.
	Cia_alumni_artists       bool   // Filters by works created by Cleveland Institute of Art alumni.
	Citations                string // Keyword search against the citations field.
	Copyrighted              bool   // Filters by works that have some sort of copyright.
	Created_after            int    // Returns artworks created after the year specified. Negative years are BCE.
	Created_after_age        int    // Filters by artworks that were created by artists older than the provided value in years at time of creation.
	Created_before           int    // Returns artworks created before the year specified. Negative years are BCE.
	Created_before_age       int    // Filters by artworks that were created by artists younger than the provided value in years at time of creation.
	Credit                   string // Filter by credit line.
	Currently_on_loan        bool   // Filters by works that are currently on loan.
	Currently_on_view        bool   // Filters by works that are currently on view at CMA.
	Department               string // Filter by department. List of valid departments in Appendix B.
	Exhibition_history       string // Filter by exhibition history of artwork.
	Female_artists           bool   // Filters by artworks created by female artists.
	Has_image                int    // 0 or 1. Filter to return only artworks that have a web image asset. (synonymous with the deprecated field web_image)
	Limit                    int    // Limit for number of results. If no limit provided, API will return the maximum (1000) number of records.
	May_show_artists         bool   // Filters by works exhibited in Cleveland Museum of Art May Shows
	Medium                   string // Filter by artwork medium.
	Nazi_era_provenance      bool   // Filters by nazi-era provenance.
	Provenance               string // Filter by provenance of artwork
	Q                        string // Any keyword or phrase that searches against title, creator, artwork description, and several other meaningful fields related to the artwork.
	Recently_acquired        bool   // Filters by artworks acquired by the museum in the last three years.
	Skip                     int    // Offset index for results.
	Title                    string // Filter by title of artwork.
	Type                     string // Filter by artwork types. List of valid types in Appendix C.

}

type Citation

type Citation struct {
	Citation    string `json:",omitempty"`
	Page_number string `json:",omitempty"`
	Url         string `json:",omitempty"`
}

Nested API response object

type Creator

type Creator struct {
	Id          int       `json:",omitempty"`
	Artworks    []Artwork `json:",omitempty"`
	Biography   string    `json:",omitempty"`
	Birth_year  string    `json:",omitempty"`
	Created_at  string    `json:",omitempty"`
	Death_year  string    `json:",omitempty"`
	Description string    `json:",omitempty"`
	Name        string    `json:",omitempty"`
	Nationality string    `json:",omitempty"`
	Role        string    `json:",omitempty"`
	Updated_at  string    `json:",omitempty"`
}

Top-level API response object

type CreatorsFilter

type CreatorsFilter struct {
	Biography         string // Filter by a keyword in creator biography.
	Birth_year        int    // Filter by exact match on creator's birth year.
	Birth_year_after  int    // Filter by creators born after a certain year.
	Birth_year_before int    // Filter by creators born before a certain year.
	Death_year        int    // Filter by exact match on creator's death year.
	Death_year_after  int    // Filter by creators who have died after a certain year.
	Death_year_before int    // Filter by creators who have died before a certain year.
	Limit             int    // Limit for number of results. If no limit provided, API will return the maximum (100) number of records.
	Name              string // Filter by matches or partial matches to the name of any creator.
	Nationality       string // Filter by a keyword in creator nationality, e.g. 'French'.
	Skip              int    // Offset index for results.
}

type Dimension

type Dimension struct {
	Depth  float64 `json:",omitempty"`
	Height float64 `json:",omitempty"`
	Width  float64 `json:",omitempty"`
}

Nested API response object

type Exhibition

type Exhibition struct {
	Id           int       `json:",omitempty"`
	Artworks     []Artwork `json:",omitempty"`
	Closing_date string    `json:",omitempty"`
	Created_at   string    `json:",omitempty"`
	Description  string    `json:",omitempty"`
	Opening_date string    `json:",omitempty"`
	Organizer    string    `json:",omitempty"`
	Title        string    `json:",omitempty"`
	Updated_at   string    `json:",omitempty"`
	Venues       []Venue   `json:",omitempty"`
}

Top-level API response object

type ExhibitionsFilter

type ExhibitionsFilter struct {
	Closed_after  string // Filter exhibitions closed after a certain data. (date in YYYY-MM-DD format, e.g. 1974-01-01)
	Closed_before string // Filter exhibitions closed before a certain data. (date in YYYY-MM-DD format, e.g. 1974-01-01)
	Limit         int    // Limit for number of results. If no limit provided, API will return the maximum (100) number of records.
	Opened_after  string // Filter exhibitions opened after a certain data. (date in YYYY-MM-DD format, e.g. 1974-01-01)
	Opened_before string // Filter exhibitions opened before a certain data. (date in YYYY-MM-DD format, e.g. 1974-01-01)
	Organizer     string // Filter by exhibition organizer.
	Skip          int    // Offset index for results.
	Title         string // Filter by matches or partial matches to the title of an exhibition.
	Venue         string // Filter by exhibitioned opened in certain venues.
}

type Image

type Image struct {
	Filename string `json:",omitempty"`
	Filesize string `json:",omitempty"`
	Height   string `json:",omitempty"`
	Url      string `json:",omitempty"`
	Width    string `json:",omitempty"`
}

Nested API response object

type Provenance

type Provenance struct {
	Citations   []string `json:",omitempty"`
	Date        string   `json:",omitempty"`
	Description string   `json:",omitempty"`
	Footnotes   []string `json:",omitempty"`
}

Nested API response object

type ResponseInfo

type ResponseInfo struct {
	Total int
}

API Response Metadata

type RestApi

type RestApi struct {
	Baseurl string
	Get     func(string, interface{})
}

Generic API client

func NewCmaApi

func NewCmaApi() RestApi

Create new CMA API client

func (RestApi) GetArtworkByAccessionNbr

func (api RestApi) GetArtworkByAccessionNbr(accession_nbr float64) Artwork

func (RestApi) GetArtworkById

func (api RestApi) GetArtworkById(artwork_id int) Artwork

func (RestApi) GetCreatorById

func (api RestApi) GetCreatorById(creator_id int) Creator

func (RestApi) GetExhibitionById

func (api RestApi) GetExhibitionById(exhibit_id int) Exhibition

func (RestApi) ListArtworks

func (api RestApi) ListArtworks(filter ArtworksFilter) ([]Artwork, ResponseInfo)

List artworks with filters

func (RestApi) ListCreators

func (api RestApi) ListCreators(filter CreatorsFilter) ([]Creator, ResponseInfo)

func (RestApi) ListExhibitions

func (api RestApi) ListExhibitions(filter ExhibitionsFilter) ([]Exhibition, ResponseInfo)

type Venue

type Venue struct {
	Venue_id   int    `json:",omitempty"`
	Name       string `json:",omitempty"`
	Start_date string `json:",omitempty"`
	End_date   string `json:",omitempty"`
}

Nested API response object

Directories

Path Synopsis
cmd
cmart command

Jump to

Keyboard shortcuts

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