UNPKG

@petarmihaylov/node-raas

Version:

A tiny library and CLI for interacting with the Reports as a Service - RAAS - API from UKG - Ultimate Kronos Group. This project is maintained by the team behind RaasTastic and the community. It provides a balanced set of features that should suit a broad

185 lines (184 loc) 5 kB
import * as soap from 'soap'; export declare enum RaasMethods { LogOn = "LogOn", GetReportParameters = "GetReportParameters", ExecuteReport = "ExecuteReport", RetrieveReport = "RetrieveReport", LogOff = "LogOff" } export declare type RaasCredential = { UserName: string; Password: string; ClientAccessKey: string; UserAccessKey: string; }; export declare type RunParams = { retrieveReportRetries: number; dataRetrievedOrError: boolean; }; export declare type Clients = { executeClient: soap.Client; streamClient: soap.Client; }; export declare type RaasResponseBase = [ string, { Action: { attributes: { 's:mustUnderstand': string; }; $value: string; }; }, string ]; export declare type LogOnResultTypeDefinition = { ClientAccessKey: string; Status: string; StatusMessage: string; ServiceId?: string; Token?: string; InstanceKey?: string; }; export declare type LogOnResponse = [ { LogOnResult: LogOnResultTypeDefinition; }, string, { Action: { attributes: { 's:mustUnderstand': string; }; $value: string; }; }, string ]; export declare type LogOffResultTypeDefinition = { ClientAccessKey: string; Status: string; }; export declare type LogOffResponse = [ { LogOffResult: LogOffResultTypeDefinition; }, string, { Action: { attributes: { 's:mustUnderstand': string; }; $value: string; }; }, string ]; export declare type ExecuteReportResultTypeDefinition = { Status: string; StatusMessage?: string; ReportKey?: string; ReportRetrievalUrl?: string; }; export declare type ExecuteReportResponse = [ { ExecuteReportResult: ExecuteReportResultTypeDefinition; }, string, { Action: { attributes: { 's:mustUnderstand': string; }; $value: string; }; }, string ]; export declare type ReportParameterElement = { Name: string; Required: boolean; DataType: string; MultiValued: boolean; }; export declare type GetReportParametersResultTypeDefinition = { ReportParameters: { ReportParameter?: ReportParameterElement[]; }; Status: string; StatusMessage: string; }; export declare type RetrieveReportResponse = [ { ReportStream: string; }, string, { Action: { attributes: { 's:mustUnderstand': string; }; $value: string; }; Status: string; StatusMessage?: string; }, string ]; export declare type GetReportParametersResponse = [ { GetReportParametersResult: GetReportParametersResultTypeDefinition; }, string, { Action: { attributes: { 's:mustUnderstand': string; }; $value: string; }; Status: string; StatusMessage?: string; }, string ]; export interface RaasLogOnCallResult { hasErrors: boolean; correlationId: string; result: LogOnResponse; } export interface RaasLogOffCallResult { hasErrors: boolean; correlationId: string; result: LogOffResponse; } export interface RaasExecuteReportCallResult { hasErrors: boolean; correlationId: string; result: ExecuteReportResponse; } export interface RaasRetrieveReportCallResult { hasErrors: boolean; errorMessage?: string; hasWarnings: boolean; warningMessage?: string; correlationId: string; result: RetrieveReportResponse; } export interface RaasGetReportParametersCallResult { hasErrors: boolean; errorMessage?: string; hasWarnings: boolean; warningMessage?: string; correlationId: string; requiredParams: ReportParameterElement[]; result: GetReportParametersResponse; } export declare function config(baseEndpoint: string): Promise<Clients>; export declare function addAddressingHeader(soapClient: soap.Client): void; export declare function addActionHeader(clients: Clients, method: RaasMethods): void; export declare function login(clients: Clients, raasCredential: RaasCredential): Promise<RaasLogOnCallResult>; export declare function getReportParameters(clients: Clients, logOnResult: LogOnResultTypeDefinition, reportPathOrId: string): Promise<RaasGetReportParametersCallResult>; export declare function executeReport(clients: Clients, logOnResult: LogOnResultTypeDefinition, reportPathOrId: string): Promise<RaasExecuteReportCallResult>; export declare function retrieveReport(clients: Clients, executeReportResult: ExecuteReportResultTypeDefinition): Promise<RaasRetrieveReportCallResult>; export declare function logOff(clients: Clients, logOnResult: LogOnResultTypeDefinition): Promise<RaasLogOffCallResult>;