From bcd57d0e53e474251e16ab2141ba80843b362333 Mon Sep 17 00:00:00 2001 From: Hans-Peter Herzog Date: Wed, 9 Nov 2016 12:03:29 +0100 Subject: [PATCH] TT#2723 Javascript syntax highlighting in README Change-Id: Ie7c4732c37bdaa420b6039d393b440a74072a194 --- README.md | 147 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 85 insertions(+), 62 deletions(-) diff --git a/README.md b/README.md index ffb48fe..a12e959 100644 --- a/README.md +++ b/README.md @@ -5,104 +5,127 @@ JanusAdmin is a node.js http client, that implements the entire admin interface Usage ------------- +```javascript +var JanusAdmin = require('janus-admin').JanusAdmin; + +var admin = new JanusAdmin({ + url: 'http://janus-admin:7088', + secret: '*****' +}); +``` - var JanusAdmin = require('janus-admin').JanusAdmin; - - var admin = new JanusAdmin({ - url: 'http://janus-admin:7088', - secret: '*****' - }); - Methods --------------- ### List sessions - admin.listSessions().then((res)=>{ - console.log(res.sessions) - }).catch((err)=>{ - ... - }); +```javascript +admin.listSessions().then((res)=>{ + console.log(res.sessions) +}).catch((err)=>{ + ... +}); +``` ### List handles - admin.listHandles(sessionId).then((res)=>{ - console.log(res.handles) - }).catch((err)=>{ - ... - }); +```javascript +admin.listHandles(sessionId).then((res)=>{ + console.log(res.handles) +}).catch((err)=>{ + ... +}); +``` ### Show single handle - admin.handleInfo(sessionId, handleId).then((res)=>{ - console.log(res.info) - }).catch((err)=>{ - ... - }); +```javascript +admin.handleInfo(sessionId, handleId).then((res)=>{ + console.log(res.info) +}).catch((err)=>{ + ... +}); +``` ### Set the log level - admin.setLogLevel([0...7]).then((res)=>{ - console.log(res.level) - }).catch((err)=>{ - ... - }); +```javascript +admin.setLogLevel([0...7]).then((res)=>{ + console.log(res.level) +}).catch((err)=>{ + ... +}); +``` ### Set locking debug - admin.setLockingDebug([0,1]).then((res)=>{ - console.log(res.debug) - }).catch((err)=>{ - ... - }); +```javascript +admin.setLockingDebug([0,1]).then((res)=>{ + console.log(res.debug) +}).catch((err)=>{ + ... +}); +``` Methods (token based authentication) ------------------------------------ ### Add token - admin.addToken(token).then((res)=>{ - console.log(res.plugins); - }).catch((err)=>{ - ... - }); +```javascript +admin.addToken(token).then((res)=>{ + console.log(res.plugins); +}).catch((err)=>{ + ... +}); +``` ### Allow token - admin.allowToken(token, plugins).then((res)=>{ - console.log(res.plugins); - }).catch((err)=>{ - ... - }); +```javascript +admin.allowToken(token, plugins).then((res)=>{ + console.log(res.plugins); +}).catch((err)=>{ + ... +}); +``` ### Disallow token - admin.disallowToken(token, plugins).then((res)=>{ - console.log(res.plugins); - }).catch((err)=>{ - ... - }); +```javascript +admin.disallowToken(token, plugins).then((res)=>{ + console.log(res.plugins); +}).catch((err)=>{ + ... +}); +``` ### List all tokens - admin.listTokens().then((res)=>{ - console.log(res.tokens); - }).catch((err)=>{ - ... - }); +```javascript +admin.listTokens().then((res)=>{ + console.log(res.tokens); +}).catch((err)=>{ + ... +}); +``` ### Remove token - adminClient.removeToken(token).then((res)=>{ - ... - }).catch((err)=>{ - ... - }); +```javascript +adminClient.removeToken(token).then((res)=>{ + ... +}).catch((err)=>{ + ... +}); +``` ### Remove all tokens - adminClient.removeAllTokens().then((res)=>{ - ... - }).catch((err)=>{ - ... - }); +```javascript +adminClient.removeAllTokens().then((res)=>{ + ... +}).catch((err)=>{ + ... +}); +```