Reference for the GeensSdk class, the default export of @geens_npo/browser-sdk 0.1.7.
It is generated from the TypeScript declarations included in the package.
See the guide pages for usage examples, and Callbacks and errors for the callback conventions used by most methods.
new GeensSdk(
client_id,
redirect_uri,
geens_server_uri,
logout_uri?
): GeensSdk;
| Parameter | Type |
|---|---|
client_id |
string |
redirect_uri |
string |
geens_server_uri |
string |
logout_uri? |
string |
GeensSdk
code: string = '';
geensGroupUserPermissionsList: any = PermissionsList;
itemApiService: ItemApiService;
loggedIn: boolean = false;
opener: any = null;
popup: any = null;
rolesService: RolesService;
checkGeensIds(
geensIds,
on_success,
on_error
): void;
Check if geens ids exists
| Parameter | Type |
|---|---|
geensIds |
string[] |
on_success |
any |
on_error |
any |
void
checkIfUserHasPermission(permission): boolean;
| Parameter | Type |
|---|---|
permission |
PermissionsList[] |
boolean
clearLocalStorage(redirectUrl?, reloadWindow?): void;
Clear local storage
| Parameter | Type | Default value |
|---|---|---|
redirectUrl? |
string | null |
null |
reloadWindow? |
boolean |
true |
void
copyItems(
parent_id,
items_ids,
options,
on_success,
on_error
): void;
Copy items
| Parameter | Type |
|---|---|
parent_id |
number | null |
items_ids |
number[] |
options |
{ external_access_token?: string[] | null; password?: string; url_token?: string; } |
options.external_access_token? |
string[] | null |
options.password? |
string |
options.url_token? |
string |
on_success |
any |
on_error |
any |
void
createDirectory(
parent_id?,
title,
is_private_directory?,
options,
on_success,
on_error
): void;
Create directory in geens
| Parameter | Type | Default value |
|---|---|---|
parent_id? |
number | null |
null |
title |
string |
undefined |
is_private_directory? |
boolean |
false |
options |
{ external_access_token?: string; external_access_token_for_parent_item?: string; password?: string; url_token?: string; } |
undefined |
options.external_access_token? |
string |
undefined |
options.external_access_token_for_parent_item? |
string |
undefined |
options.password? |
string |
undefined |
options.url_token? |
string |
undefined |
on_success |
any |
undefined |
on_error |
any |
undefined |
void
createFile(
parent_id?,
title?,
extension?,
mime_type?,
file,
is_private,
options,
on_success,
on_error
): void;
Create file in Geens
| Parameter | Type | Default value |
|---|---|---|
parent_id? |
number | null |
null |
title? |
string | null |
null |
extension? |
string | null |
null |
mime_type? |
string | null |
null |
file |
any |
undefined |
is_private |
boolean |
undefined |
options |
{ external_access_token?: string; external_access_token_for_parent_item?: string; password?: string; url_token?: string; } |
undefined |
options.external_access_token? |
string |
undefined |
options.external_access_token_for_parent_item? |
string |
undefined |
options.password? |
string |
undefined |
options.url_token? |
string |
undefined |
on_success |
any |
undefined |
on_error |
any |
undefined |
void
createItemShareForUsers(
itemId,
geensIds,
permission,
on_success,
on_error
): void;
Create item share for users
| Parameter | Type |
|---|---|
itemId |
number |
geensIds |
string[] |
permission |
number |
on_success |
any |
on_error |
any |
void
createItemVersion(
item_id,
file,
options,
on_success,
on_error
): void;
Create item version
| Parameter | Type |
|---|---|
item_id |
number |
file |
any |
options |
{ external_access_token?: string; password?: string; url_token?: string; } |
options.external_access_token? |
string |
options.password? |
string |
options.url_token? |
string |
on_success |
any |
on_error |
any |
void
decryptText(
encrypted_text,
password,
on_success,
on_error
): void;
| Parameter | Type |
|---|---|
encrypted_text |
string |
password |
string |
on_success |
any |
on_error |
any |
void
deleteItemVersion(
item,
options,
on_success,
on_error
): void;
Delete item version
| Parameter | Type |
|---|---|
item |
{ id: number; version: { id: number; }; } |
item.id |
number |
item.version |
{ id: number; } |
item.version.id |
number |
options |
{ external_access_token?: string; password?: string; url_token?: string; } |
options.external_access_token? |
string |
options.password? |
string |
options.url_token? |
string |
on_success |
any |
on_error |
any |
void
downloadItem(
items,
options,
on_success,
on_error
): void;
Download item
| Parameter | Type |
|---|---|
items |
[{ itemId: number; versionId?: number; }] |
options |
{ external_access_token?: string; password?: string; url_token?: string; } |
options.external_access_token? |
string |
options.password? |
string |
options.url_token? |
string |
on_success |
any |
on_error |
any |
void
editNote(
item_id,
newContent,
options,
on_success,
on_error
): void;
Update note
| Parameter | Type |
|---|---|
item_id |
number |
newContent |
string |
options |
{ external_access_token?: string; password?: string; url_token?: string; } |
options.external_access_token? |
string |
options.password? |
string |
options.url_token? |
string |
on_success |
any |
on_error |
any |
void
encryptText(
text,
password,
on_success,
on_error
): void;
| Parameter | Type |
|---|---|
text |
string |
password |
string |
on_success |
any |
on_error |
any |
void
finalizeLogin(
access_token_data,
redirectUrl?,
reloadWindow?,
on_success?,
on_error?
): void;
Finalize login by setting access token and user data
| Parameter | Type | Default value |
|---|---|---|
access_token_data |
{ access_token: string; expires_in: number; token_type: string; } |
undefined |
access_token_data.access_token |
string |
undefined |
access_token_data.expires_in |
number |
undefined |
access_token_data.token_type |
string |
undefined |
redirectUrl? |
string |
undefined |
reloadWindow? |
boolean |
true |
on_success? |
any |
undefined |
on_error? |
any |
undefined |
void
finalizeLogout(redirectUrl?, reloadWindow?): void;
Finalize log out by clearing local storage and reloading the window
| Parameter | Type | Default value |
|---|---|---|
redirectUrl? |
string |
undefined |
reloadWindow? |
boolean |
true |
void
generateCryptographicallySafeRandomToken(
excludedChars?,
onlyNumbersAndLetters?,
on_success,
on_error
): void;
| Parameter | Type | Default value |
|---|---|---|
excludedChars? |
string[] |
[] |
onlyNumbersAndLetters? |
boolean |
false |
on_success |
any |
undefined |
on_error |
any |
undefined |
void
generateSharableUrlLinks(
itemsIds,
password,
permission,
sharedIdentityType,
urlToken?,
on_success,
on_error
): void;
Generate sharable url link
| Parameter | Type | Default value |
|---|---|---|
itemsIds |
number[] |
undefined |
password |
string |
undefined |
permission |
number |
undefined |
sharedIdentityType |
number |
undefined |
urlToken? |
any |
null |
on_success |
any |
undefined |
on_error |
any |
undefined |
void
getAllItems(
is_deleted,
on_success,
on_error
): void;
Get all user items
| Parameter | Type |
|---|---|
is_deleted |
boolean |
on_success |
any |
on_error |
any |
void
getAvatar(keyId): void;
| Parameter | Type |
|---|---|
keyId |
string |
void
getItem(
item_ids,
options,
on_success,
on_error
): void;
Get user item
| Parameter | Type |
|---|---|
item_ids |
number[] |
options |
{ external_access_token?: string; password?: string; url_token?: string; } |
options.external_access_token? |
string |
options.password? |
string |
options.url_token? |
string |
on_success |
any |
on_error |
any |
void
getItemsDescendants(
item_ids,
options,
on_success,
on_error
): void;
Get all descendants of a specific item id
| Parameter | Type |
|---|---|
item_ids |
number[] |
options |
{ external_access_token?: string; password?: any; url_token?: any; } |
options.external_access_token? |
string |
options.password? |
any |
options.url_token? |
any |
on_success |
any |
on_error |
any |
void
getNotificationBeforeAccessTokenExpires(minutes_before_expiration?, on_session_end_callback): void;
Invoke a callback when the stored access token is near expiry.
| Parameter | Type | Default value |
|---|---|---|
minutes_before_expiration? |
number |
1 |
on_session_end_callback |
any |
undefined |
void
getSharedUrl(
item_id,
options,
on_success,
on_error
): void;
| Parameter | Type |
|---|---|
item_id |
number |
options |
{ external_access_token?: string[] | null; password?: any; url_token?: any; } |
options.external_access_token? |
string[] | null |
options.password? |
any |
options.url_token? |
any |
on_success |
any |
on_error |
any |
void
getUserData(on_success, on_error): void;
Get user data from geens api
| Parameter | Type |
|---|---|
on_success |
any |
on_error |
any |
void
getUsersByUids(
UIds,
on_success,
on_error
): void;
Get users by UIDs
| Parameter | Type |
|---|---|
UIds |
string[] |
on_success |
any |
on_error |
any |
void
listAllItems(
parent_id,
options,
on_success,
on_error
): void;
List items all items with a specific parent
| Parameter | Type |
|---|---|
parent_id |
number |
options |
{ type: string; } |
options.type |
string |
on_success |
any |
on_error |
any |
void
moveItems(
parent_id,
items_ids,
options,
on_success,
on_error
): void;
Move a items
| Parameter | Type |
|---|---|
parent_id |
number | null |
items_ids |
number[] |
options |
{ external_access_token?: string[] | null; password?: string; url_token?: string; } |
options.external_access_token? |
string[] | null |
options.password? |
string |
options.url_token? |
string |
on_success |
any |
on_error |
any |
void
onLogin(callback): void;
Event with the callback from third party application that makes request to receive access token
| Parameter | Type |
|---|---|
callback |
any |
void
openLogin(): void;
Open login window
void
openLogout(): void;
Open logout window ///TODO If geens access token is revoked client app logout should clear the local storage and refresh the page
void
permanentlyDeleteItems(
items_ids,
options,
on_success,
on_error
): void;
Delete items using the soft-delete state. The method name is retained for compatibility; it does not perform hard deletion.
| Parameter | Type |
|---|---|
items_ids |
number[] |
options |
{ external_access_token?: string; password?: string; url_token?: string; } |
options.external_access_token? |
string |
options.password? |
string |
options.url_token? |
string |
on_success |
any |
on_error |
any |
void
revokeSharedItemAccess(
accessId,
on_success,
on_error
): void;
Revoke item access
| Parameter | Type |
|---|---|
accessId |
number |
on_success |
any |
on_error |
any |
void
revokeUrlShare(
url_token,
on_success,
on_error
): void;
Revoke url shared access
| Parameter | Type |
|---|---|
url_token |
string |
on_success |
any |
on_error |
any |
void
rsaDecryptText(
encrypted_text,
on_success,
on_error
): void;
| Parameter | Type |
|---|---|
encrypted_text |
string |
on_success |
any |
on_error |
any |
void
rsaEncryptText(
text,
publicKey?,
on_success,
on_error
): void;
| Parameter | Type | Default value |
|---|---|---|
text |
string |
undefined |
publicKey? |
any |
null |
on_success |
any |
undefined |
on_error |
any |
undefined |
void
setAccessToken(access_token_data): void;
Setting access token in variable and local storage
| Parameter | Type |
|---|---|
access_token_data |
{ access_token: string; expires_in: number; token_type: string; } |
access_token_data.access_token |
string |
access_token_data.expires_in |
number |
access_token_data.token_type |
string |
void
setCode(code): void;
Set code
| Parameter | Type |
|---|---|
code |
string |
void
setPrivateKey(privateKey): void;
Setting private key in variable and local storage
| Parameter | Type |
|---|---|
privateKey |
string |
void
updateItem(
item_id,
title?,
description?,
options,
on_success,
on_error
): void;
Update item
| Parameter | Type | Default value |
|---|---|---|
item_id |
number |
undefined |
title? |
string | null |
null |
description? |
string | null |
null |
options |
{ external_access_token?: string | null; password?: string; url_token?: string; } |
undefined |
options.external_access_token? |
string | null |
undefined |
options.password? |
string |
undefined |
options.url_token? |
string |
undefined |
on_success |
any |
undefined |
on_error |
any |
undefined |
void
windowLocationUpdateForPopup(redirectUrl?, reloadWindow?): void;
| Parameter | Type |
|---|---|
redirectUrl? |
string |
reloadWindow? |
boolean |
void
windowLocationUpdateForWebSite(redirectUrl?, reloadWindow?): void;
| Parameter | Type |
|---|---|
redirectUrl? |
string | null |
reloadWindow? |
boolean |
void