https://github.com/atomotic/iccu
A Go client for ICCU API
https://github.com/atomotic/iccu
iccu sbn
Last synced: about 1 month ago
JSON representation
A Go client for ICCU API
- Host: GitHub
- URL: https://github.com/atomotic/iccu
- Owner: atomotic
- Created: 2024-07-19T09:51:21.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-11-17T13:40:35.000Z (8 months ago)
- Last Synced: 2025-11-17T15:21:52.361Z (8 months ago)
- Topics: iccu, sbn
- Language: Go
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# A Go client for ICCU API
https://api.iccu.sbn.it/devportal/apis
_Work in progress, do not use._
Example usage:
```go
package main
import (
"context"
"fmt"
"log"
"github.com/atomotic/iccu/client"
"github.com/atomotic/iccu/nomi"
)
func main() {
ctx := context.Background()
c, err := client.New(ctx, "$key", "$secret")
if err != nil {
log.Fatal(err)
}
// Search returns an iterator that handles pagination automatically
for doc := range nomi.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:
```go
// Get total count of results
iter, total, err := nomi.SearchWithTotal(ctx, c, "dante", nil)
if err != nil {
log.Fatal(err)
}
count := 0
for doc := range iter {
fmt.Printf("%s - %s\n", doc.ID, doc.Name())
count++
}
fmt.Printf("Fetched %d out of %d total results\n", count, *total)
// Custom page size
opts := &nomi.SearchOptions{PageSize: 100}
for doc := range nomi.Search(ctx, c, "dante", opts) {
fmt.Println(doc.Name())
}
```