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

feat(edit-context): add the ability to edit a given context

This commit is contained in:
Krishna Acondy
2020-09-10 09:14:02 +01:00
parent 3ec6ee2db9
commit 9b0e02f5b7
3 changed files with 87 additions and 2 deletions

View File

@@ -29,7 +29,8 @@ import {
SASjsWaitingRequest,
ServerType,
CsrfToken,
UploadFile
UploadFile,
EditContextInput
} from './types'
import { SASViyaApiClient } from './SASViyaApiClient'
import { SAS9ApiClient } from './SAS9ApiClient'
@@ -137,6 +138,27 @@ export default class SASjs {
)
}
/**
* Updates a compute context on the given server.
* @param contextId - the ID of the context to be deleted.
* @param editedContext - an object with the properties to be updated.
* @param accessToken - an access token for an authorized user.
*/
public async editContext(
contextId: string,
editedContext: EditContextInput,
accessToken?: string
) {
if (this.sasjsConfig.serverType !== ServerType.SASViya) {
throw new Error('This operation is only supported on SAS Viya servers.')
}
return await this.sasViyaApiClient!.editContext(
contextId,
editedContext,
accessToken
)
}
/**
* Deletes a compute context on the given server.
* @param contextId - the ID of the context to be deleted.