Categorygithub.com/balena-io/pinejs-client-go
modulepackage
0.0.0-20170412165724-ac4f79c5f7e7
Repository: https://github.com/balena-io/pinejs-client-go.git
Documentation: pkg.go.dev

# README

Pine.js Go Library

This is a simple Go library for interacting with pine.js. Also includes object definitions to interact with the resin.io API.

Usage

import (
	pinejs "github.com/resin-io/pinejs-client-go"
	"github.com/resin-io/pinejs-client-go/resin"
)

// Using a struct
func GetDatDevice() {
	var device resin.Device{Id: 1234}
	pineClient := pinejs.NewClient("https://api.resinstaging.io/ewa", "secretapikey")

	if err := pineClient.Get(&device); err != nil {
		log.Fatalln(err)
	} else {
		// device contains the device object with id 1234.
	}
}

// Using a map
func GetDatDeviceOnAMap() {
	device := map[string]interface{}{"pinejs": "device", "id": 1234}
	pineClient := pinejs.NewClient("https://api.resinstaging.io/ewa", "secretapikey")

	if err := pineClient.Get(&device); err != nil {
		log.Fatalln(err)
	} else {
		// device contains the device object with id 1234.
	}
}

More examples in test/test.go

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# Functions

NewClient returns a client initialised to the provided endpoint and API key.
No description provided by the author
NewQueryOptions is a convenience function for inputting query options.
ShowDebugOutput enables the debug logger, outputting to stderr.
The current implementation version.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author

# Structs

Client represents an HTTP client to a pine.js server.
No description provided by the author
No description provided by the author

# Type aliases

QueryOptions is a collection of OData query options.
QueryOptionType specifies the OData query option you wish to use.