@apizee/cloudapi-js-sdk v0.1.34
Class: default
Installation
npm install --save @apizee/cloudapi-js-sdk
Usage
import CloudAPI from 'cloudapi-js-sdk';
var cloudApi = new CloudAPI();
// Then use methods
cloudApi.setLogLevel('debug');
...
Table of contents
Constructors
Properties
Methods
- authentication
- checkConferenceAccess
- checkUserToken
- closeConferenceInstance
- cloudRequest
- createConference
- delete
- get
- getConferenceList
- getConnectedUserInformation
- getConversationMediaList
- getEnterpriseInformation
- getEnterpriseTagList
- getEnterpriseUserList
- getLogLevel
- getOrCreateConversation
- getPreferredCCS
- getSessionHistory
- getSiteAgents
- getUserPhotoUrl
- getUserProfile
- getWebSession
- getWebconf
- getWebconfConversation
- invalidateUserToken
- loadGroupChatMessages
- post
- pushConversationMedia
- put
- request
- saveGroupChatMessage
- saveNewMessage
- setCloudURL
- setConversationData
- setFetchRetries
- setFetchRetryDelay
- setLogLevel
- updateConferencePresence
- updateWebconfTags
- uploadFile
- uploadSnapshot
- get
Constructors
constructor
• new default()
Properties
cloudUrl
• cloudUrl: string
= DEFAULT_CLOUD_URL
fetchRetries
• fetchRetries: number
= DEFAULT_FETCH_RETRIES
fetchRetryDelay
• fetchRetryDelay: number
= DEFAULT_FETCH_RETRY_DELAY
Methods
authentication
▸ authentication(login
, pass
): Promise
<unknown
>
A promise for authenticating to the apizee cloud
Parameters
Name | Type |
---|---|
login | string |
pass | string |
Returns
Promise
<unknown
>
result in promise
checkConferenceAccess
▸ checkConferenceAccess(roomname
, apiKey
, options?
): Promise
<unknown
>
A promise for checking conference access
Parameters
Name | Type | Description |
---|---|---|
roomname | string | |
apiKey | string | mandatory apiKey |
options | AnyObject |
Returns
Promise
<unknown
>
result in promise
checkUserToken
▸ checkUserToken(bearerToken
): Promise
<unknown
>
A promise for checking user token to the apizee cloud
Parameters
Name | Type |
---|---|
bearerToken | string |
Returns
Promise
<unknown
>
result in promise
closeConferenceInstance
▸ closeConferenceInstance(conversation
, session
): Promise
<unknown
>
A promise for updating user presence in the conference
Parameters
Name | Type |
---|---|
conversation | Conversation |
session | Session |
Returns
Promise
<unknown
>
result in promise
cloudRequest
▸ cloudRequest(url
, params
, method
, options?
): Promise
<unknown
>
A promise for generic apizee cloud requests
Parameters
Name | Type |
---|---|
url | string |
params | AnyObject |
method | string |
options | CloudRequestOptions |
Returns
Promise
<unknown
>
json result in promise
createConference
▸ createConference(bearerToken
, name
, options?
): Promise
<unknown
>
A promise for creating an enterprise conference
Parameters
Name | Type |
---|---|
bearerToken | string |
name | string |
options | AnyObject |
Returns
Promise
<unknown
>
result in promise
delete
▸ delete(endpoint
, params
, headers?
): Promise
<unknown
>
Send DELETE HTTP request to Apizee cloud platform
Parameters
Name | Type | Description |
---|---|---|
endpoint | string | URL Endpoint |
params | AnyObject | Request parameters |
headers? | AnyObject | Optional Request headers |
Returns
Promise
<unknown
>
json result in promise
get
▸ get(endpoint
, params
, headers?
, options?
): Promise
<unknown
>
Send GET HTTP request to Apizee cloud platform
Parameters
Name | Type | Description |
---|---|---|
endpoint | string | URL Endpoint |
params | AnyObject | Request parameters |
headers | AnyObject | Optional Request headers |
options | AnyObject | can be used to define options on request. Supported options : options.withCredentials |
Returns
Promise
<unknown
>
json result in promise
getConferenceList
▸ getConferenceList(bearerToken
): Promise
<unknown
>
A promise for getting an enterprise's conference list
Parameters
Name | Type |
---|---|
bearerToken | string |
Returns
Promise
<unknown
>
conferenceList in promise
getConnectedUserInformation
▸ getConnectedUserInformation(bearerToken
): Promise
<unknown
>
A promise for getting connected user's information from the apizee cloud
Parameters
Name | Type |
---|---|
bearerToken | string |
Returns
Promise
<unknown
>
result in promise
getConversationMediaList
▸ getConversationMediaList(convId
, apiKey
, options?
): Promise
<unknown
>
A promise for getting a conversation's media list
Parameters
Name | Type | Description |
---|---|---|
convId | number | |
apiKey | string | mandatory |
options | AnyObject |
Returns
Promise
<unknown
>
result in promise
getEnterpriseInformation
▸ getEnterpriseInformation(params?
, bearerToken
): Promise
<unknown
>
A promise for checking enterprise informations
Parameters
Name | Type |
---|---|
params | AnyObject |
bearerToken | string |
Returns
Promise
<unknown
>
result in promise
getEnterpriseTagList
▸ getEnterpriseTagList(enterpriseId
, bearerToken
, options?
): Promise
<unknown
>
Returns the all tags of a given enterprise.
Parameters
Name | Type |
---|---|
enterpriseId | string |
bearerToken | string |
options | AnyObject |
Returns
Promise
<unknown
>
Tag list.
getEnterpriseUserList
▸ getEnterpriseUserList(enterpriseId
, bearerToken
): Promise
<unknown
>
A promise for getting an enterprise's user list
Parameters
Name | Type |
---|---|
enterpriseId | string |
bearerToken | string |
Returns
Promise
<unknown
>
userList in promise
getLogLevel
▸ getLogLevel(): string
Get the actual log level
Returns
string
The actual log level
getOrCreateConversation
▸ getOrCreateConversation(conversation
, apiKey
, options?
): Promise
<unknown
>
A promise for getting a conversation or creating it if it does not exist
Parameters
Name | Type | Description |
---|---|---|
conversation | Conversation | conversation. |
apiKey | string | mandatory apiKey. |
options | AnyObject | optional parameters. |
Returns
Promise
<unknown
>
conversation info in promise
getPreferredCCS
▸ getPreferredCCS(apiKey
): Promise
<unknown
>
A promise for getting preferredCCS for apikey
Parameters
Name | Type |
---|---|
apiKey | string |
Returns
Promise
<unknown
>
result in promise
getSessionHistory
▸ getSessionHistory(webSessionId
, bearerToken
, options?
): Promise
<unknown
>
A promise for getting a session history between the user and a contact
Parameters
Name | Type |
---|---|
webSessionId | string |
bearerToken | string |
options | AnyObject |
Returns
Promise
<unknown
>
conversation history in promise
getSiteAgents
▸ getSiteAgents(apiKey
, siteKey
, options?
): Promise
<unknown
>
A promise for getting user's profile information from the apizee cloud
Parameters
Name | Type | Description |
---|---|---|
apiKey | string | mandatory apiKey |
siteKey | string | |
options | GetSiteAgentsOptions |
Returns
Promise
<unknown
>
result in promise
getUserPhotoUrl
▸ getUserPhotoUrl(id
): string
Returns photo url for user id
Parameters
Name | Type | Description |
---|---|---|
id | string | Contact id |
Returns
string
getUserProfile
▸ getUserProfile(apiKey
, userId
, bearerToken
): Promise
<unknown
>
A promise for getting user's profile information from the apizee cloud
Parameters
Name | Type | Description |
---|---|---|
apiKey | string | mandatory apiKey |
userId | string | |
bearerToken | string |
Returns
Promise
<unknown
>
result in promise
getWebSession
▸ getWebSession(session
, dest
, apiKey
): Promise
<unknown
>
A promise for getting a web session between the user and a contact
Parameters
Name | Type | Description |
---|---|---|
session | Session | |
dest | Contact | |
apiKey | string | mandatory apiKey |
Returns
Promise
<unknown
>
result in promise
getWebconf
▸ getWebconf(roomname
, options?
): Promise
<unknown
>
Retrieves a conference by its name.
Parameters
Name | Type |
---|---|
roomname | string |
options | AnyObject |
Returns
Promise
<unknown
>
getWebconfConversation
▸ getWebconfConversation(roomname
, apiKey
, options?
): Promise
<unknown
>
A promise for checking conference access
Parameters
Name | Type | Description |
---|---|---|
roomname | string | |
apiKey | string | mandatory apiKey |
options | AnyObject |
Returns
Promise
<unknown
>
result in promise
invalidateUserToken
▸ invalidateUserToken(bearerToken
): Promise
<unknown
>
A promise for invalidating an user token (logout)
Parameters
Name | Type |
---|---|
bearerToken | string |
Returns
Promise
<unknown
>
result in promise
loadGroupChatMessages
▸ loadGroupChatMessages(conversation
, session
, token?
): Promise
<unknown
>
A promise for pushing a new message to the session history
Parameters
Name | Type | Default value | Description |
---|---|---|---|
conversation | Conversation | undefined | |
session | Session | undefined | |
token | string | "" | Optional : this token will be used instead of session.getToken() if this parameter is set |
Returns
Promise
<unknown
>
result in promise
post
▸ post(endpoint
, params
, onProgress
, headers?
): Promise
<unknown
>
Send POST HTTP request to Apizee cloud platform
Parameters
Name | Type | Description |
---|---|---|
endpoint | string | URL Endpoint |
params | AnyObject | Request parameters |
onProgress | null | (...args : any []) => any | Callback on progress event |
headers? | AnyObject | Optional Request headers |
Returns
Promise
<unknown
>
json result in promise
pushConversationMedia
▸ pushConversationMedia(convId
, media
, apiKey
, options?
): Promise
<unknown
>
A promise for pushing a conversation media
Parameters
Name | Type | Description |
---|---|---|
convId | number | |
media | string | dataURI media |
apiKey | string | - |
options | AnyObject |
Returns
Promise
<unknown
>
result in promise
put
▸ put(endpoint
, params
, onProgress
, headers?
): Promise
<unknown
>
Send PUT HTTP request to Apizee cloud platform
Parameters
Name | Type | Description |
---|---|---|
endpoint | string | URL Endpoint |
params | AnyObject | Request parameters |
onProgress | null | (...args : any []) => any | Callback on progress event |
headers? | AnyObject | Optional Request headers |
Returns
Promise
<unknown
>
json result in promise
request
▸ request(endpoint
, params
, method
, onProgress
, headers?
, options?
): Promise
<unknown
>
Send HTTP request to Apizee cloud platform
Parameters
Name | Type | Description |
---|---|---|
endpoint | string | URL Endpoint |
params | AnyObject | Request parameters |
method | string | HTTP method (GET, POST, PUT, DELETE) |
onProgress | null | (...args : any []) => any | Callback on progress event |
headers | AnyObject | Optional Request headers |
options | AnyObject | can be used to define options on request. Supported options : options.withCredentials |
Returns
Promise
<unknown
>
json result in promise
saveGroupChatMessage
▸ saveGroupChatMessage(conversation
, session
, apiKey
, message
, uuid
, options?
): Promise
<unknown
>
A promise for pushing a new message to the conversation message history.
Parameters
Name | Type | Description |
---|---|---|
conversation | Conversation | |
session | Session | |
apiKey | string | apiKey. |
message | string | |
uuid | number | message identification number. |
options | AnyObject | Optional object. |
Returns
Promise
<unknown
>
result in promise
saveNewMessage
▸ saveNewMessage(webSessionId
, session
, destId
, message
, uuid
, apiKey
): Promise
<unknown
>
A promise for pushing a new message to the session history
Parameters
Name | Type |
---|---|
webSessionId | string |
session | Session |
destId | string |
message | string |
uuid | string |
apiKey | string |
Returns
Promise
<unknown
>
result in promise
setCloudURL
▸ setCloudURL(newUrl
): void
Sets Apizee Cloud url
Parameters
Name | Type |
---|---|
newUrl | string |
Returns
void
setConversationData
▸ setConversationData(convId
, data
, apiKey
, options?
): Promise
<unknown
>
A promise for setting conversation data
Parameters
Name | Type | Description |
---|---|---|
convId | string | |
data | string | json stringified data |
apiKey | string | mandatory apiKey. |
options | AnyObject |
Returns
Promise
<unknown
>
result in promise
setFetchRetries
▸ setFetchRetries(value
): void
Sets the number of retries if fetch requests don't work
Parameters
Name | Type | Description |
---|---|---|
value | number | The number to set |
Returns
void
setFetchRetryDelay
▸ setFetchRetryDelay(value
): void
Sets fetch RetryDelay. Delay in ms between fetch retry when sending request to apizee cloud. This delay is increased on each retry : retryDelay = retryDelay x retryNumber
Parameters
Name | Type | Description |
---|---|---|
value | number | The delay to set |
Returns
void
setLogLevel
▸ setLogLevel(level
): void
Set a new leg level
Parameters
Name | Type | Description |
---|---|---|
level | "silent" | "error" | "trace" | "debug" | "info" | "warn" | The desired log level |
Returns
void
updateConferencePresence
▸ updateConferencePresence(conversation
, session
, apiKey
): Promise
<unknown
>
A promise for updating user presence in the conference
Parameters
Name | Type | Description |
---|---|---|
conversation | Conversation | |
session | Session | |
apiKey | string | mandatory apiKey. |
Returns
Promise
<unknown
>
result in promise
updateWebconfTags
▸ updateWebconfTags(enterpriseId
, conferenceId
, tags
, bearerToken
): Promise
<unknown
>
Updates the tags of a given webconf.
Parameters
Name | Type | Description |
---|---|---|
enterpriseId | string | Enterprise ID. |
conferenceId | string | Webconf ID. |
tags | AnyObject | Array of tag IDs. |
bearerToken | string | User token. |
Returns
Promise
<unknown
>
uploadFile
▸ uploadFile(file
, bearerToken
, options
): Promise
<unknown
>
A promise for uploading a file
Parameters
Name | Type |
---|---|
file | Blob |
bearerToken | string |
options | AnyObject |
Returns
Promise
<unknown
>
result in promise
uploadSnapshot
▸ uploadSnapshot(media
, bearerToken
, options?
): Promise
<unknown
>
A promise for uploading a media snapshot
Parameters
Name | Type | Description |
---|---|---|
media | string | data uri |
bearerToken | string | |
options | AnyObject |
Returns
Promise
<unknown
>
result in promise
get
▸ Static
get(): default
Returns
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago