Skip to content

apellizzn/lelylan-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Lelylan Go Package

Go client library for Lelylan API

Introduction

What is Lelylan

Lelylan makes it easy for developers to monitor and control all devices in your house providing a simple and consistent REST API.

Requirements

Installation

Install using the Go command line

go get

Getting started

Import packages

import (
    "github.com/bradrydzewski/go.auth/oauth2"
    "github.com/apellizzn/lelylan-go/lelylan"
)

Get an access token

First of all you need an access token to authoraze your requests in Lelylan. To get one use the OAuth2 package and if you are not used to OAuth2 concepts, take 10 minutes and read the related documentation in the dev center.

Create a client

oauthClient := oauth2.Client {
        ClientId: os.Getenv("CLIENT_ID"),
    ClientSecret: os.Getenv("CLIENT_SECRET"),
    AccessTokenURL: "http://people.lelylan.com/oauth/token"}

Require an access token with password credential flow

token, err := oauthClient.GrantTokenPassword(os.Getenv("USERNAME"), os.Getenv("PASSWORD"), "resources")

Lelylan access

Once you have the access token you can access to the Lelylan API. The following example shows how to print in the console a list of owned devices.

Initialize Lelylan client

client := lelylan.Client{ Token: token }

Get one device.

client.Device(<id here>)
fmt.Println(device.Uri) # get the device uri 
fmt.Println(device.Name) # get the device name

Contributing

Fork the repo on github and send a pull requests with topic branches. Do not forget to provide specs to your contribution.

Running specs

  • Work in progress

Running locally

  • Work in progress

Coding guidelines

Follow github guidelines.

Feedback

Use the issue tracker for bugs. Mail or Tweet us for any idea that can improve the project.

Links

Authors

Alberto Pellizzon

Contributors

Special thanks to the following people for submitting patches.

Copyright

Copyright (c) 2013 Lelylan. See LICENSE for details.

About

Go wrapper for Lelylan API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages