public class DocumentsService
extends java.lang.Object
Constructor and Description |
---|
DocumentsService(MambuAPIService mambuAPIService)
Create a new documents service
|
Modifier and Type | Method and Description |
---|---|
boolean |
deleteDocument(java.lang.String documentId)
Delete document by its Id
|
java.lang.String |
getDocument(java.lang.String documentId)
Get base64 encoded document data by document id.
|
java.util.List<com.mambu.docs.shared.model.Document> |
getDocuments(MambuEntityType parentEntity,
java.lang.String parentId,
java.lang.Integer offset,
java.lang.Integer limit)
Get all Documents for a given parent entity
|
java.lang.String |
getImage(java.lang.String imageKey,
APIData.IMAGE_SIZE_TYPE sizeType)
Get an Image file using file's encoded key and the preferred image size
|
static MambuEntityType[] |
getSupportedEntities()
Get supported entity types
|
static boolean |
isSupported(MambuEntityType parentEntityType)
Is parent entity type supported by the API
|
com.mambu.docs.shared.model.Document |
uploadDocument(com.mambu.api.server.handler.documents.model.JSONDocument document)
Upload new Document using a JSONDocument object and as json request
|
@Inject public DocumentsService(MambuAPIService mambuAPIService)
mambuAPIService
- the service responsible with the connection to the serverpublic com.mambu.docs.shared.model.Document uploadDocument(com.mambu.api.server.handler.documents.model.JSONDocument document) throws MambuApiException
document
- the new document object to be uploaded containing all mandatory fieldsMambuApiException
public java.lang.String getDocument(java.lang.String documentId) throws MambuApiException
documentId
- the encoded key or id of the documentMambuApiException
public boolean deleteDocument(java.lang.String documentId) throws MambuApiException
documentId
- document id or encoded keyMambuApiException
public java.lang.String getImage(java.lang.String imageKey, APIData.IMAGE_SIZE_TYPE sizeType) throws MambuApiException
imageKey
- a key to access image file (e.g. client's profile picture key: client.getProfilePictureKey())sizeType
- a desired size to be returned. E.g LARGE, MEDIUM, SMALL_THUMB, TINY_THUMB. Can be null to get full
sizeMambuApiException
public java.util.List<com.mambu.docs.shared.model.Document> getDocuments(MambuEntityType parentEntity, java.lang.String parentId, java.lang.Integer offset, java.lang.Integer limit) throws MambuApiException
parentEntity
- MambuEntityType for which documents are retrieved. Must not be null. Documents for the following
entities are currently supported: Client, Group. LoanAccount, SavingsAccount, LoanProduct,
SavingsProduct, Branch, Centre, UserparentId
- entity id or encoded key for the parent entity. Example, client id for a MambuEntityType.CLIENT. Must
not be nulloffset
- pagination offsetlimit
- pagination limitMambuApiException
public static MambuEntityType[] getSupportedEntities()
public static boolean isSupported(MambuEntityType parentEntityType)
parentEntityType
- Mambu Entity type