UNPKG

7.26 kBMarkdownView Raw
1## Classes
2<dl>
3<dt><a href="#Sandbox">Sandbox</a></dt>
4<dd></dd>
5<dt><a href="#Webtask">Webtask</a></dt>
6<dd></dd>
7</dl>
8## Functions
9<dl>
10<dt><a href="#create">create(codeOrUrl, [options], [cb])</a><code>Promise</code></dt>
11<dd><p>Create a Webtask from the given options</p>
12</dd>
13<dt><a href="#create">create(claims, [cb])</a><code>Promise</code></dt>
14<dd><p>Create a Webtask from the given claims</p>
15</dd>
16<dt><a href="#createUrl">createUrl(options, [cb])</a><code>Promise</code></dt>
17<dd><p>Shortcut to create a Webtask and get its url from the given options</p>
18</dd>
19<dt><a href="#run">run([codeOrUrl], [options], [cb])</a><code>Promise</code></dt>
20<dd><p>Shortcut to create and run a Webtask from the given options</p>
21</dd>
22<dt><a href="#createToken">createToken(options, [cb])</a><code>Promise</code></dt>
23<dd><p>Create a webtask token - A JWT (see: <a href="http://jwt.io">http://jwt.io</a>) with the supplied options</p>
24</dd>
25<dt><a href="#createToken">createToken(claims, [cb])</a><code>Promise</code></dt>
26<dd><p>Create a webtask token - A JWT (see: <a href="http://jwt.io">http://jwt.io</a>) with the supplied claims</p>
27</dd>
28<dt><a href="#createLogStream">createLogStream(options)</a><code>Stream</code></dt>
29<dd><p>Create a stream of logs from the webtask container</p>
30<p>Note that the logs will include messages from our infrastructure.</p>
31</dd>
32<dt><a href="#createLogStream">createLogStream(options)</a><code>Stream</code></dt>
33<dd><p>Create a stream of logs from the webtask container</p>
34<p>Note that the logs will include messages from our infrastructure.</p>
35</dd>
36</dl>
37<a name="Sandbox"></a>
38## Sandbox
39**Kind**: global class
40<a name="new_Sandbox_new"></a>
41### new Sandbox(options)
42Creates an object representing a user's webtask.io credentials
43
44
45| Param | Type | Description |
46| --- | --- | --- |
47| options | <code>Object</code> | Options used to configure the profile |
48| options.url | <code>String</code> | The url of the webtask cluster where code will run |
49| options.container | <code>String</code> | The name of the container in which code will run |
50| options.token | <code>String</code> | The JWT (see: http://jwt.io) issued by webtask.io that grants rights to run code in the indicated container |
51
52<a name="Webtask"></a>
53## Webtask
54**Kind**: global class
55
56* [Webtask](#Webtask)
57 * [new Webtask()](#new_Webtask_new)
58 * [.run(options, [cb])](#Webtask+run) ⇒ <code>Promise</code>
59
60<a name="new_Webtask_new"></a>
61### new Webtask()
62Creates an object representing a Webtask
63
64<a name="Webtask+run"></a>
65### webtask.run(options, [cb]) ⇒ <code>Promise</code>
66Run the webtask and return the result of execution
67
68**Kind**: instance method of <code>[Webtask](#Webtask)</code>
69
70| Param | Type | Description |
71| --- | --- | --- |
72| options | <code>Object</code> | Options used to tweak how the webtask will be invoked |
73| [cb] | <code>function</code> | Optional node-style callback that will be invoked upon completion |
74
75<a name="create"></a>
76## create(codeOrUrl, [options], [cb]) ⇒ <code>Promise</code>
77Create a Webtask from the given options
78
79**Kind**: global function
80**Returns**: <code>Promise</code> - A Promise that will be fulfilled with the token
81
82| Param | Type | Description |
83| --- | --- | --- |
84| codeOrUrl | <code>String</code> | The code for the webtask or a url starting with http:// or https:// |
85| [options] | <code>Object</code> | Options for creating the webtask |
86| [cb] | <code>function</code> | Optional callback function for node-style callbacks |
87
88<a name="create"></a>
89## create(claims, [cb]) ⇒ <code>Promise</code>
90Create a Webtask from the given claims
91
92**Kind**: global function
93**Returns**: <code>Promise</code> - A Promise that will be fulfilled with the token
94
95| Param | Type | Description |
96| --- | --- | --- |
97| claims | <code>Object</code> | Options for creating the webtask |
98| [cb] | <code>function</code> | Optional callback function for node-style callbacks |
99
100<a name="createUrl"></a>
101## createUrl(options, [cb]) ⇒ <code>Promise</code>
102Shortcut to create a Webtask and get its url from the given options
103
104**Kind**: global function
105**Returns**: <code>Promise</code> - A Promise that will be fulfilled with the token
106
107| Param | Type | Description |
108| --- | --- | --- |
109| options | <code>Object</code> | Options for creating the webtask |
110| [cb] | <code>function</code> | Optional callback function for node-style callbacks |
111
112<a name="run"></a>
113## run([codeOrUrl], [options], [cb]) ⇒ <code>Promise</code>
114Shortcut to create and run a Webtask from the given options
115
116**Kind**: global function
117**Returns**: <code>Promise</code> - A Promise that will be fulfilled with the token
118
119| Param | Type | Description |
120| --- | --- | --- |
121| [codeOrUrl] | <code>String</code> | The code for the webtask or a url starting with http:// or https:// |
122| [options] | <code>Object</code> | Options for creating the webtask |
123| [cb] | <code>function</code> | Optional callback function for node-style callbacks |
124
125<a name="createToken"></a>
126## createToken(options, [cb]) ⇒ <code>Promise</code>
127Create a webtask token - A JWT (see: http://jwt.io) with the supplied options
128
129**Kind**: global function
130**Returns**: <code>Promise</code> - A Promise that will be fulfilled with the token
131
132| Param | Type | Description |
133| --- | --- | --- |
134| options | <code>Object</code> | Claims to make for this token (see: https://webtask.io/docs/api_issue) |
135| [cb] | <code>function</code> | Optional callback function for node-style callbacks |
136
137<a name="createToken"></a>
138## createToken(claims, [cb]) ⇒ <code>Promise</code>
139Create a webtask token - A JWT (see: http://jwt.io) with the supplied claims
140
141**Kind**: global function
142**Returns**: <code>Promise</code> - A Promise that will be fulfilled with the token
143
144| Param | Type | Description |
145| --- | --- | --- |
146| claims | <code>Object</code> | Claims to make for this token (see: https://webtask.io/docs/api_issue) |
147| [cb] | <code>function</code> | Optional callback function for node-style callbacks |
148
149<a name="createLogStream"></a>
150## createLogStream(options) ⇒ <code>Stream</code>
151Create a stream of logs from the webtask container
152
153Note that the logs will include messages from our infrastructure.
154
155**Kind**: global function
156**Returns**: <code>Stream</code> - A stream that will emit 'data' events with container logs
157
158| Param | Type | Description |
159| --- | --- | --- |
160| options | <code>Object</code> | Streaming options overrides |
161| [options.container] | <code>String</code> | The container for which you would like to stream logs. Defaults to the current profile's container. |
162
163<a name="createLogStream"></a>
164## createLogStream(options) ⇒ <code>Stream</code>
165Create a stream of logs from the webtask container
166
167Note that the logs will include messages from our infrastructure.
168
169**Kind**: global function
170**Returns**: <code>Stream</code> - A stream that will emit 'data' events with container logs
171
172| Param | Type | Description |
173| --- | --- | --- |
174| options | <code>Object</code> | Streaming options overrides |
175| [options.container] | <code>String</code> | The container for which you would like to stream logs. Defaults to the current profile's container. |
176