Repository: saucelabs/node-saucelabs (js)

Issue:
Deprecated Tunnels REST API version is used
## Current behavior

The tool uses v1.1 tunnels REST API endpoint /available_tunnels to get all the tunnels for the user and their org.
The endpoint is a part of API version that Sauce Labs is planning to deprecate in the future.

## Desired behavior

Should use v1 tunnels REST API endpoint /tunnels?all=true&full=true to get all the tunnels for the user and their org.
The endpoint is a part of the supported API version.

Pull request:
Resolves #119
Resolves #119

Patch:
diff --git a/apis/sauce.json b/apis/sauce.json
index c511761..474b371 100644
--- a/apis/sauce.json
+++ b/apis/sauce.json
@@ -799,12 +799,19 @@
       "type":"string"
     },
     "full":{
-      "description":"Should the return result contain everything or just the basics",
+      "description":"Should the response result contain everything or just the basics",
       "in":"query",
       "name":"full",
       "required":false,
       "type":"boolean"
     },
+    "all":{
+      "description":"Should the response contain the same team user data",
+      "in":"query",
+      "name":"all",
+      "required":false,
+      "type":"boolean"
+    },
     "id":{
       "description":"job id",
       "in":"path",
@@ -1056,46 +1063,6 @@
         ]
       }
     },
-    "/v1.1/{username}/available_tunnels":{
-      "get":{
-        "operationId":"list_available_tunnels",
-        "parameters":[
-          {
-            "$ref":"#/parameters/username"
-          }
-        ],
-        "responses":{
-          "200":{
-            "description":"Tunnels",
-            "schema":{
-              "additionalProperties":{
-                "items":{
-                  "$ref":"#/definitions/Tunnel"
-                },
-                "type":"array"
-              },
-              "type":"object"
-            }
-          },
-          "404":{
-            "description":"User is not found",
-            "schema":{
-              "$ref":"#/definitions/Error"
-            }
-          },
-          "default":{
-            "description":"Unexpected error",
-            "schema":{
-              "$ref":"#/definitions/Error"
-            }
-          }
-        },
-        "summary":"Get Tunnels",
-        "tags":[
-          "Tunnel"
-        ]
-      }
-    },
     "/v1.1/{username}/builds":{
       "get":{
         "operationId":"list_builds",
@@ -2001,48 +1968,6 @@
         ]
       }
     },
-    "/v1/{username}/all_tunnels":{
-      "get":{
-        "operationId":"list_all_tunnels",
-        "parameters":[
-          {
-            "$ref":"#/parameters/username"
-          }
-        ],
-        "responses":{
-          "200":{
-            "description":"Tunnels",
-            "schema":{
-              "properties":{
-                "tunnels":{
-                  "items":{
-                    "$ref":"#/definitions/Tunnel"
-                  },
-                  "type":"array"
-                }
-              },
-              "type":"object"
-            }
-          },
-          "404":{
-            "description":"User is not found",
-            "schema":{
-              "$ref":"#/definitions/Error"
-            }
-          },
-          "default":{
-            "description":"Unexpected error",
-            "schema":{
-              "$ref":"#/definitions/Error"
-            }
-          }
-        },
-        "summary":"Get all Tunnels",
-        "tags":[
-          "Tunnel"
-        ]
-      }
-    },
     "/v1/{username}/builds/{id}/failed-jobs":{
       "get":{
         "operationId":"list_build_failed_jobs",
@@ -2230,6 +2155,48 @@
         ]
       }
     },
+    "/v1/{username}/all_tunnels":{
+      "get":{
+        "operationId":"list_all_tunnels",
+        "parameters":[
+          {
+            "$ref":"#/parameters/username"
+          }
+        ],
+        "responses":{
+          "200":{
+            "description":"Tunnels",
+            "schema":{
+              "properties":{
+                "tunnels":{
+                  "items":{
+                    "$ref":"#/definitions/Tunnel"
+                  },
+                  "type":"array"
+                }
+              },
+              "type":"object"
+            }
+          },
+          "404":{
+            "description":"User is not found",
+            "schema":{
+              "$ref":"#/definitions/Error"
+            }
+          },
+          "default":{
+            "description":"Unexpected error",
+            "schema":{
+              "$ref":"#/definitions/Error"
+            }
+          }
+        },
+        "summary":"Get all Tunnels",
+        "tags":[
+          "Tunnel"
+        ]
+      }
+    },
     "/v1/{username}/tunnels":{
       "get":{
         "operationId":"list_tunnels",
@@ -2237,6 +2204,9 @@
           {
             "$ref":"#/parameters/username"
           },
+          {
+            "$ref":"#/parameters/all"
+          },
           {
             "$ref":"#/parameters/full"
           }
@@ -2264,7 +2234,7 @@
             }
           }
         },
-        "summary":"Get Tunnels",
+        "summary":"Get tunnels for the user or all the users in the team",
         "tags":[
           "Tunnel"
         ]
@@ -2333,7 +2303,7 @@
             }
           }
         },
-        "summary":"Get Tunnels",
+        "summary":"Get Tunnel by ID",
         "tags":[
           "Tunnel"
         ]
diff --git a/docs/interface.md b/docs/interface.md
index d515e01..3778afb 100644
--- a/docs/interface.md
+++ b/docs/interface.md
@@ -29,14 +29,6 @@ The following commands are available via package or cli tool:
         <code>api.listUserOrganization(username)</code>
       </td>
     </tr>
-    <tr>
-      <td>
-        <b>GET</b> <code>/v1.1/{username}/available_tunnels</code><br>
-        No description available.
-        <h3>Example:</h3>
-        <code>api.listAvailableTunnels(username)</code>
-      </td>
-    </tr>
     <tr>
       <td>
         <b>GET</b> <code>/v1.1/{username}/builds</code><br>
@@ -53,7 +45,7 @@ The following commands are available via package or cli tool:
         <h3>Example:</h3>
         <code>api.listJobs(username, { ...options })</code>
         <br><h4>Options</h4>
-        <ul>          <li><b>limit</b>: Number of results to return</li>          <li><b>subaccounts</b>: Include subaccounts in list of jobs</li>          <li><b>full</b>: Should the return result contain everything or just the basics</li>          <li><b>manual_only</b>: Only return manual jobs</li>          <li><b>auto_only</b>: No description available.</li>          <li><b>name</b>: name of the job</li>          <li><b>owner_type</b>: owner type for jobs</li>          <li><b>owner</b>: username of owner of the jobs</li>          <li><b>from</b>: receive jobs beginning of a specific timestamp</li>          <li><b>to</b>: receive jobs until specific timestamp</li>        </ul>      </td>
+        <ul>          <li><b>limit</b>: Number of results to return</li>          <li><b>subaccounts</b>: Include subaccounts in list of jobs</li>          <li><b>full</b>: Should the response result contain everything or just the basics</li>          <li><b>manual_only</b>: Only return manual jobs</li>          <li><b>auto_only</b>: No description available.</li>          <li><b>name</b>: name of the job</li>          <li><b>owner_type</b>: owner type for jobs</li>          <li><b>owner</b>: username of owner of the jobs</li>          <li><b>from</b>: receive jobs beginning of a specific timestamp</li>          <li><b>to</b>: receive jobs until specific timestamp</li>        </ul>      </td>
     </tr>
     <tr>
       <td>
@@ -222,7 +214,7 @@ The following commands are available via package or cli tool:
         <h3>Example:</h3>
         <code>api.listBuildJobs(id, { ...options })</code>
         <br><h4>Options</h4>
-        <ul>          <li><b>full</b>: Should the return result contain everything or just the basics</li>        </ul>      </td>
+        <ul>          <li><b>full</b>: Should the response result contain everything or just the basics</li>        </ul>      </td>
     </tr>
     <tr>
       <td>
@@ -255,7 +247,7 @@ The following commands are available via package or cli tool:
         <h3>Example:</h3>
         <code>api.listTunnels(username, { ...options })</code>
         <br><h4>Options</h4>
-        <ul>          <li><b>full</b>: Should the return result contain everything or just the basics</li>        </ul>      </td>
+        <ul>          <li><b>all</b>: Should the response contain the same team user data</li>          <li><b>full</b>: Should the response result contain everything or just the basics</li>        </ul>      </td>
     </tr>
     <tr>
       <td>
@@ -743,7 +735,7 @@ This endpoint requires API Key authentication and will also return your private
         <b>GET</b> <code>/testSuites/{accountId}/{projectId}/getTestSuites</code><br>
         No description available.
         <h3>Example:</h3>
-        <code>api.getTestsuitesByProjects(projectId, accountId)</code>
+        <code>api.getTestsuitesByProjects(accountId, projectId)</code>
       </td>
     </tr>
     <tr>
@@ -762,6 +754,54 @@ This endpoint requires API Key authentication and will also return your private
         <code>api.executeTestsuiteTest(Body, projectId)</code>
       </td>
     </tr>
+    <tr>
+      <td>
+        <b>POST</b> <code>/v1/test_suite/create</code><br>
+        No description available.
+        <h3>Example:</h3>
+        <code>api.createTestSuite(Body)</code>
+      </td>
+    </tr>
+    <tr>
+      <td>
+        <b>POST</b> <code>/v1/test_suite/{testSuiteId}/update</code><br>
+        No description available.
+        <h3>Example:</h3>
+        <code>api.updateTestSuite(testSuiteId, Body)</code>
+      </td>
+    </tr>
+    <tr>
+      <td>
+        <b>POST</b> <code>/v1/testSuites/delete</code><br>
+        No description available.
+        <h3>Example:</h3>
+        <code>api.deleteTestSuites(Body)</code>
+      </td>
+    </tr>
+    <tr>
+      <td>
+        <b>POST</b> <code>/testCases/associate</code><br>
+        No description available.
+        <h3>Example:</h3>
+        <code>api.associateTestcases(Body)</code>
+      </td>
+    </tr>
+    <tr>
+      <td>
+        <b>POST</b> <code>/testCases/create/{accountId}/{projectId}</code><br>
+        No description available.
+        <h3>Example:</h3>
+        <code>api.createTestcase(accountId, projectId, Body)</code>
+      </td>
+    </tr>
+    <tr>
+      <td>
+        <b>POST</b> <code>/v1/projects/{projectId}/testcases/{testcaseId}/updateSteps</code><br>
+        No description available.
+        <h3>Example:</h3>
+        <code>api.updateTestcaseSteps(projectId, testcaseId, Body)</code>
+      </td>
+    </tr>
     <tr>
       <td>
         <b>POST</b> <code>/v1/testsuite/{testSuiteId}/execute</code><br>
@@ -802,6 +842,14 @@ This endpoint requires API Key authentication and will also return your private
         <code>api.getTestSteps(testcaseId, stepId)</code>
       </td>
     </tr>
+    <tr>
+      <td>
+        <b>GET</b> <code>/v1/testcases/{testcaseId}/isgenerating</code><br>
+        No description available.
+        <h3>Example:</h3>
+        <code>api.isGenerating(testcaseId)</code>
+      </td>
+    </tr>
     <tr>
       <td>
         <b>GET</b> <code>/blocks/getAll/{accountId}/{blockId}</code><br>


Test patch:
diff --git a/tests/cli.test.js b/tests/cli.test.js
index b94a2f7..28152df 100644
--- a/tests/cli.test.js
+++ b/tests/cli.test.js
@@ -25,7 +25,7 @@ test('should be able to execute a command', async () => {
         description: 'your Sauce Labs username'
     })
 
-    const [command, description, handler, cb] = yargs.command.mock.calls[4]
+    const [command, description, handler, cb] = yargs.command.mock.calls[3]
     expect(command).toContain('listBuilds <username>')
     expect(command).toContain('[limit]')
     expect(command).toContain('[subaccounts]')