Skip to content
This repository has been archived by the owner on Mar 18, 2020. It is now read-only.

balena-io-modules/pinejs-client-go

Repository files navigation

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

About

A Go client for resin.io's pine.js API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages