public class

GenericHandshakeClientImpl

extends AbstractHandshakeClient
implements GenericHandshakeClient<T>
java.lang.Object
   ↳ org.mule.modules.handshake.client.impl.AbstractHandshakeClient
     ↳ org.mule.modules.handshake.client.impl.GenericHandshakeClientImpl<T extends org.mule.modules.handshake.core.HandshakeObject>

Summary

Fields
private static final Pattern RESOURCE_PATTERN
private final String antiThrottleKey
private final String apiKey
private final Type elementType
private final String resourcePath
private final Type responseElementType
private final String securityToken
[Expand]
Inherited Fields
From class org.mule.modules.handshake.client.impl.AbstractHandshakeClient
Public Constructors
GenericHandshakeClientImpl(String baseUrl, String apiKey, String securityToken, String antiThrottleKey, String resourcePath, Type elementType, Type responseElementType)
Public Methods
T create(T t)
Create the given element on Handshake for the connected account
Collection<T> getAll(Map<String, String> filters, boolean fetchAllResults)
Get all the elements that match the given filters
T getById(String id)
Get one element, matching the given id.
T getByResourceUri(String resourceUri)
Get one element, matching the given Handshake Id (resourceUri)
HandshakeAPIResponse<T> paginate(Map<String, String> filters, Integer limit, Integer offset)
Pagiante elements that match the given filters
T update(String resourceUri, T edited)
Updates an existing element on Handshake, by providing its resourceUri and an object with the fields to update.
Protected Methods
StringBuilder extendGetBaseUrl(StringBuilder baseUrl)
This method is called by getBaseURL for the user to extend the base URL of its ServiceClient implementation.
static String extractIdFromResourceUri(String resourceUri)
Extracts the resource id from a resourceUri
[Expand]
Inherited Methods
From class org.mule.modules.handshake.client.impl.AbstractHandshakeClient
From class java.lang.Object
From interface org.mule.modules.handshake.client.GenericHandshakeClient

Fields

private static final Pattern RESOURCE_PATTERN

private final String antiThrottleKey

private final String apiKey

private final Type elementType

private final String resourcePath

private final Type responseElementType

private final String securityToken

Public Constructors

public GenericHandshakeClientImpl (String baseUrl, String apiKey, String securityToken, String antiThrottleKey, String resourcePath, Type elementType, Type responseElementType)

Parameters
baseUrl
apiKey
securityToken
antiThrottleKey
resourcePath
elementType
responseElementType

Public Methods

public T create (T t)

Create the given element on Handshake for the connected account

Parameters
t To be created
Returns
  • the created element

public Collection<T> getAll (Map<String, String> filters, boolean fetchAllResults)

Get all the elements that match the given filters

Parameters
filters To apply to the search
fetchAllResults If set to true, will try to fetch all the results, even if they are too much. WARNING: Could be slow and raise OutOfMemoryError
Returns
  • a Collection of all the elements matching the filters

public T getById (String id)

Get one element, matching the given id. The id is the user-specified one for the given entity. Note that not all entities support this field, so you might be looking for getByResourceUri(String)

Parameters
id Of the element to get
Returns
  • the element with the given id, or null if it doesn't exist

public T getByResourceUri (String resourceUri)

Get one element, matching the given Handshake Id (resourceUri)

Parameters
resourceUri Of the element to get
Returns
  • the element with the given id

public HandshakeAPIResponse<T> paginate (Map<String, String> filters, Integer limit, Integer offset)

Pagiante elements that match the given filters

Parameters
filters To apply to the search
limit The maximum amount of items to be returned
offset Pagination offset
Returns
  • an object with elements matching the filters, and metadata to retrieve more in another call (using "next" as "offset")

public T update (String resourceUri, T edited)

Updates an existing element on Handshake, by providing its resourceUri and an object with the fields to update. Because of the way Handshake references work, you should not include fields that you don't want updated, specially if they are nested objects, and should either leave them blank or include the corresponding resourceUri

Parameters
resourceUri Of the element to edit
edited Object with the fields to be edited
Returns
  • the updated element

Protected Methods

protected StringBuilder extendGetBaseUrl (StringBuilder baseUrl)

This method is called by getBaseURL for the user to extend the base URL of its ServiceClient implementation.

Parameters
baseUrl A builder with the Base Url
Returns
  • the builder, with the extended content as needed

protected static String extractIdFromResourceUri (String resourceUri)

Extracts the resource id from a resourceUri

Parameters
resourceUri From which to extract the resource ID
Returns
  • the id
Throws
InvalidHandshakeObjectReferenceException if the resourceUri is not well formed