openbd

package module
v0.0.0-...-69760ce Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2018 License: MIT Imports: 5 Imported by: 3

README

openbd

Travis branch codecov Go Report Card codebeat badge GoDoc GitHub license

About

Install

$ go get -u github.com/osamingo/openbd

Usage

package main

import (
    "fmt"

    "github.com/osamingo/openbd"
)

func main() {

    cli, err := openbd.NewClientV1("https://api.openbd.jp", nil)
    if err != nil {
        panic(err)
    }
    
    isbn := "9784780802047"
    m, err := cli.Get(isbn)
    if err != nil {
        panic(err)
    }

    fmt.Println(m[isbn].Title())
}

License

Released under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Audience

type Audience struct {
	AudienceCode      string `json:"AudienceCode,omitempty"`
	AudienceCodeValue string `json:"AudienceCodeValue,omitempty"`
}

type Author

type Author struct {
	Dokujikubun string  `json:"dokujikubun"`
	Listseq     float64 `json:"listseq"`
}

type BookInformer

type BookInformer interface {
	ISBN() string
	Title() string
	Author() string
	Cover() string
	PublishedAt() string
	Publisher() string
	Series() string
	Volume() string
	ShortDescription() string
	Description() string
	JBPADescription() string
	TableOfContents() string
}

type Client

type Client struct {
	URL        *url.URL
	HTTPClient *http.Client
}

Client for openbd.

func (*Client) Get

func (c *Client) Get(isbn ...string) (map[string]BookInformer, error)

Get book information by isbn.

type CollateralDetail

type CollateralDetail struct {
	SupportingResource []SupportingResource `json:"SupportingResource,omitempty"`
	TextContent        []TextContent        `json:"TextContent,omitempty"`
}

type Collection

type Collection struct {
	CollectionSequence *CollectionSequence `json:"CollectionSequence,omitempty"`
	Collection         string              `json:"Collection,omitempty"`
	TitleDetail        struct {
		TitleElement []*TitleElement `json:"TitleElement,omitempty"`
		Title        string          `json:"Title,omitempty"`
	} `json:"TitleDetail,omitempty"`
}

type CollectionSequence

type CollectionSequence struct {
	CollectionSequenceNumber string `json:"CollectionSequenceNumber,omitempty"`
	CollectionSequence       string `json:"CollectionSequence,omitempty"`
}

type Contributor

type Contributor struct {
	BiographicalNote string      `json:"BiographicalNote,omitempty"`
	ContributorRole  []string    `json:"ContributorRole,omitempty"`
	PersonName       *PersonName `json:"PersonName,omitempty"`
	SequenceNumber   string      `json:"SequenceNumber,omitempty"`
}

type DescriptiveDetail

type DescriptiveDetail struct {
	Audience           []Audience    `json:"Audience,omitempty"`
	Collection         *Collection   `json:"Collection,omitempty"`
	Contributor        []Contributor `json:"Contributor,omitempty"`
	Extent             []Extent      `json:"Extent,omitempty"`
	Language           []Language    `json:"Language,omitempty"`
	Measure            []Measure     `json:"Measure,omitempty"`
	ProductComposition string        `json:"ProductComposition,omitempty"`
	ProductForm        string        `json:"ProductForm,omitempty"`
	ProductFormDetail  string        `json:"ProductFormDetail,omitempty"`
	ProductPart        []ProductPart `json:"ProductPart,omitempty"`
	Subject            []Subject     `json:"Subject,omitempty"`
	TitleDetail        *TitleDetail  `json:"TitleDetail,omitempty"`
}

type Extent

type Extent struct {
	Extent      string `json:"Extent,omitempty"`
	ExtentUnit  string `json:"ExtentUnit,omitempty"`
	ExtentValue string `json:"ExtentValue,omitempty"`
}

type Fetcher

type Fetcher interface {
	Get(isbn ...string) (map[string]BookInformer, error)
}

func NewClientV1

func NewClientV1(host string, cli *http.Client) (Fetcher, error)

NewClientV1 generates a client for openbd.

type Hanmoto

