indexdata / foliogo

FOLIO client library for Go
Apache License 2.0
0 stars 0 forks source link

FolioGo - FOLIO client library for Go

Copyright (C) 2023 Index Data Aps.

This software is distributed under the terms of the Apache License, Version 2.0. See the file "LICENSE" for more information.

Overview

FolioGo is a simple Go module to allow the creation of code that manipulate instances of the FOLIO library services platform. For example, a very simple program to list the first 20 usernames, with asterisks next to the active ones, might read as follows:

package main

import "fmt"
import "github.com/indexdata/foliogo"

func main() {
    service := foliogo.NewService("https://folio-snapshot-okapi.dev.folio.org")
    session, _ := service.Login("diku", "user-basic-view", "user-basic-view")
    body, _ := session.Fetch0("users?limit=20")
    fmt.Println(body)
}

This module is a port of the FolioJS Node package which does the same thing for JavaScript. We need the Go version to become part of the FOLIO module mod-reporting, but it will likely have plenty of other uses.

API

The API is described in a separate document, The FolioGo API.

Environment

The behaviour of the FolioGo library can be modified by the values of the following environment variables:

Logging

This library uses the tiny but beautiful catlogger library to provide optional logging. This is configured at run-time by the LOGGING_CATEGORIES or LOGCAT environment variable, which is set to a comma-separated list of categories such as op,curl,status. Messages in all the listed categories are logged.

Apart from categories used by log invocations in application code, the following categories are used by the libarary itself:

Author

Mike Taylor (mike@indexdata.com), for Index Data Aps.