mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-06-01 15:30:43 +00:00
301 lines
7.4 KiB
HTML
301 lines
7.4 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset='UTF-8'>
|
|
<title>CoffeeScript API Documentation</title>
|
|
<script src='../../../../javascript/application.js'></script>
|
|
<script src='../../../../javascript/search.js'></script>
|
|
<link rel='stylesheet' href='../../../../stylesheets/application.css' type='text/css'>
|
|
</head>
|
|
<body>
|
|
<div id='base' data-path='../../../../'></div>
|
|
<div id='header'>
|
|
<div id='menu'>
|
|
<a href='../../../../alphabetical_index.html' title='Index'>
|
|
Index
|
|
</a>
|
|
»
|
|
<span class='title'>lib</span>
|
|
»
|
|
<span class='title'>resin</span>
|
|
»
|
|
<span class='title'>server</span>
|
|
»
|
|
<span class='title'>server.coffee</span>
|
|
</div>
|
|
</div>
|
|
<div id='content'>
|
|
<h1>
|
|
File:
|
|
server.coffee
|
|
</h1>
|
|
<table class='box'>
|
|
<tr>
|
|
<td>Defined in:</td>
|
|
<td>lib/resin/server</td>
|
|
</tr>
|
|
</table>
|
|
<h2>Method Summary</h2>
|
|
<ul class='summary'>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#request-'>
|
|
~
|
|
(void)
|
|
<b>request</b><span>(options = {}, outerCallback, onProgress)</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
Send an HTTP request to resin.io <pre><code>resin.server.request { method: 'GET' url: '/foobar'
|
|
}, (error, response, body) -> throw error if error? console.log(body)
|
|
|
|
resin.server.request { method: 'POST' url: '/foobar' json:
|
|
name: 'My FooBar'
|
|
}, (error, response, body) -> throw error if error? assert(response.statusCode is 201)
|
|
|
|
resin.server.request { method: 'GET' url: '/download' pipe: fs.createWriteStream('/tmp/download')
|
|
}, (error) -> throw error if error?
|
|
, (state) -> console.log("Received: #{state.received}") console.log("Total: #{state.total}") console.log("Is Complete? #{state.complete}")
|
|
</code></pre>
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#createFacadeFunction-'>
|
|
~
|
|
(void)
|
|
<b>createFacadeFunction</b><span>(method)</span>
|
|
</a>
|
|
</span>
|
|
<span class='note private title'>Private</span>
|
|
<span class='desc'>
|
|
Generate shorthand functions for every method
|
|
</span>
|
|
</li>
|
|
</ul>
|
|
<h2>Method Details</h2>
|
|
<div class='methods'>
|
|
<div class='method_details'>
|
|
<p class='signature' id='request-'>
|
|
~
|
|
(void)
|
|
<b>request</b><span>(options = {}, outerCallback, onProgress)</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<div class='note'>
|
|
<strong>Note:</strong>
|
|
If the user is logged in, the token gets automatically added to Authorization header
|
|
</div>
|
|
<div class='note'>
|
|
<strong>Note:</strong>
|
|
If the response is JSON, it will attempt to parse it
|
|
</div>
|
|
<p>Send an HTTP request to resin.io</p><pre><code>resin.server.request { method: 'GET' url: '/foobar'
|
|
}, (error, response, body) -> throw error if error? console.log(body)
|
|
|
|
resin.server.request { method: 'POST' url: '/foobar' json:
|
|
name: 'My FooBar'
|
|
}, (error, response, body) -> throw error if error? assert(response.statusCode is 201)
|
|
|
|
resin.server.request { method: 'GET' url: '/download' pipe: fs.createWriteStream('/tmp/download')
|
|
}, (error) -> throw error if error?
|
|
, (state) -> console.log("Received: #{state.received}") console.log("Total: #{state.total}") console.log("Is Complete? #{state.complete}")
|
|
</code></pre>
|
|
</div>
|
|
<div class='tags'>
|
|
<h3>Parameters:</h3>
|
|
<ul class='param'>
|
|
<li>
|
|
<span class='name'>options</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>Object</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>request options </span>
|
|
</li>
|
|
<li>
|
|
<span class='name'>callback</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>Function</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>callback(error, response, body) </span>
|
|
</li>
|
|
<li>
|
|
<span class='name'>onProgress</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>Function</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>on progress callback(state) (optional) </span>
|
|
</li>
|
|
</ul>
|
|
<h3>
|
|
Options Hash:
|
|
(options):
|
|
</h3>
|
|
<ul class='options'>
|
|
<li>
|
|
<span class='name'>url</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>relative url </span>
|
|
</li>
|
|
<li>
|
|
<span class='name'>json</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>request body </span>
|
|
</li>
|
|
<li>
|
|
<span class='name'>method</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>HTTP method </span>
|
|
</li>
|
|
<li>
|
|
<span class='name'>headers</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>Object</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>custom HTTP headers </span>
|
|
</li>
|
|
<li>
|
|
<span class='name'>pipe</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>Function</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>define this function if you want to stream the response </span>
|
|
</li>
|
|
</ul>
|
|
<h3>Throws:</h3>
|
|
<ul class='throw'>
|
|
<li>
|
|
<span class='type'></span>
|
|
(
|
|
<tt>Error</tt>
|
|
)
|
|
—
|
|
<span class='desc'>Will throw if you don't have internet connection </span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='createFacadeFunction-'>
|
|
~
|
|
(void)
|
|
<b>createFacadeFunction</b><span>(method)</span>
|
|
<span class='note private'>Private</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<div class='note todo'>
|
|
<strong>TODO:</strong>
|
|
Find a way to document all of the methods directly
|
|
</div>
|
|
<p>Generate shorthand functions for every method</p>
|
|
</div>
|
|
<div class='tags'>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id='footer'>
|
|
December 09, 14 12:47:37 by
|
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
|
Codo
|
|
</a>
|
|
2.0.9
|
|
✲
|
|
Press H to see the keyboard shortcuts
|
|
✲
|
|
<a href='http://twitter.com/netzpirat' target='_parent'>@netzpirat</a>
|
|
✲
|
|
<a href='http://twitter.com/_inossidabile' target='_parent'>@_inossidabile</a>
|
|
</div>
|
|
<iframe id='search_frame'></iframe>
|
|
<div id='fuzzySearch'>
|
|
<input type='text'>
|
|
<ol></ol>
|
|
</div>
|
|
<div id='help'>
|
|
<p>
|
|
Quickly fuzzy find classes, mixins, methods, file:
|
|
</p>
|
|
<ul>
|
|
<li>
|
|
<span>T</span>
|
|
Open fuzzy finder dialog
|
|
</li>
|
|
</ul>
|
|
<p>
|
|
Control the navigation frame:
|
|
</p>
|
|
<ul>
|
|
<li>
|
|
<span>L</span>
|
|
Toggle list view
|
|
</li>
|
|
<li>
|
|
<span>C</span>
|
|
Show class list
|
|
</li>
|
|
<li>
|
|
<span>I</span>
|
|
Show mixin list
|
|
</li>
|
|
<li>
|
|
<span>F</span>
|
|
Show file list
|
|
</li>
|
|
<li>
|
|
<span>M</span>
|
|
Show method list
|
|
</li>
|
|
<li>
|
|
<span>E</span>
|
|
Show extras list
|
|
</li>
|
|
</ul>
|
|
<p>
|
|
You can focus and blur the search input:
|
|
</p>
|
|
<ul>
|
|
<li>
|
|
<span>S</span>
|
|
Focus search input
|
|
</li>
|
|
<li>
|
|
<span>Esc</span>
|
|
Blur search input
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html> |