Skip to content
This repository was archived by the owner on Jun 6, 2023. It is now read-only.

Commit 684b76c

Browse files
committed
add scripts text method
1 parent c88a7f7 commit 684b76c

File tree

3 files changed

+159
-0
lines changed

3 files changed

+159
-0
lines changed

docs/scripts_text.js.html

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>scripts/text.js - Documentation</title>
6+
7+
<script src="scripts/prettify/prettify.js"></script>
8+
<script src="scripts/prettify/lang-css.js"></script>
9+
<!--[if lt IE 9]>
10+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11+
<![endif]-->
12+
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
13+
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
14+
</head>
15+
<body>
16+
17+
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
18+
<label for="nav-trigger" class="navicon-button x">
19+
<div class="navicon"></div>
20+
</label>
21+
22+
<label for="nav-trigger" class="overlay"></label>
23+
24+
<nav>
25+
<h2><a href="index.html">Home</a></h2><h3>Namespaces</h3><ul><li><a href="machines.html">machines</a><ul class='methods'><li data-type='method'><a href="machines.html#.create">create</a></li><li data-type='method'><a href="machines.html#.destroy">destroy</a></li><li data-type='method'><a href="machines.html#.list">list</a></li><li data-type='method'><a href="machines.html#.restart">restart</a></li><li data-type='method'><a href="machines.html#.show">show</a></li><li data-type='method'><a href="machines.html#.start">start</a></li><li data-type='method'><a href="machines.html#.stop">stop</a></li><li data-type='method'><a href="machines.html#.waitfor">waitfor</a></li></ul></li><li><a href="networks.html">networks</a><ul class='methods'><li data-type='method'><a href="networks.html#.list">list</a></li></ul></li><li><a href="scripts.html">scripts</a><ul class='methods'><li data-type='method'><a href="scripts.html#.create">create</a></li><li data-type='method'><a href="scripts.html#.destroy">destroy</a></li><li data-type='method'><a href="scripts.html#.list">list</a></li><li data-type='method'><a href="scripts.html#.show">show</a></li><li data-type='method'><a href="scripts.html#.text">text</a></li></ul></li><li><a href="templates.html">templates</a><ul class='methods'><li data-type='method'><a href="templates.html#.list">list</a></li></ul></li><li><a href="users.html">users</a><ul class='methods'><li data-type='method'><a href="users.html#.list">list</a></li></ul></li></ul>
26+
</nav>
27+
28+
<div id="main">
29+
30+
<h1 class="page-title">scripts/text.js</h1>
31+
32+
33+
34+
35+
36+
37+
38+
<section>
39+
<article>
40+
<pre class="prettyprint source linenums"><code>'use strict';
41+
42+
var method = require('./../method');
43+
var assign = require('lodash.assign');
44+
45+
/**
46+
* @memberof scripts
47+
* @method text
48+
* @description Gets the text of the script with the given id.
49+
* @param {object} params - Script text parameters
50+
* @param {string} params.scriptId - Id of the script to get text for
51+
* @param {function} cb - Node-style error-first callback function
52+
* @returns {object} script - The script JSON object
53+
* @example
54+
* paperspace.scripts.text({
55+
* scriptId: 'sc123abc',
56+
* }, function(err, resp) {
57+
* // handle error or http response
58+
* });
59+
* @example
60+
* $ paperspace scripts text \
61+
* --scriptId "sc123abc"
62+
* @example
63+
* # HTTP request:
64+
* https://api.paperspace.io
65+
* GET /scripts/getScriptText?scriptId=sc123abc
66+
* x-api-key: 1ba4f98e7c0...
67+
* # Returns 200 on success
68+
* @example
69+
* //Example return value:
70+
* "services start nginx"
71+
*/
72+
73+
function text(params, cb) {
74+
return method(text, params, cb);
75+
}
76+
77+
assign(text, {
78+
auth: true,
79+
group: 'scripts',
80+
name: 'text',
81+
method: 'get',
82+
route: '/scripts/getScriptText',
83+
requires: {
84+
scriptId: 'string',
85+
},
86+
returns: {},
87+
});
88+
89+
module.exports = text;
90+
</code></pre>
91+
</article>
92+
</section>
93+
94+
95+
96+
97+
</div>
98+
99+
<br class="clear">
100+
101+
<footer>
102+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Jul 10 2017 00:32:10 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
103+
</footer>
104+
105+
<script>prettyPrint();</script>
106+
<script src="scripts/linenumber.js"></script>
107+
</body>
108+
</html>

lib/scripts/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ module.exports = {
99
destroy: require('./destroy'),
1010
list: require('./list'),
1111
show: require('./show'),
12+
text: require('./text'),
1213
//update: require('./update'),
1314
};

lib/scripts/text.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
'use strict';
2+
3+
var method = require('./../method');
4+
var assign = require('lodash.assign');
5+
6+
/**
7+
* @memberof scripts
8+
* @method text
9+
* @description Gets the text of the script with the given id.
10+
* @param {object} params - Script text parameters
11+
* @param {string} params.scriptId - Id of the script to get text for
12+
* @param {function} cb - Node-style error-first callback function
13+
* @returns {object} script - The script JSON object
14+
* @example
15+
* paperspace.scripts.text({
16+
* scriptId: 'sc123abc',
17+
* }, function(err, resp) {
18+
* // handle error or http response
19+
* });
20+
* @example
21+
* $ paperspace scripts text \
22+
* --scriptId "sc123abc"
23+
* @example
24+
* # HTTP request:
25+
* https://api.paperspace.io
26+
* GET /scripts/getScriptText?scriptId=sc123abc
27+
* x-api-key: 1ba4f98e7c0...
28+
* # Returns 200 on success
29+
* @example
30+
* //Example return value:
31+
* "services start nginx"
32+
*/
33+
34+
function text(params, cb) {
35+
return method(text, params, cb);
36+
}
37+
38+
assign(text, {
39+
auth: true,
40+
group: 'scripts',
41+
name: 'text',
42+
method: 'get',
43+
route: '/scripts/getScriptText',
44+
requires: {
45+
scriptId: 'string',
46+
},
47+
returns: {},
48+
});
49+
50+
module.exports = text;

0 commit comments

Comments
 (0)