Skip to content

euracresearch/go-snipeit

Repository files navigation

go-snipeit

GoDoc tests

go-snipeit is a Go client library for accessing the SNIPE-IT API.

Notice

The library is under development and currently supports only API endpoints and methods used internally by Eurac Research.

If you need a full API client we suggest to download the Swagger/OpenAPI Specification and use a tool like oapi-codegen to generate the Go client code.

Supported API endpoints:

During development a version was tagged as v0.0.1 by mistake. In order to always get the latest version use the following command go get github.com/euracresearch/go-snipeit@master until we reach a v1.0.0.

Of course, contributions are very welcome!

Example

First get the latest version by:

$ go get github.com/euracresearch/go-snipeit@master
package main

import (
	"fmt"
	"log"

	"github.com/euracresearch/go-snipeit"
)

func main() {
	// Create a new client using SnipeIT API base URL and and authentication token
	client, err := snipeit.NewClient("https://develop.snipeitapp.com/api/v1/", "my-token")
	if err != nil {
		log.Fatal(err)
	}

	opts := &snipeit.HardwareOptions{
		Limit: 10,
	}
	// Retrieve all hardware limited to 10
	hardware, _, err := client.Hardware(opts)
	if err != nil {
		log.Fatal(err)
	}

	// Print all hardware AssetTags
	for _, h := range hardware {
		fmt.Println(h.AssetTag)
	}
}

License

The library is distributed under the BSD-style license found in LICENSE file.

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages