1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-05 03:30:05 +00:00

feat: added sourceFolder URI capability to moveFolder function

This commit is contained in:
Yury Shkoda
2020-09-08 17:01:24 +03:00
parent 12835893b1
commit 0a77ebf5c5
2 changed files with 12 additions and 9 deletions

View File

@@ -374,12 +374,12 @@
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in SASViyaApiClient.ts:1198</li>
<li>Defined in SASViyaApiClient.ts:1201</li>
</ul>
</aside>
<div class="tsd-comment tsd-typography tsd-comment-shorttext">
<div class="lead">
<p>For performance (and in case of accidental error) the <code>deleteFolder</code> function does not actually delete the folder (and all it&#39;s content and subfolder content). Instead the folder is simply moved to the recycle bin. Deletion time will be added to the folder name.</p>
<p>For performance (and in case of accidental error) the <code>deleteFolder</code> function does not actually delete the folder (and all it&#39;s content and subfolder content). Instead the folder is simply moved to the recycle bin. Deletion time will be added to the folder name.</p>
</div>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
@@ -780,13 +780,13 @@
<li>
<h5>sourceFolder: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography tsd-comment-text">
<p>The full path to the source folder to be moved (eg <code>/Public/example/myFolder</code>)</p>
<p>The full path (eg <code>/Public/example/myFolder</code>) or URI of the source folder to be moved. Providing URI instead of path will save one extra request.</p>
</div>
</li>
<li>
<h5>targetParentFolder: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography tsd-comment-text">
<p>The <em>parent</em> folder to which the <code>sourceFolder</code> will be moved (eg <code>/Public/newDestination</code>). To move a folder, a user has to have write permissions in targetParentFolder. If moving to recycle bin, &#39;targetParentFolder&#39; will be a uri.</p>
<p>The full path or URI of the <em>parent</em> folder to which the <code>sourceFolder</code> will be moved (eg <code>/Public/newDestination</code>). To move a folder, a user has to have write permissions in targetParentFolder. Providing URI instead of path will save one extra request.</p>
</div>
</li>
<li>
@@ -893,7 +893,7 @@
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in SASViyaApiClient.ts:1215</li>
<li>Defined in SASViyaApiClient.ts:1218</li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>

View File

@@ -1142,8 +1142,8 @@ export class SASViyaApiClient {
/**
* Moves a Viya folder to a new location. The folder may be renamed at the same time.
* @param sourceFolder - The full path to the source folder to be moved (eg `/Public/example/myFolder`)
* @param targetParentFolder - The _parent_ folder to which the `sourceFolder` will be moved (eg `/Public/newDestination`). To move a folder, a user has to have write permissions in targetParentFolder. If moving to recycle bin, 'targetParentFolder' will be a uri.
* @param sourceFolder - The full path (eg `/Public/example/myFolder`) or URI of the source folder to be moved. Providing URI instead of path will save one extra request.
* @param targetParentFolder - The full path or URI of the _parent_ folder to which the `sourceFolder` will be moved (eg `/Public/newDestination`). To move a folder, a user has to have write permissions in targetParentFolder. Providing URI instead of path will save one extra request.
* @param targetFolderName - The name of the "moved" folder. If left blank, the original folder name will be used (eg `myFolder` in `/Public/newDestination/myFolder` for the example above). Optional field.
* @param accessToken - an access token for authorizing the request
*/
@@ -1153,9 +1153,12 @@ export class SASViyaApiClient {
targetFolderName: string,
accessToken: string
) {
const sourceFolderUri = await this.getFolderUri(sourceFolder, accessToken)
// checks if 'sourceFolder' is already a URI
const sourceFolderUri = /^\/folders\/folders\//.test(sourceFolder)
? sourceFolder
: await this.getFolderUri(sourceFolder, accessToken)
// checks if 'targetParentFolder' is already a uri
// checks if 'targetParentFolder' is already a URI
const targetParentFolderUri = /^\/folders\/folders\//.test(
targetParentFolder
)