type Hanmoto struct {
	Author                 []Author  `json:"author,omitempty"`
	Bessoushiryou          string    `json:"bessoushiryou,omitempty"`
	Bikoutrc               string    `json:"bikoutrc,omitempty"`
	Datecreated            string    `json:"datecreated,omitempty"`
	Datejuuhanyotei        string    `json:"datejuuhanyotei,omitempty"`
	Datemodified           string    `json:"datemodified"`
	Dateshuppan            string    `json:"dateshuppan,omitempty"`
	Datezeppan             string    `json:"datezeppan,omitempty"`
	Dokushakakikomi        string    `json:"dokushakakikomi,omitempty"`
	Dokushakakikomipagesuu float64   `json:"dokushakakikomipagesuu,omitempty"`
	Furoku                 float64   `json:"furoku,omitempty"`
	Furokusonota           string    `json:"furokusonota,omitempty"`
	Gatsugougousuu         string    `json:"gatsugougousuu,omitempty"`
	Genrecodetrc           float64   `json:"genrecodetrc,omitempty"`
	Genrecodetrcjidou      float64   `json:"genrecodetrcjidou,omitempty"`
	Genshomei              string    `json:"genshomei,omitempty"`
	Han                    string    `json:"han,omitempty"`
	Hanmotokarahitokoto    string    `json:"hanmotokarahitokoto,omitempty"`
	Hastameshiyomi         bool      `json:"hastameshiyomi,omitempty"`
	Jushoujouhou           string    `json:"jushoujouhou,omitempty"`
	Jyuhan                 []Jyuhan  `json:"jyuhan,omitempty"`
	Kaisetsu105w           string    `json:"kaisetsu105w,omitempty"`
	Kankoukeitai           string    `json:"kankoukeitai,omitempty"`
	Kanrensho              string    `json:"kanrensho,omitempty"`
	Kanrenshoisbn          string    `json:"kanrenshoisbn,omitempty"`
	Kubunhanbai            bool      `json:"kubunhanbai,omitempty"`
	Lanove                 bool      `json:"lanove,omitempty"`
	Maegakinado            string    `json:"maegakinado,omitempty"`
	Ndccode                string    `json:"ndccode,omitempty"`
	Obinaiyou              string    `json:"obinaiyou,omitempty"`
	Reviews                []Reviews `json:"reviews,omitempty"`
	Rubynoumu              bool      `json:"rubynoumu,omitempty"`
	Ruishokyougousho       string    `json:"ruishokyougousho,omitempty"`
	Sonotatokkijikou       string    `json:"sonotatokkijikou,omitempty"`
	Toji                   string    `json:"toji,omitempty"`
	Tsuiki                 string    `json:"tsuiki,omitempty"`
	Zaiko                  float64   `json:"zaiko,omitempty"`
	Zasshicode             string    `json:"zasshicode,omitempty"`
}

type Imprint

type Imprint struct {
	ImprintIdentifier []ImprintIdentifier `json:"ImprintIdentifier,omitempty"`
	ImprintName       string              `json:"ImprintName,omitempty"`
}

type ImprintIdentifier

type ImprintIdentifier struct {
	IDValue   string `json:"IDValue,omitempty"`
	ImprintID string `json:"ImprintID,omitempty"`
}

type Jyuhan

type Jyuhan struct {
	Comment string  `json:"comment,omitempty"`
	Ctime   string  `json:"ctime,omitempty"`
	Date    string  `json:"date"`
	Suri    float64 `json:"suri,omitempty"`
}

type Language

type Language struct {
	CountryCode  string `json:"CountryCode,omitempty"`
	LanguageCode string `json:"LanguageCode,omitempty"`
	LanguageRole string `json:"LanguageRole,omitempty"`
}

type Measure

type Measure struct {
	Measure         string `json:"Measure,omitempty"`
	MeasureUnitCode string `json:"MeasureUnitCode,omitempty"`
	Measurement     string `json:"Measurement,omitempty"`
}

type Onix

type Onix struct {
	CollateralDetail  *CollateralDetail  `json:"CollateralDetail,omitempty"`
	DescriptiveDetail *DescriptiveDetail `json:"DescriptiveDetail,omitempty"`
	Notification      string             `json:"Notification,omitempty"`
	ProductIdentifier *ProductIdentifier `json:"ProductIdentifier,omitempty"`
	ProductSupply     *ProductSupply     `json:"ProductSupply,omitempty"`
	PublishingDetail  *PublishingDetail  `json:"PublishingDetail,omitempty"`
	RecordReference   string             `json:"RecordReference,omitempty"`
}

type PersonName

type PersonName struct {
	Collationkey string `json:"collationkey,omitempty"`
	Content      string `json:"content,omitempty"`
}

type Price

type Price struct {
	CurrencyCode string      `json:"CurrencyCode,omitempty"`
	PriceAmount  string      `json:"PriceAmount,omitempty"`
	PriceDate    []PriceDate `json:"PriceDate,omitempty"`
	Price        string      `json:"Price,omitempty"`
}

type PriceDate

type PriceDate struct {
	Date          string `json:"Date,omitempty"`
	Price         string `json:"Price,omitempty"`
	PriceDateRole string `json:"PriceDateRole,omitempty"`
}

type ProductIdentifier

type ProductIdentifier struct {
	IDValue   string `json:"IDValue,omitempty"`
	ProductID string `json:"ProductID,omitempty"`
}

type ProductPart

type ProductPart struct {
	NumberOfItemsOfThisForm string `json:"NumberOfItemsOfThisForm,omitempty"`
	ProductForm             string `json:"ProductForm,omitempty"`
	ProductFormDescription  string `json:"ProductFormDescription,omitempty"`
}

type ProductSupply

type ProductSupply struct {
	SupplyDetail *SupplyDetail `json:"SupplyDetail,omitempty"`
}

type Publisher

type Publisher struct {
	PublisherIdentifier []PublisherIdentifier `json:"PublisherIdentifier,omitempty"`
	PublisherName       string                `json:"PublisherName,omitempty"`
	PublishingRole      string                `json:"PublishingRole,omitempty"`
}

