TheThingsArchive / node-app-sdk

The Things Network Application SDK for Node.JS
https://www.thethingsnetwork.org/docs/node-js/
MIT License
41 stars 28 forks source link

Cannot find 'ttn.open()' function #90

Closed parkmeta closed 6 years ago

parkmeta commented 6 years ago

Hi. I want to use ttn.open() to get handlerClient object as shown in the API docs. But, I cannot find the function.

TypeError: ttn.open is not a function

Then i read source code and found that the function isn't exported on below code.

https://github.com/TheThingsNetwork/node-app-sdk/blob/master/src/index.js

I hope that you would explain why the function isn't exported despite stating this on API docs.

noerw commented 6 years ago

You do not need the open() function, just call ttn.data() or ttn.application() to get clients for the respective API. If you still wanted to open a HandlerClient for some reason, you can import { HandlerClient } from 'ttn/handler' and create an instance directly. Not sure why that would be needed though.

I agree that the docs need some love..

parkmeta commented 6 years ago

Thank you a lot for your answer. If I can afford it, I'd like to contribute.