madek

package module
v0.3.3-0...-239dc8a Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2022 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

madek

A Go library and command line tool that simplifies accessing the Madek API.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAccessForbidden = errors.New("access forbidden")

ErrAccessForbidden is returned when the requested resources is protected.

View Source
var ErrInvalidAuthentication = errors.New("invalid authentication")

ErrInvalidAuthentication is returned when the supplied authentication credentials have been rejected.

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is returned when the requested resource ist not found.

View Source
var ErrRequestFailed = errors.New("request failed")

ErrRequestFailed is returned when the request failed due to some error.

Functions

This section is empty.

Types

type Author

type Author struct {
	ID        string `json:"id,omitempty"`
	FirstName string `json:"first_name,omitempty"`
	LastName  string `json:"last_name,omitempty"`
}

Author contains info about an author.

type Client

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

A Client is used to request data from the Madek API.

func NewClient

func NewClient(address, username, password string) *Client

NewClient will create and return a new Client.

func (*Client) CompileCollection

func (c *Client) CompileCollection(id string) (*Collection, error)

CompileCollection will fully compile a collection with all available data from the API.

func (*Client) CompileMediaEntry

func (c *Client) CompileMediaEntry(id string) (*MediaEntry, error)

CompileMediaEntry will fully compile a media entry with all available data from the API.

func (*Client) CompileMetaData

func (c *Client) CompileMetaData(url string) (*MetaData, error)

CompileMetaData will compile the metadata found at the specified url.

func (*Client) Fetch

func (c *Client) Fetch(url string) (string, error)

Fetch will request the specified URL from Madek.

func (*Client) GetAuthor

func (c *Client) GetAuthor(id string) (*Author, error)

GetAuthor will find the author with the provided id.

func (*Client) GetGroup

func (c *Client) GetGroup(id string) (*Group, error)

GetGroup will find the group with the provided id.

func (*Client) GetKeywordTerm

func (c *Client) GetKeywordTerm(id string) (string, error)

GetKeywordTerm will find the term for the provided keyword id.

func (*Client) GetLicenseLabel

func (c *Client) GetLicenseLabel(id string) (string, error)

GetLicenseLabel will find the label for the provided license id.

func (*Client) URL

func (c *Client) URL(format string, args ...interface{}) string

URL appends the passed format to the Madek address.

type Collection

type Collection struct {
	ID           string        `json:"id"`
	CreatedAt    time.Time     `json:"created_at"`
	MetaData     *MetaData     `json:"meta_data"`
	MediaEntries []*MediaEntry `json:"media_entries"`
}

A Collection contains multiple media entries.

type Copyright struct {
	Holder   string   `json:"holder,omitempty"`
	Usage    string   `json:"usage,omitempty"`
	Licenses []string `json:"licenses,omitempty"`
}

Copyright contains copyright infos.

type Group

type Group struct {
	ID        string `json:"id,omitempty"`
	Name      string `json:"name,omitempty"`
	Pseudonym string `json:"pseudonym,omitempty"`
}

Group contains info about a group.

type MediaEntry

type MediaEntry struct {
	ID          string     `json:"id"`
	MetaData    *MetaData  `json:"meta_data"`
	CreatedAt   time.Time  `json:"created_at"`
	FileID      string     `json:"file_id"`
	FileName    string     `json:"file_name"`
	FileType    string     `json:"file_type"`
	FileSize    int64      `json:"file_size"`
	StreamURL   string     `json:"stream_url"`
	DownloadURL string     `json:"download_url"`
	Previews    []*Preview `json:"previews"`
}

A MediaEntry contains multiple previews.

type MetaData

type MetaData struct {
	Title       string    `json:"title,omitempty"`
	Subtitle    string    `json:"subtitle,omitempty"`
	Description string    `json:"description,omitempty"`
	Authors     []*Author `json:"authors,omitempty"`
	Keywords    []string  `json:"keywords,omitempty"`
	Genres      []string  `json:"genres,omitempty"`
	Year        string    `json:"year,omitempty"`
	Copyright   Copyright `json:"copyright,omitempty"`
	Affiliation []*Group  `json:"affiliation,omitempty"`
}

MetaData contains multiple metadata key value pairs.

type Preview

type Preview struct {
	ID          string `json:"id"`
	Type        string `json:"type"`
	ContentType string `json:"content_type"`
	Size        string `json:"size"`
	Width       int    `json:"width"`
	Height      int    `json:"height"`
	URL         string `json:"url"`
}

A Preview is the final accessible media.

Directories

Path Synopsis
cmd
madek command

Jump to

Keyboard shortcuts

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