import { Job, Session, Folder } from "./types"; /** * A client for interfacing with the SAS Viya REST API * */ export declare class SASViyaApiClient { private serverUrl; private rootFolderName; private rootFolderMap; constructor(serverUrl: string, rootFolderName: string, rootFolderMap?: Map); private csrfToken; private rootFolder; /** * Returns a map containing the directory structure in the currently set root folder. */ getAppLocMap(): Promise>; /** * returns an object containing the Server URL and root folder name */ getConfig(): { serverUrl: string; rootFolderName: string; }; /** * Updates server URL or root folder name when not null * @param serverUrl - the URL of the server. * @param rootFolderName - the name for rootFolderName. */ setConfig(serverUrl: string, rootFolderName: string): void; /** * Returns all available compute contexts on this server. * @param accessToken - an access token for an authorized user. */ getAllContexts(accessToken?: string): Promise<{ createdBy: any; id: any; name: any; version: any; attributes: {}; }[]>; /** * Returns all compute contexts on this server that the user has access to. * @param accessToken - an access token for an authorized user. */ getExecutableContexts(accessToken?: string): Promise; /** * Creates a session on the given context. * @param contextName - the name of the context to create a session on. * @param accessToken - an access token for an authorized user. */ createSession(contextName: string, accessToken?: string): Promise; /** * Executes code on the current SAS Viya server. * @param fileName - a name for the file being submitted for execution. * @param linesOfCode - an array of lines of code to execute. * @param contextName - the context to execute the code in. * @param accessToken - an access token for an authorized user. * @param sessionId - optional session ID to reuse. * @param silent - optional flag to turn of logging. */ executeScript(fileName: string, linesOfCode: string[], contextName: string, accessToken?: string, sessionId?: string, silent?: boolean): Promise<{ jobStatus: unknown; log: unknown; } | undefined>; /** * Creates a folder in the specified location. Either parentFolderPath or * parentFolderUri must be provided. * @param folderName - the name of the new folder. * @param parentFolderPath - the full path to the parent folder. If not * provided, the parentFolderUri must be provided. * @param parentFolderUri - the URI (eg /folders/folders/UUID) of the parent * folder. If not provided, the parentFolderPath must be provided. */ createFolder(folderName: string, parentFolderPath?: string, parentFolderUri?: string, accessToken?: string): Promise; /** * Creates a Job in the specified folder (or folder uri). * @param parentFolderPath - the location of the new job. * @param parentFolderUri - the URI location of the new job. The function is a * little faster if the folder URI is supplied instead of the path. * @param jobName - the name of the new job to be created. * @param code - the SAS code for the new job. */ createJobDefinition(jobName: string, code: string, parentFolderPath?: string, parentFolderUri?: string, accessToken?: string): Promise; /** * Performs a login redirect and returns an auth code for the given client * @param clientId - the client ID to authenticate with. */ getAuthCode(clientId: string): Promise; /** * Exchanges the auth code for an access token for the given client. * @param clientId - the client ID to authenticate with. * @param clientSecret - the client secret to authenticate with. * @param authCode - the auth code received from the server. */ getAccessToken(clientId: string, clientSecret: string, authCode: string): Promise; /** * Exchanges the refresh token for an access token for the given client. * @param clientId - the client ID to authenticate with. * @param clientSecret - the client secret to authenticate with. * @param authCode - the refresh token received from the server. */ refreshTokens(clientId: string, clientSecret: string, refreshToken: string): Promise; /** * Deletes the client representing the supplied ID. * @param clientId - the client ID to authenticate with. * @param accessToken - an access token for an authorized user. */ deleteClient(clientId: string, accessToken?: string): Promise; /** * Executes a job via the SAS Viya Job Execution API * @param sasJob - the relative path to the job. * @param contextName - the name of the context where the job is to be executed. * @param debug - sets the _debug flag in the job arguments. * @param data - any data to be passed in as input to the job. * @param accessToken - an optional access token for an authorized user. */ executeJob(sasJob: string, contextName: string, debug: boolean, data?: any, accessToken?: string): Promise; private populateRootFolderMap; private populateRootFolder; private pollJobState; private uploadTables; private getFolderUri; private request; }