How to use the thingpedia.OnlineAccount function in thingpedia

To help you get started, we’ve selected a few thingpedia examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github stanford-oval / thingengine-core / engine / device-classes / facebook / device.js View on Github external
// -*- mode: js; indent-tabs-mode: nil; js-basic-offset: 4 -*-
//
// This file is part of ThingEngine
//
// Copyright 2015 Giovanni Campagna 
//
// See COPYING for details

const Tp = require('thingpedia');

module.exports = new Tp.DeviceClass({
    Name: 'FacebookDevice',
    Extends: Tp.OnlineAccount,

    _init: function(engine, state) {
        this.parent(engine, state);

        this.uniqueId = 'facebook-' + this.profileId;
        this.name = "Facebook Account %s".format(this.profileId);
        this.description = "This is your Facebook Account. You can use it to access your wall, follow your friends, send messages and more.";
    },

    get profileId() {
        return this.state.profileId;
    },

    get accessToken() {
        return this.state.accessToken;
    },
github stanford-oval / thingengine-core / engine / device-classes / google-account / device.js View on Github external
// -*- mode: js; indent-tabs-mode: nil; js-basic-offset: 4 -*-
//
// This file is part of ThingEngine
//
// Copyright 2015 Giovanni Campagna 
//
// See COPYING for details

const Tp = require('thingpedia');

module.exports = new Tp.DeviceClass({
    Name: 'GoogleAccountDevice',
    Extends: Tp.OnlineAccount,

    _init: function(engine, state) {
        this.parent(engine, state);

        this.uniqueId = 'google-account-' + this.profileId;
        this.name = "Google Account %s".format(this.profileId);
        this.description = "This is your Google Account. You can use it to access Google Fit data, emails, calendars and more.";
    },

    get profileId() {
        return this.state.profileId;
    },

    get accessToken() {
        return this.state.accessToken;
    },
github stanford-oval / thingengine-core / common-devices / twitter-account / device.js View on Github external
return Q.try(function() {
        if (req === null) {
            return runOAuthStep1(engine);
        } else {
            return runOAuthStep2(engine, req);
        }
    }).catch(function(e) {
        console.log(e);
        console.log(e.stack);
        throw e;
    });
}

module.exports = new Tp.DeviceClass({
    Name: 'TwitterAccountDevice',
    Extends: Tp.OnlineAccount,
    UseOAuth2: runOAuth2,
    Kinds: ['twitter'],

    _init: function(engine, state) {
        this.parent(engine, state);

        this.uniqueId = 'twitter-account-' + this.userId;
        this.name = "Twitter Account %s".format(this.screenName);
        this.description = "This is your Twitter Account. You can use it to be updated on the status of your friends, and update them with your thoughts.";
    },

    get screenName() {
        return this.state.screenName;
    },

    get userId() {