type PublisherIdentifier

type PublisherIdentifier struct {
	IDValue     string `json:"IDValue,omitempty"`
	PublisherID string `json:"PublisherID,omitempty"`
}

type PublishingDate

type PublishingDate struct {
	Date               string `json:"Date,omitempty"`
	PublishingDateRole string `json:"PublishingDateRole,omitempty"`
}

type PublishingDetail

type PublishingDetail struct {
	Imprint        *Imprint         `json:"Imprint,omitempty"`
	Publisher      *Publisher       `json:"Publisher,omitempty"`
	PublishingDate []PublishingDate `json:"PublishingDate,omitempty"`
}

type ResourceVersion

type ResourceVersion struct {
	ResourceForm           string        `json:"ResourceForm,omitempty"`
	ResourceLink           string        `json:"ResourceLink,omitempty"`
	ResourceVersionFeature []interface{} `json:"ResourceVersionFeature,omitempty"`
}

type ReturnsConditions

type ReturnsConditions struct {
	ReturnsCode string `json:"ReturnsCode,omitempty"`
}

type Reviews

type Reviews struct {
	Appearance string  `json:"appearance,omitempty"`
	Choyukan   string  `json:"choyukan,omitempty"`
	Han        string  `json:"han,omitempty"`
	KubunId    float64 `json:"kubun_id,omitempty"`
	Link       string  `json:"link,omitempty"`
	PostUser   string  `json:"post_user,omitempty"`
	Reviewer   string  `json:"reviewer,omitempty"`
	Source     string  `json:"source,omitempty"`
	SourceId   float64 `json:"source_id,omitempty"`
}

type Root

type Root struct {
	Hanmoto *Hanmoto `json:"hanmoto,omitempty"`
	Onix    *Onix    `json:"onix,omitempty"`
	Summary *Summary `json:"summary,omitempty"`
}

func (*Root) Author

func (r *Root) Author() string

func (*Root) Cover

func (r *Root) Cover() string

func (*Root) Description

func (r *Root) Description() string

func (*Root) ISBN

func (r *Root) ISBN() string

func (*Root) JBPADescription

func (r *Root) JBPADescription() string

func (*Root) PublishedAt

func (r *Root) PublishedAt() string

func (*Root) Publisher

func (r *Root) Publisher() string

func (*Root) Series

func (r *Root) Series() string

func (*Root) ShortDescription

func (r *Root) ShortDescription() string

func (*Root) TableOfContents

func (r *Root) TableOfContents() string

func (*Root) Title

func (r *Root) Title() string

func (*Root) Volume

func (r *Root) Volume() string

type Subject

type Subject struct {
	MainSubject             string `json:"MainSubject,omitempty"`
	SubjectCode             string `json:"SubjectCode,omitempty"`
	SubjectHeadingText      string `json:"SubjectHeadingText,omitempty"`
	SubjectSchemeIdentifier string `json:"SubjectSchemeIdentifier,omitempty"`
}

type Subtitle

type Subtitle struct {
	Collationkey string `json:"collationkey,omitempty"`
	Content      string `json:"content,omitempty"`
}

type Summary

type Summary struct {
	Author    string `json:"author,omitempty"`
	Cover     string `json:"cover,omitempty"`
	Isbn      string `json:"isbn,omitempty"`
	Pubdate   string `json:"pubdate,omitempty"`
	Publisher string `json:"publisher,omitempty"`
	Series    string `json:"series,omitempty"`
	Title     string `json:"title,omitempty"`
	Volume    string `json:"volume,omitempty"`
}

type SupplyDetail

type SupplyDetail struct {
	Price               []Price            `json:"Price,omitempty"`
	ProductAvailability string             `json:"ProductAvailability,omitempty"`
	ReturnsConditions   *ReturnsConditions `json:"ReturnsConditions,omitempty"`
}

type SupportingResource

type SupportingResource struct {
	ContentAudience string            `json:"ContentAudience,omitempty"`
	ResourceContent string            `json:"ResourceContent,omitempty"`
	ResourceMode    string            `json:"ResourceMode,omitempty"`
	ResourceVersion []ResourceVersion `json:"ResourceVersion,omitempty"`
}

type TextContent

type TextContent struct {
	ContentAudience string `json:"ContentAudience,omitempty"`
	Text            string `json:"Text,omitempty"`
	TextType        string `json:"TextType,omitempty"`
}

type TitleDetail

type TitleDetail struct {
	TitleElement *TitleElement `json:"TitleElement,omitempty"`
	Title        string        `json:"Title,omitempty"`
}

type TitleElement

type TitleElement struct {
	Subtitle          *Subtitle  `json:"Subtitle,omitempty"`
	TitleElementLevel string     `json:"TitleElementLevel,omitempty"`
	TitleText         *TitleText `json:"TitleText,omitempty"`
}

type TitleText

type TitleText struct {
	Collationkey string `json:"collationkey,omitempty"`
	Content      string `json:"content,omitempty"`
}

Jump to

Keyboard shortcuts

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