public class AskFastRestClient extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_ENDPOINT |
static String |
KEYSERVER_PATH |
| Constructor and Description |
|---|
AskFastRestClient(String accountId,
String refreshToken)
Creates an AskFastRestClient instance.
|
AskFastRestClient(String accountId,
String refreshToken,
String accessToken)
Creates an AskFastRestClient instance.
|
AskFastRestClient(String accountId,
String refreshToken,
String accessToken,
String endpoint)
Creates an AskFastRestClient instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
buyAdapter(String adapterId)
Buy an adapter.
|
Dialog |
createDialog(Dialog dialog)
Create a dialog.
|
String |
getAccessToken()
Returns the access token.
|
Set<Adapter> |
getAdapters(String type)
Returns a set of
Adapters, optionally narrowed down by a type. |
List<DDRRecord> |
getDDRRecords(Collection<String> adapterIds,
Collection<String> adapterTypes,
String fromAddress,
String typeId,
String status,
Long startTime,
Long endTime,
String delimitedSessionKeys,
Integer offset,
Integer limit,
Boolean shouldGenerateCosts,
Boolean shouldIncludeServiceCosts)
Returns a list of
DDRRecords based on the give
parameters. |
Dialog |
getDialog(String dialogId)
Retrieve a dialog by its id.
|
Set<Dialog> |
getDialogs()
Returns the list of dialogs.
|
Set<Adapter> |
getFreeAdapters(String adapterType,
String address) |
List<Recording> |
getRecordings()
Get all the recordings of the current accountId
|
List<Recording> |
getRecordings(String accountId)
Get all the recordings linked to the specified account.
|
String |
getRefreshToken()
Returns the refresh token
|
void |
removeAdapter(String adapterId)
Remove an adapter from the logged in account.
// TODO: describe more specifically per adapter type
|
void |
removeDialog(String dialogId)
Delete a dialog.
|
Result |
startDialog(Map<String,String> addressMap,
Map<String,String> addressCcMap,
Map<String,String> addressBccMap,
String adapterID,
String senderName,
String subject,
String url)
Initiates a broadcast dialog request from a given adapterId.
|
Result |
startDialog(String toAddress,
AdapterType adapterType,
String url)
Initiates a dialog request from a given adapterId.
|
Result |
startDialog(String toAddress,
String adapterId,
String url)
Initiates a dialog request from a given adapterId.
|
Result |
startEmailDialog(String toAddress,
String url)
Initiate an Email request from a random Email adapter.
|
Result |
startPhoneDialog(String toAddress,
String url)
Initiate a phone call from a random call adapter.
|
Result |
startSMSDialog(String toAddress,
String url)
Initiate an SMS request from a random SMS adapter.
|
Adapter |
updateAdapter(String adapterId,
Adapter adapter)
Updates the adapter with the given
adapterId. |
Dialog |
updateDialog(String dialogId,
Dialog dialog)
Update a dialog.
|
public static final String DEFAULT_ENDPOINT
public static final String KEYSERVER_PATH
public AskFastRestClient(String accountId, String refreshToken)
accountId - Your accountIdrefreshToken - Your refreshTokenpublic AskFastRestClient(String accountId, String refreshToken, String accessToken)
accountId - Your accountIdrefreshToken - Your refreshTokenaccessToken - The access tokenpublic AskFastRestClient(String accountId, String refreshToken, String accessToken, String endpoint)
accountId - Your accountIdrefreshToken - Your refreshTokenaccessToken - The access tokenendpoint - The endpoint, the url of API endpoint you wish to use. (The default is set to: https://api.ask-fast.com)public Result startPhoneDialog(String toAddress, String url)
toAddress - The address which will be calledurl - This can be one of: Question json as
response. Question.QUESTION_TYPE_COMMENT createDialog(Dialog) methodRetrofitError.getBody() try to
deserialize it to Result and parse the reason for the
failure. A login error would however not be caught by this
Exception type.public Result startSMSDialog(String toAddress, String url)
toAddress - The mobile number to which an SMS is to be senturl - This can be one of: Question json as
response. Question.QUESTION_TYPE_COMMENT createDialog(Dialog) methodRetrofitError.getBody() try to
deserialize it to Result and parse the reason for the
failure. A login error would however not be caught by this
Exception type.public Result startEmailDialog(String toAddress, String url)
toAddress - An email address to which an email is to be senturl - This can be one of: Question json as
response. Question.QUESTION_TYPE_COMMENT createDialog(Dialog) methodRetrofitError.getBody() try to
deserialize it to Result and parse the reason for the
failure. A login error would however not be caught by this
Exception type.public Result startDialog(String toAddress, String adapterId, String url)
toAddress - The address for which an outbound dialog request is requested
to be initiated.adapterId - Specific adapterId (channel or communication mode) that is
either owned by you, or that you are a shared user of.url - This can be one of: Question json as
response. Question.QUESTION_TYPE_COMMENT createDialog(Dialog) methodRetrofitError.getBody() try to
deserialize it to Result and parse the reason for the
failure. A login error would however not be caught by this
Exception type.public Result startDialog(String toAddress, AdapterType adapterType, String url)
toAddress - The address for which an outbound dialog request is requested
to be initiated.adapterType - The type of the communication for which a dialog is initiated.
E.g. Call, SMS, Email etcurl - The url used to load the dialog. This can also be a dialogIdRetrofitError.getBody() try to
deserialize it to Result and parse the reason for the
failure. A login error would however not be caught by this
Exception type.public Result startDialog(Map<String,String> addressMap, Map<String,String> addressCcMap, Map<String,String> addressBccMap, String adapterID, String senderName, String subject, String url)
addressMap - The key value pairs of addressCcMap - The key value pairs of addressBccMap - The key value pairs of adapterID - The id identifying a particular mode of communication. These
values can be retried from ://portal.ask-fast.com in the adapters section.senderName - A senderName can be attached for medium types: SMS, EMAIL. For
SMS, the length should not exceed 11 charecters.subject - Only valid for an email adapter. The subject of the message to
be senturl - This can be one of: Question json as
response. Question.QUESTION_TYPE_COMMENT createDialog(Dialog) methodpublic Set<Adapter> getAdapters(String type)
Adapters, optionally narrowed down by a type.type - Optional. Possible values: sms, call, email or ussdtype.public Adapter updateAdapter(String adapterId, Adapter adapter)
adapterId.adapterId - The id of the adapteradapter - The adapterpublic void buyAdapter(String adapterId)
adapterId - The id of the adapterpublic void removeAdapter(String adapterId)
adapterId - The The id of the adapterpublic Dialog createDialog(Dialog dialog)
dialog - The dialogpublic Dialog getDialog(String dialogId)
dialogId - The id of the dialogpublic Dialog updateDialog(String dialogId, Dialog dialog)
dialogId - The id of the dialogdialog - The dialogpublic void removeDialog(String dialogId)
dialogId - The The id of the dialogpublic List<Recording> getRecordings()
public List<Recording> getRecordings(String accountId)
accountId - The accountId to for which all the recordings are recorded.public List<DDRRecord> getDDRRecords(Collection<String> adapterIds, Collection<String> adapterTypes, String fromAddress, String typeId, String status, Long startTime, Long endTime, String delimitedSessionKeys, Integer offset, Integer limit, Boolean shouldGenerateCosts, Boolean shouldIncludeServiceCosts) throws Exception
DDRRecords based on the give
parameters.adapterIds - adapterTypes - fromAddress - typeId - status - startTime - endTime - delimitedSessionKeys - offset - limit - shouldGenerateCosts - shouldIncludeServiceCosts - Exceptionpublic String getAccessToken() throws Exception
null, it requests the key server to give a fresh token.Exception - Thrown when refreshing the access token if the accountId or refreshToken is nullpublic String getRefreshToken()
Copyright © 2015 AskFast BV. All rights reserved.