folio

package
v0.2.19 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package folio add support for a minimal subset of the FOLIO library platform API.

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyToken = errors.New("empty token")

Functions

This section is empty.

Types

type API

type API struct {
	Base   string
	Tenant string // e.g. "de_15"
	Client Doer
	Token  string
}

API wraps a few high level operations of a small part of the FOLIO API, e.g. authentication and metadata lookups. This types carries some state, e.g. in form of the auth token obtained after authentication.

func New

func New() *API

func (*API) Authenticate

func (api *API) Authenticate(username, password string) (err error)

Authenticate retrieves a login token given username and plain password. The token is stored and used for any subsequent request.

func (*API) FetchFile added in v0.2.13

func (api *API) FetchFile(fileId string) (io.ReadCloser, error)

FetchFile downloads a file by its ID from the finc-config files endpoint. The caller is responsible for closing the returned ReadCloser.

func (*API) MetadataCollections added in v0.1.333

func (api *API) MetadataCollections(opts MetadataCollectionsOpts) (*MetadataCollectionsResponse, error)

MetadataCollections queries for collection and attachment information.

func (*API) SetToken added in v0.2.13

func (api *API) SetToken(token string)

SetToken sets the API token directly, bypassing the login flow. Use this when the token is provided via environment variable.

type Doer

type Doer interface {
	Do(*http.Request) (*http.Response, error)
}

Doer is implemented by HTTP clients, typically.

type FilterEntry added in v0.2.13

type FilterEntry struct {
	Id          string       `json:"id"`
	Label       string       `json:"label"`
	Type        string       `json:"type"` // e.g. "Whitelist", "Blacklist"
	FilterFiles []FilterFile `json:"filterFiles"`
	Isil        string       `json:"isil"`
}

FilterEntry describes a filter applied to a collection for a specific ISIL.

type FilterFile added in v0.2.13

type FilterFile struct {
	Label  string `json:"label"`
	FileId string `json:"fileId"`
}

FilterFile references a file stored in FOLIO's finc-config module.

type FincConfigMetadataCollection added in v0.1.333

type FincConfigMetadataCollection struct {
	CollectionId string   `json:"collectionId"`
	ContentFiles []string `json:"contentFiles"`
	Description  string   `json:"description"`
	FacetLabel   string   `json:"facetLabel"`
	FreeContent  string   `json:"freeContent"`
	Id           string   `json:"id"`
	Label        string   `json:"label"`
	Lod          struct {
		Note        string `json:"note"`
		Publication string `json:"publication"`
	} `json:"lod"`
	MdSource struct {
		Id   string `json:"id"`
		Name string `json:"name"`
	} `json:"mdSource"`
	Metadata struct {
		CreatedDate string `json:"createdDate"`
		UpdatedDate string `json:"updatedDate"`
	} `json:"metadata"`
	MetadataAvailable   string        `json:"metadataAvailable"`
	PermittedFor        []string      `json:"permittedFor"`
	SelectedBy          []string      `json:"selectedBy"`
	SolrMegaCollections []string      `json:"solrMegaCollections"`
	Tickets             []string      `json:"tickets"`
	UsageRestricted     string        `json:"usageRestricted"`
	FilteredBy          []FilterEntry `json:"filteredBy"`
}

FincConfigMetadataCollection is a single configuration entry.

type MetadataCollectionsOpts added in v0.1.333

type MetadataCollectionsOpts struct {
	CQL               string
	Limit             int
	IncludeFilteredBy bool
}

MetadataCollectionsOpts collections options for the metadata collections API. Not complete.

type MetadataCollectionsResponse added in v0.1.333

type MetadataCollectionsResponse struct {
	FincConfigMetadataCollections []FincConfigMetadataCollection `json:"fincConfigMetadataCollections"`
	TotalRecords                  int64                          `json:"totalRecords"`
}

MetadataCollectionsResponse collects zero, one or more collection entries obtained from the API.

Jump to

Keyboard shortcuts

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