clevelandart

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 6 Imported by: 1

README

clevelandart

This package contains types and functions to make it easy to work with the Open Access API at the Cleveland Museum of Art.

Example

There is an example program in cmd/main.go which you can use to get started like this:

package main

import (
	"fmt"
	"log"

	"github.com/go-micah/clevelandart"
)

func main() {
	artwork, err := clevelandart.GetArtwork("1952.233")
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(artwork.Description)
}
> This rare, dramatic object served as the back support of a litter carried by human porters, a mode of transport reserved for honored members of many societies without draft animals or wheeled vehicles. The simple, bold figures—perhaps a Chimú lord and four officials—all wear wide collars, tunics, and crescent headdresses that are either brightly painted or covered with golden but now-corroded sheet metal. The holes at the bottom probably served as lashing points for a beam that supported the litter's seat.

Documentation

Overview

Package clevelandart provides types and functions for working with the Cleveland Museum of Art's Open Access API.

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:"id"`
	AccessionNumber          string   `json:"accession_number"`
	ShareLicenseStatus       string   `json:"share_license_status,omitempty"`
	Tombstone                string   `json:"tombstone,omitempty"`
	CurrentLocation          string   `json:"current_location,omitempty"`
	Title                    string   `json:"title,omitempty"`
	TitleInOriginalLanguage  string   `json:"title_in_original_language,omitempty"`
	Series                   string   `json:"series,omitempty"`
	SeriesInOriginalLanguage string   `json:"series_in_original_language,omitempty"`
	CreationDate             string   `json:"creation_date,omitempty"`
	CreationDateEarliest     int      `json:"creation_date_earliest,omitempty"`
	CreationDateLatest       int      `json:"creation_date_latest,omitempty"`
	ArtistsTags              []string `json:"artists_tags,omitempty"`
	Creators                 []struct {
		Description string `json:"description,omitempty"`
		Role        string `json:"role,omitempty"`
		Biography   string `json:"biography,omitempty"`
	} `json:"creators,omitempty"`
	Culture      []string `json:"culture,omitempty"`
	Technique    string   `json:"technique,omitempty"`
	Department   string   `json:"department,omitempty"`
	Collection   string   `json:"collection,omitempty"`
	Type         string   `json:"type,omitempty"`
	Measurements string   `json:"measurements,omitempty"`
	Description  string   `json:"description,omitempty"`
	Url          string   `json:"url,omitempty"`
	Images       struct {
		Web struct {
			Url      string `json:"url,omitempty"`
			Filename string `json:"filename,omitempty"`
			Filesize string `json:"filesize,omitempty"`
			Width    string `json:"width,omitempty"`
			Height   string `json:"height,omitempty"`
		} `json:"web,omitempty"`
		Print struct {
			Url      string `json:"url,omitempty"`
			Filename string `json:"filename,omitempty"`
			Filesize string `json:"filesize,omitempty"`
			Width    string `json:"width,omitempty"`
			Height   string `json:"height,omitempty"`
		} `json:"print,omitempty"`
		Full struct {
			Url      string `json:"url,omitempty"`
			Filename string `json:"filename,omitempty"`
			Filesize string `json:"filesize,omitempty"`
			Width    string `json:"width,omitempty"`
			Height   string `json:"height,omitempty"`
		} `json:"full,omitempty"`
	} `json:"images,omitempty"`
	JSON string
}

An Artwork represents a single object in the Cleveland Museum of Art's Open Access API.

func GetArtwork added in v0.0.2

func GetArtwork(id string) (*Artwork, error)

GetArtwork retrieves an object from the Cleveland Museum of Art's Open Access API

func GetRandomArtwork

func GetRandomArtwork(hasImage bool) (*Artwork, error)

GetRandomArtwork returns a random artwork from the Cleveland Museum of Art's Open Access API

type ArtworkInputParams added in v0.0.3

type ArtworkInputParams struct {
	Indent   int    `url:"indent"`
	Query    string `url:"q"`
	Limit    int    `url:"limit"`
	Skip     int    `url:"skip"`
	HasImage int    `url:"has_image"`
}

An ArtworkInputParams is a struct representing the paramesters available to query artworks

type SearchResults added in v0.0.3

type SearchResults struct {
	Info struct {
		Total      int `json:"total"`
		Parameters struct {
			Skip   int    `json:"skip"`
			Limit  int    `json:"limit"`
			Indent int    `json:"indent"`
			Query  string `json:"q"`
			Select string `json:"select"`
			Search string `json:"search"`
		} `json:"parameters"`
	} `json:"info"`
	Artworks []Artwork `json:"data"`
}

A SearchResults represents the results of a search with query statistics

func SearchArtworks

func SearchArtworks(params ArtworkInputParams) (*SearchResults, error)

SearchArtworks sends a search query to the API and retrieve an array of Artwork objects along with query statistics

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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