overdrive

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Card

type Card struct {
	CardId       string `json:"cardId"`
	CardName     string `json:"cardName"`
	AdvantageKey string `json:"advantageKey"`

	Library struct {
		Name      string `json:"name"`
		WebsiteId string `json:"websiteId"`
		Logo      struct {
			Url string `json:"url"`
		} `json:"logo"`
	} `json:"library"`
}

type ChipResponse

type ChipResponse struct {
	Chip     string `json:"chip"`
	Identity string `json:"identity"`
	Syncable bool   `json:"syncable"`
	Primary  bool   `json:"primary"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient() *Client

func (*Client) Chip

func (c *Client) Chip(ctx context.Context) (*ChipResponse, error)

func (*Client) ChipClone

func (c *Client) ChipClone(ctx context.Context, code string) (*CloneResponse, error)

func (*Client) ChipSync

func (c *Client) ChipSync(ctx context.Context) (*SyncResponse, error)

func (*Client) CreateHold added in v0.3.0

func (c *Client) CreateHold(ctx context.Context, cardId, mediaId string) error

func (*Client) CreateLoan

func (c *Client) CreateLoan(ctx context.Context, cardId, mediaId, format string) error

func (*Client) DeleteHold added in v0.3.0

func (c *Client) DeleteHold(ctx context.Context, cardId, mediaId string) error

func (*Client) DeleteLoan

func (c *Client) DeleteLoan(ctx context.Context, cardId, mediaId string) error

func (*Client) GetLibrariesByWebsiteId

func (c *Client) GetLibrariesByWebsiteId(ctx context.Context, websiteIds []int) (*LibrariesResponse, error)

func (*Client) GetMedia

func (c *Client) GetMedia(ctx context.Context, library, titleId string) (*GetMediaResponse, error)

func (*Client) OpenLoan added in v0.2.0

func (c *Client) OpenLoan(ctx context.Context, cardId, mediaId, mediaTypeId string) (*OpenLoanResponse, error)

func (*Client) SearchMedia added in v0.3.1

func (c *Client) SearchMedia(ctx context.Context, library, query string, format MediaFormat) (*SearchMediaResponse, error)

type CloneRequest

type CloneRequest struct {
	Code string `json:"code"`
}

type CloneResponse

type CloneResponse struct {
	Result string `json:"result"`
	Chip   string `json:"chip"`
}

type CreateHoldRequest added in v0.3.0

type CreateHoldRequest struct{}

type CreateLoanRequest

type CreateLoanRequest struct {
	Period      int         `json:"period"`
	Units       string      `json:"units"`
	LuckyDay    interface{} `json:"luckyDay"`
	TitleFormat string      `json:"title_format"`
}

type Downloader added in v0.3.0

type Downloader struct {
	// contains filtered or unexported fields
}

func NewDownloader added in v0.3.0

func NewDownloader() *Downloader

func (*Downloader) Download added in v0.3.0

func (d *Downloader) Download(ctx context.Context, loan *OpenLoanResponse, destFolder string) error

type GetMediaResponse added in v0.3.1

type GetMediaResponse struct {
	Id    string    `json:"id"`
	Title string    `json:"title"`
	Type  MediaType `json:"type"`

	EstimatedWaitDays int       `json:"estimatedWaitDays"`
	FirstCreatorName  string    `json:"firstCreatorName"`
	IsAvailable       bool      `json:"isAvailable"`
	PublishDate       time.Time `json:"publishDate"`

	Languages []struct {
		Name string `json:"name"`
		Id   string `json:"id"`
	} `json:"languages"`
}

type Hold

type Hold struct {
	Id                string    `json:"id"`
	CardId            string    `json:"cardId"`
	EstimatedWaitDays int       `json:"estimatedWaitDays"`
	FirstCreatorName  string    `json:"firstCreatorName"`
	PlacedDate        time.Time `json:"placedDate"`
	Title             string    `json:"title"`
	Type              MediaType `json:"type"`
}

type LibrariesResponse

type LibrariesResponse struct {
	Items []struct {
		Id           string `json:"id"`
		Name         string `json:"name"`
		PreferredKey string `json:"preferredKey"`
	} `json:"items"`
}

type Loan

type Loan struct {
	CardId           string    `json:"cardId"`
	CheckoutDate     time.Time `json:"checkoutDate"`
	ExpireDate       time.Time `json:"expireDate"`
	FirstCreatorName string    `json:"firstCreatorName"`
	Id               string    `json:"id"`
	Title            string    `json:"title"`
	Type             MediaType `json:"type"`
}

type MediaFormat

type MediaFormat int
const (
	MediaFormatAny MediaFormat = iota
	MediaFormatAudiobook
	MediaFormatEbook
)

type MediaType

type MediaType struct {
	Name string `json:"name"`
	Id   string `json:"id"`
}

type OpenLoanResponse added in v0.2.0

type OpenLoanResponse struct {
	Urls struct {
		Web        string `json:"web"`
		Openbook   string `json:"openbook"`
		Rosters    string `json:"rosters"`
		Possession string `json:"possession"`
		Activity   string `json:"activity"`
	} `json:"urls"`
	Message string `json:"message"`
}

type Openbook added in v0.2.0

type Openbook struct {
	Title struct {
		Main string `json:"main"`
	} `json:"title"`

	Creator []struct {
		Name string `json:"name"`
	} `json:"creator"`

	Language string `json:"language"`

	Nav struct {
		Landmarks []struct {
			Type  string `json:"type"`
			Path  string `json:"path"`
			Title string `json:"title"`
		} `json:"landmarks"`

		Toc []TocItem `json:"toc"`
	} `json:"nav"`

	RenditionFormat string `json:"rendition-format"`

	Spine []struct {
		MediaType          string  `json:"media-type"`
		Id                 string  `json:"id"`
		AudioDuration      float64 `json:"audio-duration"`
		OdreadOriginalPath string  `json:"-odread-original-path"`
	} `json:"spine"`

	OdreadFurbishUri string `json:"-odread-furbish-uri"`
}

func ReadOpenbook added in v0.2.0

func ReadOpenbook(path string) (*Openbook, error)

type Roster

type Roster struct {
	Group   string `json:"group"`
	Entries []struct {
		Url   string `json:"url"`
		Bytes int    `json:"bytes"`
	} `json:"entries"`
}

type SearchMediaResponse added in v0.3.1

type SearchMediaResponse struct {
	Items []GetMediaResponse `json:"items"`
}

type SyncResponse

type SyncResponse struct {
	Result   string `json:"result"`
	Cards    []Card `json:"cards"`
	Loans    []Loan `json:"loans"`
	Holds    []Hold `json:"holds"`
	Identity string `json:"identity"`
}

type TocItem added in v0.2.0

type TocItem struct {
	Title    string    `json:"title"`
	Path     string    `json:"path"`
	Contents []TocItem `json:"contents"`
}

Jump to

Keyboard shortcuts

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