Is it possible to import libraries?

I am working on device code that that requires OAuth 1.0 coding.

It seems the OAuth samples in the ST docs are all OAuth 2

Is it possible to import libraries into ST code ?

Based on this archived thread I think it is not. However the thread also discusses libraries that are available but there is yet another lack of documentation. Perhaps @Jim can say if there is any library documentation coming ?

What is available in groovy is typically available to you in your SmartApps or device-types. There are some restrictions documented here.

As you noticed, we support OAth 2, not OAuth 1.

Regarding importing your own libraries, our approach has been to offer various APIs or packages in our sandbox; we don’t support importing external or other libraries.

One of my coworkers pointed out that you could possibly make API calls to an external service to do some sort of conversion or handling, if your device-type isn’t latency-sensitive… just an idea.

Interesting Idea. I also notice that fitbit has a message posted that they will upgrade to OAuth 2.0 in the upcoming months. So I might just wait. I think for now I can use ifttt for what I want to do.

Thanks @Jim !

Jim,

In the above documentation, there is a section “Restricted methods”.

That list is incomplete. I discovered the hard way that you cannot have a method called tiles(), fontSize() and there where at lease a couple more that I encountered and spent hours debugging. It would be great to update the list of reserved keywords, method name and other script limitations.

@Jim shouldn’t the restrictions page also mention that you can’t import ? Seems important (pun intended) I tried a lot of different import techniques and found that some didn’t produce any errors during save so thought they should work. In the end I decided it mush be a restriction and posted this thread.

Interestingly, I’ve seen at least two ST apps that do in fact import some Java libs, math stuff if I recall.
In the hue app and or hub device.

Just looked couldn’t find them. My guess if they did import they didn’t need to. I find import’s don’t fail they are just ignored. So if you have import something ST already includes you may not realize you didn’t need to import.

Found if, quirky connect, you’re right doesn’t matter in the end.

*  Update9:2014-04-08 (twackford)
 *         resubscribe to events on each poll
 */

import java.text.DecimalFormat

// Wink API
private apiUrl() 			{ "https://winkapi.quirky.com/" }
private getVendorName() 	{ "Quirky Wink" }