Modifier and Type | Field and Description |
---|---|
protected String |
apiEndpoint |
protected String |
apiVersion |
static String |
BANDWIDTH_API_ENDPOINT |
static String |
BANDWIDTH_API_SECRET |
static String |
BANDWIDTH_API_TOKEN |
static String |
BANDWIDTH_API_VERSION |
static String |
BANDWIDTH_USER_ID |
protected String |
baseUri |
protected static String |
DELETE |
protected static String |
GET |
protected org.apache.http.client.HttpClient |
httpClient |
protected static BandwidthRestClient |
INSTANCE |
protected static String |
POST |
protected static String |
PUT |
protected String |
secret |
protected String |
token |
protected String |
usersUri |
Modifier | Constructor and Description |
---|---|
protected |
BandwidthRestClient(String userId,
String token,
String secret,
String apiEndpoint,
String apiVersion) |
Modifier and Type | Method and Description |
---|---|
protected org.apache.http.client.methods.HttpUriRequest |
buildMethod(String method,
String path,
Map<String,Object> params) |
protected URI |
buildUri(String path) |
protected URI |
buildUri(String path,
List<org.apache.http.NameValuePair> queryStringParams) |
org.json.simple.JSONObject |
create(String uri,
Map<String,Object> params) |
void |
delete(String uri) |
void |
downloadFileTo(String uri,
File destFile) |
protected org.apache.http.client.methods.HttpDelete |
generateDeleteRequest(String path) |
protected org.apache.http.client.methods.HttpGet |
generateGetRequest(String path,
Map<String,Object> paramMap) |
protected org.apache.http.client.methods.HttpPost |
generatePostRequest(String path,
Map<String,Object> paramMap) |
protected org.apache.http.client.methods.HttpPut |
generatePutRequest(String path,
Map<String,Object> paramMap) |
RestResponse |
get(String uri,
Map<String,Object> params)
HTTP get method.
|
org.json.simple.JSONArray |
getArray(String uri,
Map<String,Object> params) |
String |
getBaseResourceUri(String path) |
static BandwidthRestClient |
getInstance() |
NumberInfo |
getNumberInfoByNumber(String number)
Returns information about this number.
|
org.json.simple.JSONObject |
getObject(String uri) |
org.json.simple.JSONObject |
getObjectFromLocation(String locationUrl) |
String |
getPath(String uri) |
String |
getUserResourceInstanceUri(String path,
String instanceId) |
String |
getUserResourceUri(String path) |
String |
getUserUri()
Returns API url with userid
|
protected RestResponse |
performRequest(org.apache.http.client.methods.HttpUriRequest request) |
RestResponse |
post(String uri,
Map<String,Object> params) |
protected RestResponse |
request(String path,
String method) |
protected RestResponse |
request(String path,
String method,
Map<String,Object> paramList) |
protected void |
setHeaders(org.apache.http.HttpRequest request) |
protected org.apache.http.client.methods.HttpUriRequest |
setupRequest(String path,
String method,
Map<String,Object> params) |
void |
uploadFile(String uri,
File sourceFile,
String contentType) |
protected static final String GET
protected static final String POST
protected static final String PUT
protected static final String DELETE
public static String BANDWIDTH_USER_ID
public static String BANDWIDTH_API_TOKEN
public static String BANDWIDTH_API_SECRET
public static String BANDWIDTH_API_ENDPOINT
public static String BANDWIDTH_API_VERSION
protected final String usersUri
protected final String baseUri
protected final String token
protected final String secret
protected org.apache.http.client.HttpClient httpClient
protected static BandwidthRestClient INSTANCE
protected String apiEndpoint
protected String apiVersion
public static BandwidthRestClient getInstance()
public String getUserUri()
public NumberInfo getNumberInfoByNumber(String number) throws IOException
number
- searching numberIOException
public RestResponse get(String uri, Map<String,Object> params) throws IOException
get
in interface Client
uri
- params
- IOException
protected void setHeaders(org.apache.http.HttpRequest request)
public org.json.simple.JSONArray getArray(String uri, Map<String,Object> params) throws IOException
IOException
public org.json.simple.JSONObject getObject(String uri) throws IOException
IOException
public org.json.simple.JSONObject getObjectFromLocation(String locationUrl) throws IOException
IOException
public org.json.simple.JSONObject create(String uri, Map<String,Object> params) throws IOException
IOException
public RestResponse post(String uri, Map<String,Object> params) throws IOException
IOException
public void delete(String uri) throws IOException
IOException
public void uploadFile(String uri, File sourceFile, String contentType) throws IOException
IOException
public void downloadFileTo(String uri, File destFile) throws IOException
IOException
protected RestResponse request(String path, String method) throws IOException
IOException
protected RestResponse request(String path, String method, Map<String,Object> paramList) throws IOException
IOException
protected RestResponse performRequest(org.apache.http.client.methods.HttpUriRequest request) throws IOException
IOException
protected org.apache.http.client.methods.HttpUriRequest setupRequest(String path, String method, Map<String,Object> params)
protected org.apache.http.client.methods.HttpUriRequest buildMethod(String method, String path, Map<String,Object> params)
protected org.apache.http.client.methods.HttpGet generateGetRequest(String path, Map<String,Object> paramMap)
protected org.apache.http.client.methods.HttpPost generatePostRequest(String path, Map<String,Object> paramMap)
protected org.apache.http.client.methods.HttpPut generatePutRequest(String path, Map<String,Object> paramMap)
protected org.apache.http.client.methods.HttpDelete generateDeleteRequest(String path)
Copyright © 2014. All Rights Reserved.