folio

package
v0.1.361 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 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) MetadataCollections added in v0.1.333

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

MetadataCollections queries for collection and attachment information.

type Doer

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

Doer is implemented by HTTP clients, typically.

type FincConfigMetadataCollection added in v0.1.333

type FincConfigMetadataCollection struct {
	CollectionId      string        `json:"collectionId"`
	ContentFilesValue []interface{} `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             []interface{} `json:"tickets"`
	UsageRestricted     string        `json:"usageRestricted"`
}

FincConfigMetadataCollection is a single configuration entry.

func (*FincConfigMetadataCollection) ContentFiles added in v0.1.333

func (c *FincConfigMetadataCollection) ContentFiles() (result []string)

type LoginResponse added in v0.1.333

type LoginResponse struct {
	PatronGroup struct {
		Desc     string `json:"desc"`
		Group    string `json:"group"`
		Id       string `json:"id"`
		Metadata struct {
			CreatedDate string `json:"createdDate"`
			UpdatedDate string `json:"updatedDate"`
		} `json:"metadata"`
	} `json:"patronGroup"`
	Permissions struct {
		Id       string `json:"id"`
		Metadata struct {
			CreatedByUserId string `json:"createdByUserId"`
			CreatedDate     string `json:"createdDate"`
			UpdatedByUserId string `json:"updatedByUserId"`
			UpdatedDate     string `json:"updatedDate"`
		} `json:"metadata"`
		Permissions []string `json:"permissions"`
		UserId      string   `json:"userId"`
	} `json:"permissions"`
	ProxiesFor        []interface{} `json:"proxiesFor"`
	ServicePointsUser struct {
		Id       string `json:"id"`
		Metadata struct {
			CreatedByUserId string `json:"createdByUserId"`
			CreatedDate     string `json:"createdDate"`
			UpdatedByUserId string `json:"updatedByUserId"`
			UpdatedDate     string `json:"updatedDate"`
		} `json:"metadata"`
		ServicePoints    []interface{} `json:"servicePoints"`
		ServicePointsIds []interface{} `json:"servicePointsIds"`
		UserId           string        `json:"userId"`
	} `json:"servicePointsUser"`
	User struct {
		Active      bool          `json:"active"`
		CreatedDate string        `json:"createdDate"`
		Departments []interface{} `json:"departments"`
		Id          string        `json:"id"`
		Metadata    struct {
			CreatedByUserId string `json:"createdByUserId"`
			CreatedDate     string `json:"createdDate"`
			UpdatedByUserId string `json:"updatedByUserId"`
			UpdatedDate     string `json:"updatedDate"`
		} `json:"metadata"`
		PatronGroup string `json:"patronGroup"`
		Personal    struct {
			Addresses              []interface{} `json:"addresses"`
			Email                  string        `json:"email"`
			FirstName              string        `json:"firstName"`
			LastName               string        `json:"lastName"`
			PreferredContactTypeId string        `json:"preferredContactTypeId"`
		} `json:"personal"`
		ProxyFor    []interface{} `json:"proxyFor"`
		UpdatedDate string        `json:"updatedDate"`
		Username    string        `json:"username"`
	} `json:"user"`
}

LoginResponse for bl-users/login, used to obtain auth tokens.

type MetadataCollectionsOpts added in v0.1.333

type MetadataCollectionsOpts struct {
	CQL   string
	Limit int
}

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