public class AskFastRestClient
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_ENDPOINT |
static java.lang.String |
KEYSERVER_PATH |
| Constructor and Description |
|---|
AskFastRestClient(java.lang.String accountId,
java.lang.String refreshToken)
Creates an AskFastRestClient instance.
|
AskFastRestClient(java.lang.String accountId,
java.lang.String refreshToken,
java.lang.String accessToken)
Creates an AskFastRestClient instance.
|
AskFastRestClient(java.lang.String accountId,
java.lang.String refreshToken,
java.lang.String accessToken,
java.lang.String endpoint)
Creates an AskFastRestClient instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected static <T> java.util.Set<T> |
asOrderedSet(java.util.List<T> src) |
void |
buyAdapter(java.lang.String adapterId)
Buy an adapter.
|
Dialog |
createDialog(Dialog dialog)
Create a dialog.
|
java.lang.String |
getAccessToken()
Returns the access token.
|
Adapter |
getAdapter(java.lang.String adapterId)
Returns the corresponding adapter by id
|
java.util.Set<Adapter> |
getAdapters(java.lang.String type)
Returns a set of
Adapters, optionally narrowed down by a
type. |
java.util.Set<Adapter> |
getAllAdapters(java.lang.String type)
Returns adapters owned by your account and shared with
your account.
|
java.util.List<Adapter> |
getCapableAdapters(java.lang.String type) |
java.lang.Integer |
getDDRRecordCount(java.util.Collection<java.lang.String> adapterIds,
java.util.Collection<java.lang.String> adapterTypes,
java.lang.String fromAddress,
java.lang.String typeId,
java.lang.String status,
java.lang.Long startTime,
java.lang.Long endTime,
java.lang.String delimitedSessionKeys,
java.lang.Integer offset)
A faster fetch of the aggregation of all quantities in the
DDRRecord.getQuantity() based on the filtering criteria given |
java.util.List<DDRRecord> |
getDDRRecords(java.util.Collection<java.lang.String> adapterIds,
java.util.Collection<java.lang.String> adapterTypes,
java.lang.String fromAddress,
java.lang.String typeId,
java.lang.String status,
java.lang.Long startTime,
java.lang.Long endTime,
java.lang.String delimitedSessionKeys,
java.lang.Integer offset,
java.lang.Integer limit,
java.lang.Boolean shouldGenerateCosts,
java.lang.Boolean shouldIncludeServiceCosts)
Returns a list of
DDRRecords based on the give
parameters. |
Dialog |
getDialog(java.lang.String dialogId)
Retrieve a dialog by its id.
|
java.util.Set<Dialog> |
getDialogs()
Returns the list of dialogs.
|
java.util.Set<Dialog> |
getDialogsByName(java.lang.String name) |
java.util.Set<Adapter> |
getFreeAdapters(java.lang.String adapterType,
java.lang.String address)
Gets all the free adapters
|
java.util.List<Recording> |
getRecordings()
Get all the recordings of the current accountId
|
java.util.List<Recording> |
getRecordings(java.lang.String accountId)
Get all the recordings linked to the specified account.
|
java.lang.String |
getRefreshToken()
Returns the refresh token
|
RestResponse |
modifyCall(java.lang.String sessionId,
java.lang.String url)
Modify the existing call
|
RestResponse |
redirectCallToAnotherNumber(java.lang.String sessionId,
java.lang.String number)
Redirect the call to another number
|
void |
removeAdapter(java.lang.String adapterId)
Remove an adapter from the logged in account.
|
void |
removeDialog(java.lang.String dialogId)
Delete a dialog.
|
static void |
setOrigin(java.lang.String host) |
Result |
startDialog(java.util.Map<java.lang.String,java.lang.String> addressMap,
java.util.Map<java.lang.String,java.lang.String> addressCcMap,
java.util.Map<java.lang.String,java.lang.String> addressBccMap,
AdapterType adapterType,
java.lang.String adapterID,
java.lang.String senderName,
java.lang.String subject,
java.lang.String url)
Initiates a broadcast dialog request from a given adapterId.
|
Result |
startDialog(java.lang.String toAddress,
AdapterType adapterType,
java.lang.String senderName,
java.lang.String subject,
java.lang.String url)
Initiates a dialog request from a given adapterId.
|
Result |
startDialog(java.lang.String toAddress,
java.lang.String adapterId,
java.lang.String senderName,
java.lang.String subject,
java.lang.String url)
Initiates a dialog request from a given adapterId.
|
Result |
startEmailDialog(java.lang.String toAddress,
java.lang.String senderName,
java.lang.String subject,
java.lang.String url)
Initiate an Email request from a random Email adapter.
|
Result |
startPhoneDialog(java.lang.String toAddress,
java.lang.String url)
Initiate a phone call from a random call adapter.
|
Result |
startSMSDialog(java.lang.String toAddress,
java.lang.String senderName,
java.lang.String url)
Initiate an SMS request from a random SMS adapter.
|
Adapter |
updateAdapter(java.lang.String adapterId,
Adapter adapter)
Updates the adapter with the given
adapterId. |
Dialog |
updateDialog(java.lang.String dialogId,
Dialog dialog)
Update a dialog.
|
public static final java.lang.String DEFAULT_ENDPOINT
public static final java.lang.String KEYSERVER_PATH
public AskFastRestClient(java.lang.String accountId,
java.lang.String refreshToken)
accountId - Your accountIdrefreshToken - Your refreshTokenpublic AskFastRestClient(java.lang.String accountId,
java.lang.String refreshToken,
java.lang.String accessToken)
accountId - Your accountIdrefreshToken - Your refreshTokenaccessToken - The access tokenpublic AskFastRestClient(java.lang.String accountId,
java.lang.String refreshToken,
java.lang.String accessToken,
java.lang.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(java.lang.String toAddress, java.lang.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(java.lang.String toAddress, java.lang.String senderName, java.lang.String url)
toAddress - The mobile number to which an SMS is to be sentsenderName - A senderName can be attached for medium types: SMS, EMAIL. For
SMS, the length should not exceed 11 charecters.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 startEmailDialog(java.lang.String toAddress, java.lang.String senderName, java.lang.String subject, java.lang.String url)
toAddress - An email address to which an email is to be sentsenderName - A senderName can be attached for medium types: SMS, EMAIL. For
SMS, the length should not exceed 11 charecters. * @param
subject Only valid for an email adapter. The subject of the
message to be sentsubject - 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)
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(java.lang.String toAddress, java.lang.String adapterId, java.lang.String senderName, java.lang.String subject, java.lang.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.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)
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(java.lang.String toAddress, AdapterType adapterType, java.lang.String senderName, java.lang.String subject, java.lang.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 etcsenderName - 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 - 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(java.util.Map<java.lang.String,java.lang.String> addressMap, java.util.Map<java.lang.String,java.lang.String> addressCcMap, java.util.Map<java.lang.String,java.lang.String> addressBccMap, AdapterType adapterType, java.lang.String adapterID, java.lang.String senderName, java.lang.String subject, java.lang.String url)
addressMap - The key value pairs of {toAddress, recipientName}addressCcMap - The key value pairs of {ccAddress, recipientName}. Used in
case of an email adapter onlyaddressBccMap - The key value pairs of {bccAddress, recipientName}. Used in
case of an email adapter onlyadapterType - The type of communication opted for this outbound dialog. The
first adapter of the given type is chosen if there are
multiple ones exist. Usually either one of adapterType or
adapterID.adapterID - The id identifying a particular mode of communication. These
values can be retried from
ASK-Fast Portal 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)
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 java.util.Set<Adapter> getAdapters(java.lang.String type)
Adapters, optionally narrowed down by a
type.type - Optional. Possible values: sms, call,
email or ussdtype.public java.util.Set<Adapter> getAllAdapters(java.lang.String type)
type - protected static <T> java.util.Set<T> asOrderedSet(java.util.List<T> src)
public Adapter getAdapter(java.lang.String adapterId)
adapterId - The adapterId to be fetchedpublic Adapter updateAdapter(java.lang.String adapterId, Adapter adapter)
adapterId.adapterId - The id of the adapteradapter - The adapterpublic void buyAdapter(java.lang.String adapterId)
adapterId - The id of the adapterpublic void removeAdapter(java.lang.String adapterId)
adapterId - The The id of the adapterpublic java.util.Set<Adapter> getFreeAdapters(java.lang.String adapterType, java.lang.String address)
adapterType - The type of the adapteraddress - The address of adapter looking forpublic java.util.List<Adapter> getCapableAdapters(java.lang.String type)
public Dialog createDialog(Dialog dialog)
dialog - The dialogpublic java.util.Set<Dialog> getDialogs()
public java.util.Set<Dialog> getDialogsByName(java.lang.String name)
public Dialog getDialog(java.lang.String dialogId)
dialogId - The id of the dialogpublic Dialog updateDialog(java.lang.String dialogId, Dialog dialog)
dialogId - The id of the dialogdialog - The dialogpublic void removeDialog(java.lang.String dialogId)
dialogId - The The id of the dialogpublic java.util.List<Recording> getRecordings()
public java.util.List<Recording> getRecordings(java.lang.String accountId)
accountId - The accountId to for which all the recordings are recorded.public java.util.List<DDRRecord> getDDRRecords(java.util.Collection<java.lang.String> adapterIds, java.util.Collection<java.lang.String> adapterTypes, java.lang.String fromAddress, java.lang.String typeId, java.lang.String status, java.lang.Long startTime, java.lang.Long endTime, java.lang.String delimitedSessionKeys, java.lang.Integer offset, java.lang.Integer limit, java.lang.Boolean shouldGenerateCosts, java.lang.Boolean shouldIncludeServiceCosts) throws java.lang.Exception
DDRRecords based on the give
parameters.adapterIds - The list of adapterIds for which ddrRecords must be fetchedadapterTypes - Fetch ddrRecords based on the channel usedfromAddress - Fetch ddrRecords based on the fromAddresstypeId - Fetch ddrRecords based on the type of cost attached. E.g.
incoming, outgoing, tts processing etcstatus - Fetch ddrRecords based on the status of the communicationstartTime - Fetch ddrRecords based on a date rangeendTime - Fetch ddrRecords based on a date rangedelimitedSessionKeys - Fetch ddrRecords based on the sessionKeys generated per
communication address.offset - Skip the given number of ddrRecordslimit - Limit the fetchshouldGenerateCosts - Force recalculating the costs for the communication or eventshouldIncludeServiceCosts - Force recalculating the service costs for the communication or
eventjava.lang.Exception - Error in ddr fetchingpublic java.lang.Integer getDDRRecordCount(java.util.Collection<java.lang.String> adapterIds,
java.util.Collection<java.lang.String> adapterTypes,
java.lang.String fromAddress,
java.lang.String typeId,
java.lang.String status,
java.lang.Long startTime,
java.lang.Long endTime,
java.lang.String delimitedSessionKeys,
java.lang.Integer offset)
throws java.lang.Exception
DDRRecord.getQuantity() based on the filtering criteria givenadapterIds - The list of adapterIds for which ddrRecords must be fetchedadapterTypes - Fetch ddrRecords based on the channel usedfromAddress - Fetch ddrRecords based on the fromAddresstypeId - Fetch ddrRecords based on the type of cost attached. E.g.
incoming, outgoing, tts processing etcstatus - Fetch ddrRecords based on the status of the communicationstartTime - Fetch ddrRecords based on a date rangeendTime - Fetch ddrRecords based on a date rangedelimitedSessionKeys - Fetch ddrRecords based on the sessionKeys generated per
communication address.offset - Skip the given number of ddrRecordsjava.lang.Exception - Error in ddr fetchingpublic RestResponse modifyCall(java.lang.String sessionId, java.lang.String url)
sessionId - url - public RestResponse redirectCallToAnotherNumber(java.lang.String sessionId, java.lang.String number)
sessionId - number - public java.lang.String getAccessToken()
throws java.lang.Exception
null, it
requests the key server to give a fresh token.java.lang.Exception - Thrown when refreshing the access token if the accountId or
refreshToken is nullpublic java.lang.String getRefreshToken()
public static void setOrigin(java.lang.String host)
Copyright © 2018 AskFast BV. All Rights Reserved.