Package com.onfido.api
Class ResourceManager
- java.lang.Object
-
- com.onfido.api.ResourceManager
-
- Direct Known Subclasses:
AddressManager,ApplicantManager,CheckManager,DocumentManager,ExtractionManager,LivePhotoManager,LiveVideoManager,MotionCaptureManager,ReportManager,SdkTokenManager,WebhookManager
public abstract class ResourceManager extends Object
Manager class for all resource types. Contains methods for interacting with the API.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedResourceManager(String basePath, Config config, okhttp3.OkHttpClient client)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddFormDataParam(okhttp3.MultipartBody.Builder builder, String key, Object value)protected StringdeleteRequest(String path)Makes a DELETE http call to the specified pathprotected FileDownloaddownloadRequest(String path)Makes a GET http call to the specified pathprotected Stringget(String path)Makes a GET http call to the specified pathprotected Stringpost(String path, String body)Makes a POST http call to the specified path and request body.protected Stringput(String path, String body)Makes a PUT http call to the specified path and request body.protected byte[]readInputStream(InputStream inputStream)Converts an InputStream to a byte[] to be sent as part of a multipart request bodyprotected StringuploadRequest(String path, okhttp3.RequestBody body)Makes a POST http call to the specified path and multipart request body.
-
-
-
Method Detail
-
post
protected String post(String path, String body) throws OnfidoException
Makes a POST http call to the specified path and request body.- Parameters:
path- the path to the desired endpointbody- the request body for the http call- Returns:
- the response as a json string
- Throws:
OnfidoException- the onfido exception
-
get
protected String get(String path) throws OnfidoException
Makes a GET http call to the specified path- Parameters:
path- the path to the desired endpoint- Returns:
- the response as a json string
- Throws:
OnfidoException- the onfido exception
-
put
protected String put(String path, String body) throws OnfidoException
Makes a PUT http call to the specified path and request body.- Parameters:
path- the path to the desired endpointbody- the request body for the http call- Returns:
- the response as a json string
- Throws:
OnfidoException- the onfido exception
-
deleteRequest
protected String deleteRequest(String path) throws OnfidoException
Makes a DELETE http call to the specified path- Parameters:
path- the path to the desired endpoint- Returns:
- the response as a json string
- Throws:
OnfidoException- the onfido exception
-
uploadRequest
protected String uploadRequest(String path, okhttp3.RequestBody body) throws OnfidoException
Makes a POST http call to the specified path and multipart request body.- Parameters:
path- the path to the desired endpointbody- the request body for the http call- Returns:
- the response as a json string
- Throws:
OnfidoException- the onfido exception
-
downloadRequest
protected FileDownload downloadRequest(String path) throws OnfidoException
Makes a GET http call to the specified path- Parameters:
path- the path to the desired endpoint- Returns:
- the file content and type in the form of a FileDownload object
- Throws:
OnfidoException- the onfido exception
-
readInputStream
protected byte[] readInputStream(InputStream inputStream) throws IOException
Converts an InputStream to a byte[] to be sent as part of a multipart request body- Parameters:
inputStream- the InputStream- Returns:
- the byte[] made from the InputStream
- Throws:
IOException- the io exception
-
-