-
Notifications
You must be signed in to change notification settings - Fork 0
/
KalturaAppTokenService.js
59 lines (55 loc) · 1.97 KB
/
KalturaAppTokenService.js
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
/**
*Class definition for the Kaltura service: appToken.
**/
var KalturaAppTokenService = {
/**
* Add new application authentication token.
* @param appToken KalturaAppToken Application token (optional)
**/
add: function(appToken){
var kparams = new Object();
kparams.appToken = appToken;
return new KalturaRequestBuilder("apptoken", "add", kparams);
},
/**
* Delete application authentication token by id.
* @param id string Application token identifier (optional)
**/
deleteAction: function(id){
var kparams = new Object();
kparams.id = id;
return new KalturaRequestBuilder("apptoken", "delete", kparams);
},
/**
* Get application authentication token by id.
* @param id string Application token identifier (optional)
**/
get: function(id){
var kparams = new Object();
kparams.id = id;
return new KalturaRequestBuilder("apptoken", "get", kparams);
},
/**
* Starts a new KS (Kaltura Session) based on application authentication token id.
* @param id string application token id (optional)
* @param tokenHash string hashed token - current KS concatenated with the application token hashed using the application token ‘hashType’ (optional)
* @param userId string session user id, will be ignored if a different user id already defined on the application token (optional, default: null)
* @param expiry int session expiry (in seconds), could be overwritten by shorter expiry of the application token and the session-expiry that defined on the application token (optional, default: null)
* @param udid string Device UDID (optional, default: null)
**/
startSession: function(id, tokenHash, userId, expiry, udid){
if(!userId)
userId = null;
if(!expiry)
expiry = null;
if(!udid)
udid = null;
var kparams = new Object();
kparams.id = id;
kparams.tokenHash = tokenHash;
kparams.userId = userId;
kparams.expiry = expiry;
kparams.udid = udid;
return new KalturaRequestBuilder("apptoken", "startSession", kparams);
}
}