mirror of
https://github.com/sasjs/adapter.git
synced 2026-04-21 13:11:31 +00:00
Merge pull request #106 from sasjs/cli-issue-105
feat(context): made getContextByName function public
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2
-2
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -313,7 +313,7 @@ export class SASViyaApiClient {
|
|||||||
headers.Authorization = `Bearer ${accessToken}`
|
headers.Authorization = `Bearer ${accessToken}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const originalContext = await this.getContextByName(
|
const originalContext = await this.getComputeContextByName(
|
||||||
contextName,
|
contextName,
|
||||||
accessToken
|
accessToken
|
||||||
)
|
)
|
||||||
@@ -372,7 +372,7 @@ export class SASViyaApiClient {
|
|||||||
headers.Authorization = `Bearer ${accessToken}`
|
headers.Authorization = `Bearer ${accessToken}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const context = await this.getContextByName(contextName, accessToken)
|
const context = await this.getComputeContextByName(contextName, accessToken)
|
||||||
|
|
||||||
const deleteContextRequest: RequestInit = {
|
const deleteContextRequest: RequestInit = {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
@@ -1393,7 +1393,13 @@ export class SASViyaApiClient {
|
|||||||
return `/folders/folders/${folder.id}`
|
return `/folders/folders/${folder.id}`
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getContextByName(
|
/**
|
||||||
|
* Returns a JSON representation of a compute context.
|
||||||
|
* @example: { "createdBy": "admin", "links": [...], "id": "ID", "version": 2, "name": "context1" }
|
||||||
|
* @param contextName - the name of the context to return.
|
||||||
|
* @param accessToken - an access token for an authorized user.
|
||||||
|
*/
|
||||||
|
public async getComputeContextByName(
|
||||||
contextName: string,
|
contextName: string,
|
||||||
accessToken?: string
|
accessToken?: string
|
||||||
): Promise<Context> {
|
): Promise<Context> {
|
||||||
|
|||||||
@@ -167,6 +167,24 @@ export default class SASjs {
|
|||||||
return await this.sasViyaApiClient!.deleteContext(contextName, accessToken)
|
return await this.sasViyaApiClient!.deleteContext(contextName, accessToken)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a JSON representation of a compute context.
|
||||||
|
* @example: { "createdBy": "admin", "links": [...], "id": "ID", "version": 2, "name": "context1" }
|
||||||
|
* @param contextName - the name of the context to return.
|
||||||
|
* @param accessToken - an access token for an authorized user.
|
||||||
|
*/
|
||||||
|
public async getComputeContextByName(
|
||||||
|
contextName: string,
|
||||||
|
accessToken?: string
|
||||||
|
) {
|
||||||
|
this.isMethodSupported('getComputeContextByName', ServerType.SASViya)
|
||||||
|
|
||||||
|
return await this.sasViyaApiClient!.getComputeContextByName(
|
||||||
|
contextName,
|
||||||
|
accessToken
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
public async createSession(contextName: string, accessToken: string) {
|
public async createSession(contextName: string, accessToken: string) {
|
||||||
this.isMethodSupported('createSession', ServerType.SASViya)
|
this.isMethodSupported('createSession', ServerType.SASViya)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user