Skip to content

Latest commit

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

A Go client for ICCU API

https://api.iccu.sbn.it/devportal/apis

Work in progress, do not use.

Example usage:

package main
import (
"context""fmt""log""github.com/atomotic/iccu/client""github.com/atomotic/iccu/nomi"
)
funcmain() {
ctx:=context.Background()
c, err:=client.New(ctx, "$key", "$secret")
iferr!=nil {
log.Fatal(err)
}
// Search returns an iterator that handles pagination automaticallyfordoc:=rangenomi.Search(ctx, c, "alei* crowley", nil) {
fmt.Printf("%s - %s - %s\n", doc.ID, doc.Bid(), doc.Name())
}
}

Output:

IT\ICCU\CFIV\025223 - http://id.sbn.it/bid/CFIV025223 - Crowley, Aleister

With custom page size and total count:

// Get total count of resultsiter, total, err:=nomi.SearchWithTotal(ctx, c, "dante", nil)
iferr!=nil {
log.Fatal(err)
}
count:=0fordoc:=rangeiter {
fmt.Printf("%s - %s\n", doc.ID, doc.Name())
count++
}
fmt.Printf("Fetched %d out of %d total results\n", count, *total)
// Custom page sizeopts:=&nomi.SearchOptions{PageSize: 100}
fordoc:=rangenomi.Search(ctx, c, "dante", opts) {
fmt.Println(doc.Name())
}

About

A Go client for ICCU API

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Used by

Contributors

Languages