latitudesh / latitudesh-go

Go library for the Latitude.sh API
https://docs.latitude.sh/reference
Other
4 stars 3 forks source link

List all operating systems available #19

Closed ynhummel closed 1 year ago

ynhummel commented 1 year ago

Adds Operating Systems module with List method for retrieving all available operating systems.

You can run tests using the golang Testing package:

LATITUDE_AUTH_TOKEN=<API TOKEN> LATITUDE_TEST_ACTUAL_API=true go test -timeout 30s -run "^TestAccOperatingSystemBasic$"

Or for manual testing use go get to download this branch:

go get github.com/latitudesh/latitudesh-go@list-operating-systems

Usage:

package main

import (
    "fmt"
    "os"

    latitude "github.com/latitudesh/latitudesh-go"
)

func main() {
    client := latitude.NewClientWithAuth("Latitude.sh", "<API TOKEN>", nil)

    list, res, err := client.OperatingSystems.List(nil)
    if err != nil {
        fmt.Fprintln(os.Stderr, err)
    }

    fmt.Printf("Status: %s\n", res.Status)
    fmt.Println(list)
}

Relevant documentation: https://docs.latitude.sh/reference/get-plans-operating-system