diff options
author | Jelmer Vernooij <jelmer@debian.org> | 2021-08-29 02:59:48 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@debian.org> | 2021-08-29 02:59:48 +0200 |
commit | 4ba9c302b20526631d8987170293bffd56e4befc (patch) | |
tree | 0325b2c24f66a97b940f416b0595037fee6f4358 | |
parent | bcb03bad9c620a83cf66efee3f76489e15be65d9 (diff) | |
parent | 99b95794c11111bbeb70d8b2d944471dde14f7b2 (diff) |
node-node-rest-client (2.5.0-6) unstable; urgency=medium
[ Debian Janitor ]
* Remove constraints unnecessary since buster:
+ Build-Depends: Drop versioned constraint on node-debug.
+ node-node-rest-client: Drop versioned constraint on node-debug in Depends.
* Update standards version to 4.5.1, no changes needed.
[dgit import unpatched node-node-rest-client 2.5.0-6]
-rw-r--r-- | debian/changelog | 67 | ||||
-rw-r--r-- | debian/control | 47 | ||||
-rw-r--r-- | debian/copyright | 33 | ||||
-rw-r--r-- | debian/docs | 1 | ||||
-rw-r--r-- | debian/gbp.conf | 5 | ||||
-rw-r--r-- | debian/patches/fix-buffer-usage.diff | 34 | ||||
-rw-r--r-- | debian/patches/series | 1 | ||||
-rwxr-xr-x | debian/rules | 8 | ||||
-rw-r--r-- | debian/salsa-ci.yml | 4 | ||||
-rw-r--r-- | debian/source/format | 1 | ||||
-rw-r--r-- | debian/tests/control | 6 | ||||
-rwxr-xr-x | debian/tests/nesttest | 12 | ||||
-rwxr-xr-x | debian/tests/nesttest_data/mock_nest_rest_server.py | 120 | ||||
-rw-r--r-- | debian/tests/nesttest_data/nest_test.js | 64 | ||||
-rw-r--r-- | debian/upstream/metadata | 4 | ||||
-rw-r--r-- | debian/watch | 5 |
16 files changed, 412 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..1c7b887 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,67 @@ +node-node-rest-client (2.5.0-6) unstable; urgency=medium + + [ Debian Janitor ] + * Remove constraints unnecessary since buster: + + Build-Depends: Drop versioned constraint on node-debug. + + node-node-rest-client: Drop versioned constraint on node-debug in Depends. + * Update standards version to 4.5.1, no changes needed. + + -- Jelmer Vernooij <jelmer@debian.org> Sun, 29 Aug 2021 01:59:48 +0100 + +node-node-rest-client (2.5.0-5) unstable; urgency=medium + + * Team upload + + [ Debian Janitor ] + * Set upstream metadata fields: Bug-Database, Bug-Submit. + + [ Xavier Guimard ] + * Bump debhelper compatibility level to 13 + * Use dh-sequence-nodejs + + [ Pirate Praveen ] + * Adapt for uuid 8.x API change (Closes: #964207) + + -- Pirate Praveen <praveen@debian.org> Tue, 08 Dec 2020 23:40:46 +0530 + +node-node-rest-client (2.5.0-4) unstable; urgency=medium + + * Team upload + + [ Debian Janitor ] + * Use secure copyright file specification URI. + * Bump debhelper from old 10 to 12. + * Set debhelper-compat version in Build-Depends. + * Set upstream metadata fields: Repository, Repository-Browse. + + [ Xavier Guimard ] + * Declare compliance with policy 4.5.0 + * Add "Rules-Requires-Root: no" + * Add debian/gbp.conf + * Update debian/watch to use npm registry + * Use pkg-js-tools auto install + * Replace Buffer() by Buffer.from() + + -- Xavier Guimard <yadd@debian.org> Sun, 01 Mar 2020 17:42:48 +0100 + +node-node-rest-client (2.5.0-3) unstable; urgency=low + + * Fix autopkgtest: node-node-uuid -> node-uuid (Closes: #913086) + * Bump Standards-Version to 4.2.1: nothing needs to be changed + * debian/control: Change Vcs-* to salsa + * Bump debhelper version to 10 + + -- Ying-Chun Liu (PaulLiu) <paulliu@debian.org> Thu, 08 Nov 2018 06:32:44 +0800 + +node-node-rest-client (2.5.0-2) unstable; urgency=low + + * Fix autopkgtest fail + * Bump Standards-Version to 4.1.3: nothing needs to be changed + + -- Ying-Chun Liu (PaulLiu) <paulliu@debian.org> Thu, 11 Jan 2018 18:25:06 +0800 + +node-node-rest-client (2.5.0-1) unstable; urgency=low + + * Initial release (Closes: #877646) + + -- Ying-Chun Liu (PaulLiu) <paulliu@debian.org> Wed, 04 Oct 2017 16:36:24 +0000 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..544873b --- /dev/null +++ b/debian/control @@ -0,0 +1,47 @@ +Source: node-node-rest-client +Maintainer: Debian Javascript Maintainers <pkg-javascript-devel@lists.alioth.debian.org> +Uploaders: Ying-Chun Liu (PaulLiu) <paulliu@debian.org> +Section: javascript +Testsuite: autopkgtest-pkg-nodejs +Priority: optional +Build-Depends: + debhelper-compat (= 13) + , node-debug <!nocheck> + , node-follow-redirects <!nocheck> + , node-xml2js <!nocheck> + , dh-sequence-nodejs +Standards-Version: 4.5.1 +Vcs-Browser: https://salsa.debian.org/js-team/node-node-rest-client +Vcs-Git: https://salsa.debian.org/js-team/node-node-rest-client.git +Homepage: https://github.com/aacerox/node-rest-client +Rules-Requires-Root: no + +Package: node-node-rest-client +Architecture: all +Depends: + ${misc:Depends} + , node-debug + , node-follow-redirects + , node-xml2js + , nodejs +Description: Rest API client for NodeJS + Allows connecting to any API REST and get results as js Object. The client + has the following features: + * Transparent HTTP/HTTPS connection to remote API sites. + * Allows simple HTTP basic authentication. + * Allows most common HTTP operations: GET, POST, PUT, DELETE, PATCH or any + other method through custom connect method + * Allows creation of custom HTTP Methods (PURGE, etc.) + * Direct or through proxy connection to remote API sites. + * Register remote API operations as own client methods, simplifying reuse. + * Dynamic path and query parameters and request headers. + * Improved Error handling mechanism (client or specific request) + * Added support for compressed responses: gzip and deflate + * Added support for follow redirects thanks to great follow-redirects + package + * Added support for custom request serializers (json,xml and url-encoded + included by default) + * Added support for custom response parsers (json and xml included by + default) + . + Node.js is an event-based server-side JavaScript engine. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..4476de2 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,33 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: node-rest-client +Upstream-Contact: https://github.com/aacerox/node-rest-client/issues +Source: https://github.com/aacerox/node-rest-client + +Files: * +Copyright: 2017 Alejandro Alvarez Acero +License: Expat + +Files: debian/* +Copyright: 2017 Ying-Chun Liu (PaulLiu) <paulliu@debian.org> +License: Expat + +License: Expat + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation files + (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + . + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..cdb5f04 --- /dev/null +++ b/debian/docs @@ -0,0 +1 @@ +readme.md diff --git a/debian/gbp.conf b/debian/gbp.conf new file mode 100644 index 0000000..b713356 --- /dev/null +++ b/debian/gbp.conf @@ -0,0 +1,5 @@ +[DEFAULT] +pristine-tar = True + +[import-orig] +filter = [ '.gitignore', '.travis.yml', '.git*' ] diff --git a/debian/patches/fix-buffer-usage.diff b/debian/patches/fix-buffer-usage.diff new file mode 100644 index 0000000..1877bc1 --- /dev/null +++ b/debian/patches/fix-buffer-usage.diff @@ -0,0 +1,34 @@ +Description: replace Buffer() by Buffer.from() +Author: Xavier Guimard <yadd@debian.org> +Forwarded: no +Last-Update: 2020-03-01 + +--- a/lib/node-rest-client.js ++++ b/lib/node-rest-client.js +@@ -64,7 +64,7 @@ + var result ={};
+ // if proxy requires authentication, create Proxy-Authorization headers
+ if (self.proxy.user && self.proxy.password){
+- result["Proxy-Authorization"] = "Basic " + new Buffer([self.proxy.user,self.proxy.password].join(":")).toString("base64");
++ result["Proxy-Authorization"] = "Basic " + new Buffer.from([self.proxy.user,self.proxy.password].join(":")).toString("base64");
+ }
+ // no tunnel proxy connection, we add the host to the headers
+ if(!self.useProxyTunnel)
+@@ -497,7 +497,7 @@ +
+ // concurrent data chunk handler
+ res.on('data',function(chunk){
+- buffer.push(new Buffer(chunk));
++ buffer.push(new Buffer.from(chunk));
+ });
+
+ res.on('end',function(){
+@@ -583,7 +583,7 @@ +
+ // concurrent data chunk handler
+ res.on('data',function(chunk){
+- buffer.push(new Buffer(chunk));
++ buffer.push(new Buffer.from(chunk));
+ });
+
+ res.on('end',function(){
diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..4012ed3 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +fix-buffer-usage.diff diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..218df65 --- /dev/null +++ b/debian/rules @@ -0,0 +1,8 @@ +#!/usr/bin/make -f +# -*- makefile -*- + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +%: + dh $@ diff --git a/debian/salsa-ci.yml b/debian/salsa-ci.yml new file mode 100644 index 0000000..33c3a64 --- /dev/null +++ b/debian/salsa-ci.yml @@ -0,0 +1,4 @@ +--- +include: + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..d819997 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,6 @@ +Tests: nesttest +Depends: @ + , node-uuid + , python3-flask + , python3-flask-restful +Restrictions: isolation-container, allow-stderr diff --git a/debian/tests/nesttest b/debian/tests/nesttest new file mode 100755 index 0000000..9db00f7 --- /dev/null +++ b/debian/tests/nesttest @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +/sbin/start-stop-daemon --start --background --pidfile "$AUTOPKGTEST_TMP"/mock_nest_rest_server.pid --make-pidfile --startas `pwd`/debian/tests/nesttest_data/mock_nest_rest_server.py + +sleep 10 + +echo 'WN268AH3' | nodejs debian/tests/nesttest_data/nest_test.js + +sleep 10 + +/sbin/start-stop-daemon --stop --pidfile "$AUTOPKGTEST_TMP"/mock_nest_rest_server.pid --remove-pidfile --retry=TERM/30/KILL/5 diff --git a/debian/tests/nesttest_data/mock_nest_rest_server.py b/debian/tests/nesttest_data/mock_nest_rest_server.py new file mode 100755 index 0000000..75cf4bd --- /dev/null +++ b/debian/tests/nesttest_data/mock_nest_rest_server.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python3 + +import flask +import flask_restful +from flask_restful import reqparse +import uuid + +fakepincode = 'WN268AH3' +accesstoken = 'c.fCJC0MzwLlj9mWVU8OsxYRw1OmHLyvUSarFx7wjYlDmx2B0p7Rlg8VcT8eiLtua0UwBWRhaOHCKkzgam0JwJv5AUTV2qinYWsSzLF9Qz8Py5KSwjyV4L2os2KlnkNebauMkXlmP1sfs8HdPc' +app = flask.Flask(__name__) +api = flask_restful.Api(app) + + +class GetFakePincode(flask_restful.Resource): + def get(self): + result = {'fakepincode': fakepincode} + return result + + def put(self): + parser = flask_restful.reqparse.RequestParser() + parser.add_argument('fakepincode') + args = parser.parse_args() + result = {'fakepincode': args['fakepincode']} + fakepincode = args['fakepincode'] + return result, 201 + +class AccessToken(flask_restful.Resource): + def post(self): + parser = flask_restful.reqparse.RequestParser() + parser.add_argument('code') + parser.add_argument('client_id') + parser.add_argument('client_secret') + parser.add_argument('grant_type') + args = parser.parse_args() + instanceID = str(uuid.uuid1()) + if (args['code'] != fakepincode): + result = { 'error': 'oauth2_error', + 'error_description': 'authorization code not found', + 'instance_id': instanceID } + return result,201 + result = {'access_token': accesstoken, 'expires_in': 315360000} + return result, 201 + +class ListCamera(flask_restful.Resource): + def get(self): + parser = flask_restful.reqparse.RequestParser() + parser.add_argument('Authorization', type=str, location='headers') + args = parser.parse_args() + print(args); + instanceID = str(uuid.uuid1()) + if (args['Authorization'] != 'Bearer '+accesstoken): + result = { 'error': 'unauthorized', + 'type': 'https://developer.nest.com/documentation/cloud/error-messages#auth-error', + 'message': 'unauthorized', + 'instance_id': instanceID } + return result,201 + + result = { + 'devices': { + 'cameras': { + '7lHyGwOIZ7bMmQPPVfYqs5PVlaoU3rx0wanU19-QRBSoK3DwZ1XaMw': { + 'name': 'Office', + 'software_version': '205-600055', + 'where_id': 'BRfAR8DqNjP4wgeCHJMXB6T8h5sM_oWcFbw4BdgS4lXxRlwbCdX9wQ', + 'device_id': '7lHyGwOIZ7bMmQPPVfYqs5PVlaoU3rx0wanU19-QRBSoK3DwZ1XaMw', + 'structure_id': 'T9L9obNI8LxtBghzreo0rj8VHxLowV0WPFpxpqhKygR--PRqEyT1DA', + 'is_online': 'true', + 'is_streaming': 'false', + 'is_audio_input_enabled': 'true', + 'last_is_online_change': '2017-09-27T16:28:18.000Z', + 'is_video_history_enabled': 'true', + 'is_public_share_enabled': 'true', + 'last_event': { + 'has_sound': 'false', + 'has_motion': 'true', + 'has_person': 'false', + 'start_time': '2017-09-27T16:27:43.410Z', + 'end_time': '2017-09-27T16:27:45.320Z', + 'urls_expire_time': '2017-10-07T16:27:43.410Z', + 'web_url': 'https://home.nest.com/cameras/CjY3bEh5R3dPSVo3Yk1tUVBQVmZZcXM1UFZsYW9VM3J4MHdhblUxOS1RUkJTb0szRHdaMVhhTXcSFmpSZlBmTnRnYVFBbkRPdmIyVEpPM0EaNkVycmw0a3pqMVZ3am15bnpQZlBHLVVtV1hqNmFIWmppY2FUTWdLcl9nY05abEpLTWVRM0ZfQQ/cuepoints/kfM23u5xqKPjz4mgo6oYfQ?auth=815fOF6Lsj2jLh_-xNglQuf5zt3OAh2M0MaGd9didhborxrTRiDAlKNnPBwmaN0innrbFj_zVjuw4zfxbCOh8fhpoc5D6hkglpEhHQAjyCT0Sjchwp3MB2a7dLlfr58a63X5dD3dRMtin8uGXSos98HpbAb68RaArXcoaRDR7nBnN43IWWjoYxx0ub-dssyR_iXq19rZZD3xfo', + 'app_url': 'nestmobile://cameras/CjY3bEh5R3dPSVo3Yk1tUVBQVmZZcXM1UFZsYW9VM3J4MHdhblUxOS1RUkJTb0szRHdaMVhhTXcSFmpSZlBmTnRnYVFBbkRPdmIyVEpPM0EaNkVycmw0a3pqMVZ3am15bnpQZlBHLVVtV1hqNmFIWmppY2FUTWdLcl9nY05abEpLTWVRM0ZfQQ/cuepoints/kfM23u5xqKPjz4mgo6oYfQ?auth=815fOF6Lsj2jLh_-xNglQuf5zt3OAh2M0MaGd9didhborxrTRiDAlKNnPBwmaN0innrbFj_zVjuw4zfxbCOh8fhpoc5D6hkglpEhHQAjyCT0Sjchwp3MB2a7dLlfr58a63X5dD3dRMtin8uGXSos98HpbAb68RaArXcoaRDR7nBnN43IWWjoYxx0ub-dssyR_iXq19rZZD3xfo', + 'image_url': 'https://www.dropcam.com/api/wwn.get_image/CjY3bEh5R3dPSVo3Yk1tUVBQVmZZcXM1UFZsYW9VM3J4MHdhblUxOS1RUkJTb0szRHdaMVhhTXcSFmpSZlBmTnRnYVFBbkRPdmIyVEpPM0EaNkVycmw0a3pqMVZ3am15bnpQZlBHLVVtV1hqNmFIWmppY2FUTWdLcl9nY05abEpLTWVRM0ZfQQ/xTXo_qxXgXUzVAcxyPsYWvyE8GP18NtW?auth=815fOF6Lsj2jLh_-xNglQuf5zt3OAh2M0MaGd9didhborxrTRiDAlKNnPBwmaN0innrbFj_zVjuw4zfxbCOh8fhpoc5D6hkglpEhHQAjyCT0Sjchwp3MB2a7dLlfr58a63X5dD3dRMtin8uGXSos98HpbAb68RaArXcoaRDR7nBnN43IWWjoYxx0ub-dssyR_iXq19rZZD3xfo', + 'animated_image_url': 'https://www.dropcam.com/api/wwn.get_animated_image/CjY3bEh5R3dPSVo3Yk1tUVBQVmZZcXM1UFZsYW9VM3J4MHdhblUxOS1RUkJTb0szRHdaMVhhTXcSFmpSZlBmTnRnYVFBbkRPdmIyVEpPM0EaNkVycmw0a3pqMVZ3am15bnpQZlBHLVVtV1hqNmFIWmppY2FUTWdLcl9nY05abEpLTWVRM0ZfQQ/xTXo_qxXgXUzVAcxyPsYWvyE8GP18NtW?auth=815fOF6Lsj2jLh_-xNglQuf5zt3OAh2M0MaGd9didhborxrTRiDAlKNnPBwmaN0innrbFj_zVjuw4zfxbCOh8fhpoc5D6hkglpEhHQAjyCT0Sjchwp3MB2a7dLlfr58a63X5dD3dRMtin8uGXSos98HpbAb68RaArXcoaRDR7nBnN43IWWjoYxx0ub-dssyR_iXq19rZZD3xfo' + }, + 'where_name': 'Office', + 'name_long': 'Office Camera', + 'web_url': 'https://home.nest.com/cameras/CjY3bEh5R3dPSVo3Yk1tUVBQVmZZcXM1UFZsYW9VM3J4MHdhblUxOS1RUkJTb0szRHdaMVhhTXcSFmpSZlBmTnRnYVFBbkRPdmIyVEpPM0EaNkVycmw0a3pqMVZ3am15bnpQZlBHLVVtV1hqNmFIWmppY2FUTWdLcl9nY05abEpLTWVRM0ZfQQ?auth=815fOF6Lsj2jLh_-xNglQuf5zt3OAh2M0MaGd9didhborxrTRiDAlKNnPBwmaN0innrbFj_zVjuw4zfxbCOh8fhpoc5D6hkglpEhHQAjyCT0Sjchwp3MB2a7dLlfr58a63X5dD3dRMtin8uGXSos98HpbAb68RaArXcoaRDR7nBnN43IWWjoYxx0ub-dssyR_iXq19rZZD3xfo', + 'app_url': 'nestmobile://cameras/CjY3bEh5R3dPSVo3Yk1tUVBQVmZZcXM1UFZsYW9VM3J4MHdhblUxOS1RUkJTb0szRHdaMVhhTXcSFmpSZlBmTnRnYVFBbkRPdmIyVEpPM0EaNkVycmw0a3pqMVZ3am15bnpQZlBHLVVtV1hqNmFIWmppY2FUTWdLcl9nY05abEpLTWVRM0ZfQQ?auth=815fOF6Lsj2jLh_-xNglQuf5zt3OAh2M0MaGd9didhborxrTRiDAlKNnPBwmaN0innrbFj_zVjuw4zfxbCOh8fhpoc5D6hkglpEhHQAjyCT0Sjchwp3MB2a7dLlfr58a63X5dD3dRMtin8uGXSos98HpbAb68RaArXcoaRDR7nBnN43IWWjoYxx0ub-dssyR_iXq19rZZD3xfo', + 'public_share_url': 'https://video.nest.com/live/w4o0ZjxQLX', + 'snapshot_url': 'https://www.dropcam.com/api/wwn.get_snapshot/CjY3bEh5R3dPSVo3Yk1tUVBQVmZZcXM1UFZsYW9VM3J4MHdhblUxOS1RUkJTb0szRHdaMVhhTXcSFmpSZlBmTnRnYVFBbkRPdmIyVEpPM0EaNkVycmw0a3pqMVZ3am15bnpQZlBHLVVtV1hqNmFIWmppY2FUTWdLcl9nY05abEpLTWVRM0ZfQQ?auth=815fOF6Lsj2jLh_-xNglQuf5zt3OAh2M0MaGd9didhborxrTRiDAlKNnPBwmaN0innrbFj_zVjuw4zfxbCOh8fhpoc5D6hkglpEhHQAjyCT0Sjchwp3MB2a7dLlfr58a63X5dD3dRMtin8uGXSos98HpbAb68RaArXcoaRDR7nBnN43IWWjoYxx0ub-dssyR_iXq19rZZD3xfo' + } + } + }, + 'structures': { + 'T9L9obNI8LxtBghzreo0rj8VHxLowV0WPFpxpqhKygR--PRqEyT1DA': { + 'name': 'Office1', + 'country_code': 'US', + 'postal_code': '35004', + 'time_zone': 'America/Chicago', + 'away': 'home', + 'structure_id': 'T9L9obNI8LxtBghzreo0rj8VHxLowV0WPFpxpqhKygR--PRqEyT1DA', + 'rhr_enrollment': 'false', + 'eta_begin': '1970-01-01T00:00:00.000Z', + } + }, + 'metadata': { + 'access_token': accesstoken, + 'client_version': 2, + 'user_id': 'z.1.1.5F24Y1m5X0WN0q1jnKSV/2RAcleKMzh7ase8Cs6Vpp8=' + } + } + return result, 201 + + +if __name__ == '__main__': + api.add_resource(GetFakePincode, '/fakepincode') + api.add_resource(AccessToken, '/oauth2/access_token') + api.add_resource(ListCamera, '/') + + app.run(port=14253) diff --git a/debian/tests/nesttest_data/nest_test.js b/debian/tests/nesttest_data/nest_test.js new file mode 100644 index 0000000..eebd8d7 --- /dev/null +++ b/debian/tests/nesttest_data/nest_test.js @@ -0,0 +1,64 @@ +var Client = require('node-rest-client').Client; +const readline = require('readline'); +const { v1: uuidv1 } = require('uuid') + +const PRODUCTID='904b7e35-33c8-45c6-8fd1-f5807b68f8e6'; +const PRODUCTSECRET='bKN0NYfkkVHQx78A8rFCjS0z'; +const AUTHORIZATIONURL='https://home.nest.com/login/oauth2?client_id=PRODUCTID&state=STATE'; + +var CLIENTSTATE=uuidv1().replace(/-/g,''); +var PINCODE=''; +var ACCESSTOKEN=''; +//const NEST_API_URL = 'https://developer-api.nest.com'; +//const TOKEN_API_URL = 'https://api.home.nest.com/oauth2/access_token'; +const NEST_API_URL = 'http://localhost:14253'; +const TOKEN_API_URL = 'http://localhost:14253/oauth2/access_token'; + +console.log(AUTHORIZATIONURL.replace('STATE',CLIENTSTATE).replace('PRODUCTID',PRODUCTID)); + +const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout +}); + +rl.question('PINCODE? ', (answer) => { + PINCODE = answer; + var client = new Client(); + var args = { + headers: { + "content-type": "application/x-www-form-urlencoded" + }, + parameters: { + code: PINCODE, + client_id: PRODUCTID, + client_secret: PRODUCTSECRET, + grant_type: 'authorization_code' + } + } + client.post(TOKEN_API_URL, args, function(data, response) { + ACCESSTOKEN = data.access_token; + + var client = new Client(); + var args = { + headers: { + "Authorization": 'Bearer ' + ACCESSTOKEN + } + }; + + client.get(NEST_API_URL, args, function (data, response) { + var cameras=data.devices.cameras; + + for (i=0; i<Object.keys(cameras).length; i++) { + var cameraID = Object.keys(cameras)[i]; + var snapshotURL = cameras[cameraID].snapshot_url; + var webURL = cameras[cameraID].web_url; + console.log(cameraID+" snapshot_url: "+snapshotURL); + console.log(cameraID+" web_url: "+webURL); + } + }); + + rl.close(); + + }); +}); + diff --git a/debian/upstream/metadata b/debian/upstream/metadata new file mode 100644 index 0000000..bd91d43 --- /dev/null +++ b/debian/upstream/metadata @@ -0,0 +1,4 @@ +Bug-Database: https://github.com/aacerox/node-rest-client/issues +Bug-Submit: https://github.com/aacerox/node-rest-client/issues/new +Repository: https://github.com/aacerox/node-rest-client.git +Repository-Browse: https://github.com/aacerox/node-rest-client diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..2600aa3 --- /dev/null +++ b/debian/watch @@ -0,0 +1,5 @@ +version=4 +# It is not recommended use npmregistry. Please investigate more. +# Take a look at https://wiki.debian.org/debian/watch/ +opts="searchmode=plain,pgpmode=none" \ + https://registry.npmjs.org/node-rest-client https://registry.npmjs.org/node-rest-client/-/node-rest-client-(\d[\d\.]*)@ARCHIVE_EXT@ |