-
Notifications
You must be signed in to change notification settings - Fork 2
/
CatavoltApi.ts
155 lines (133 loc) · 4.31 KB
/
CatavoltApi.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
import {ClientListener} from "../client/ClientListener";
import { StreamConsumer } from '../io/StreamConsumer';
import { StreamProducer } from '../io/StreamProducer';
import { ClientType, Dialog, DialogRedirection, Redirection, Session, WorkbenchAction } from '../models';
import { LargeProperty } from '../models/LargeProperty';
import { CvLocale } from '../util';
import { FeatureSet } from './Catavolt';
import { DialogApi } from './DialogApi';
export interface CatavoltApi {
dataLastChangedTime: Date;
locale: CvLocale;
readonly clientTimeoutMillis: number;
readonly currencySymbol: string;
readonly deviceProps: { [p: string]: string };
readonly dialogApi: DialogApi;
readonly isLoggedIn: boolean;
onSessionExpiration:()=>void;
readonly remainingSessionTime: number;
readonly session: Session;
readonly sessionHasExpired: boolean;
readonly DEFAULT_LOCALE: CvLocale;
/**
*
* @param {ClientListener} clientListener
*/
addClientListener(clientListener:ClientListener): void;
/**
* Add or replace a dynamic device property (func)
* @param propName
* @param propFn
*/
addDynamicDeviceProp(propName: string, propFn: () => string): void;
/**
* Add or replace a static device property
*
* @param propName
* @param propValue
*/
addStaticDeviceProp(propName: string, propValue: string): void;
changePasswordAndLogin(
tenantId: string,
clientType: ClientType,
userId: string,
existingPassword: string,
newPassword: string
): Promise<Session | Redirection>;
/**
* Initialize a dialog service implementation for use by this CatavoltApiImpl
*
* @param serverVersion
* @param serverUrl
*/
initDialogApi(serverUrl: string, serverVersion: string): void;
/**
* Check for the availability of the given featureSet
* @see FeatureSet
* @param featureSet
* @returns {boolean}
*/
isFeatureSetAvailable(featureSet: FeatureSet): boolean;
/**
* Check offline status
*
* @param tenantId
*/
isAnyUserInBriefcaseMode(tenantId: string): Promise<boolean>;
/**
*
* @param userInfo
*/
isUserInBriefcaseMode(userInfo:{}): Promise<boolean>;
/**
* Log in and retrieve the Session
*
* @param tenantId
* @param clientType
* @param userId
* @param password
*
* @returns {Promise<Session | Redirection>}
*/
login(tenantId: string, clientType: ClientType, userId: string, password: string): Promise<Session | Redirection>;
loginWithToken(
tenantId: string,
clientType: ClientType,
permissionToken: string,
proofKey: string
): Promise<Session | Redirection>;
/**
* Logout and destroy the session
* @returns {{sessionId:string}}
*/
logout(): Promise<{ sessionId: string }>;
openDialogWithId(dialogId: string): Promise<Dialog>;
openDialog(redirection: DialogRedirection): Promise<Dialog>;
openStream(url: string): Promise<StreamProducer>;
toDialogOrRedirection(resultPr: Promise<{}>): Promise<Dialog | Redirection>;
getRedirection(redirectionId: string): Promise<Redirection>;
/**
* Open a {@link WorkbenchAction}
* @param workbenchAction
* @returns {Promise<{actionId:string} | Redirection>}
*/
performWorkbenchAction(workbenchAction: WorkbenchAction): Promise<{ actionId: string } | Redirection>;
/**
* Open a {@link WorkbenchWorkbenchAction}
* @param workbenchId
* @param workbenchActionId
* @returns {Promise<{actionId:string} | Redirection>}
*/
performWorkbenchActionForId(
workbenchId: string,
workbenchActionId: string
): Promise<{ actionId: string } | Redirection>;
/**
* Refresh the CatavoltApiImpl
*
* @returns {Promise<Session>}
*/
refreshSession(tenantId: string, sessionId: string): Promise<Session>;
/**
*
* @param {ClientListener} clientListener
*/
removeClientListener(clientListener:ClientListener): void;
/**
*
* @param {string} contentId
* @param {StreamConsumer} streamConsumer
* @returns {Promise<LargeProperty>}
*/
streamContent(contentId: string, streamConsumer: StreamConsumer): Promise<LargeProperty>;
}