You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+49-16Lines changed: 49 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -36,28 +36,61 @@ Please note that this library is still under development. Although it's function
36
36
<pre><code>npm install cloudways-js-client
37
37
</code></pre>
38
38
39
-
<h2>Usage</h2>
39
+
<h2>Usage</h2>
40
+
<p>The Cloudways JS Client library makes it easy to interact with the Cloudways API for various operations. Below are some examples to help you get started.</p>
40
41
41
-
<p>
42
-
To get you started, here's an example that demonstrates how to get the status of a background operation using the "Get Operation Status" function:
43
-
</p>
42
+
<h3>Initializing the API</h3>
43
+
<p>Before performing any operations, initialize the API with your Cloudways account credentials:</p>
44
+
<div class="code-title">JavaScript:</div>
45
+
<pre><code>import { initializeCloudwaysApi } from 'cloudways-js-client';
44
46
45
-
<pre><code>import { getOperationStatus, GetOperationStatusRequest } from 'cloudways-js-client';
47
+
const email = '[email protected]'; // Replace with your Cloudways account email
48
+
const apiKey = 'your_api_key'; // Replace with your Cloudways API key
49
+
50
+
initializeCloudwaysApi(email, apiKey);
51
+
</code></pre>
52
+
53
+
<h3>Deleting a Server</h3>
54
+
<p>To delete a server, use the <code>deleteServer</code> function. Ensure you have the correct server ID:</p>
55
+
<div class="code-title">JavaScript:</div>
56
+
<pre><code>import { deleteServer } from 'cloudways-js-client';
57
+
58
+
async function deleteServerA() {
59
+
const serverId = 12345; // Replace with the server ID you want to delete
60
+
await deleteServer(serverId);
61
+
console.log('Server deleted successfully.');
62
+
}
63
+
</code></pre>
64
+
65
+
<h3>Getting the List of Servers</h3>
66
+
<p>You can retrieve the list of servers associated with your account using the <code>getServersList</code> function:</p>
67
+
<div class="code-title">JavaScript:</div>
68
+
<pre><code>import { getServersList } from 'cloudways-js-client';
0 commit comments