Created
December 21, 2016 19:11
-
-
Save bowbahdoe/9a3ca914146c190f55421456e9cfa85b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class Camera extends Fixture{ | |
constructor(data,metadata={}) { | |
this._structure_id = ... | |
} | |
getCurrentImage() {...} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Interface to work with genral Fixtures and to reason about the different types in a collection | |
export class Fixture{ | |
getLocation() {...} | |
getRawMetaData() {...} | |
getType() {...} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fs from 'fs' | |
import { Structure } from './' | |
....SETUP.... | |
export class Nest { | |
constructor(opts = {}) { | |
check_required(opts, ['email', 'password']) | |
const { | |
email, | |
password, | |
cache = false | |
} = opts | |
this.email = email | |
this.password = password | |
this.cache = {} | |
if(cache) { | |
try { | |
this.cache = JSON.parse(fs.readFileSync('./cache.json', 'utf8')) | |
} catch (err) {} | |
} | |
} | |
getUser() {...} | |
getAllFixtures(where_id=none) {...} | |
getCameras(where_id=none) { | |
if (where_id){...} | |
else{...} | |
} | |
getCamera(camera_id) { ... } | |
getThermostats(where_id=none) { | |
if (where_id){...} | |
else{...} | |
} | |
getThermostat(thermostat_id) {...} | |
getBucket(key) {...} | |
appLaunch() {...} | |
login() {...} | |
getSession() {...} | |
storeCache() {...} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class Thermostat extends Fixture{ | |
constructor(data,metadata={}) { | |
this._structure_id = ... | |
} | |
getCurrentTemperature() {...} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Nest} from "Nest" | |
function yay_i_have_a_decent_api(){ | |
var api = Nest(email, username,..) | |
var why_would_my_image_recognition_program_care_about_the_fucking_temperature = api.getCameras(where_id="office) | |
for(camera: cameras){ | |
look_for_faces(camera.getCurrentImage) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment