a Go library for ArchivesSpace integrations
- Get the go-aspace library: $go get github.com/nyudlts/go-aspace.
- Edit the config file
$GOROOT/github.com/nyudlts/go-aspace/go-aspace.yml_template
, enter your aspace credentials - Import "github.com/nyudlts/go-aspace" into your project
- Create an instance of the aspace client:
package main
import (
"fmt"
"github.com/nyudlts/go-aspace"
)
func main() {
aspaceClient, err := aspace.NewClient(/path/to/go-aspace.yml, "environment to use from config", timeout)
if err != nil {
panic(err)
}
repositories, err := aspaceClient.GetRepositories()
if err != nil {
panic(err)
}
fmt.Println(repositories) //prints the array of Repository IDs from ArchivesSpace.
}
A config template can be found in go-aspace.yml_template
dev:
url: https://your-archivesspace-api.url:8089
username: your-username
password: your-password
local:
url: http://localhost:8089
username: your-username
password: your-password
A simple example application can be found at /example/main.go
go run example/main.go --config /path/to/go-aspace.yml --environment the-environment-to-use
to run the test suite
go test -v --config /path/to/go-aspace.yml --environment the-environment-to-use
The test suite will select random objects from the specified aspace instance, which may fail serialization to go structs