public class

HandshakeConnector

extends Object
java.lang.Object
   ↳ org.mule.modules.handshake.core.HandshakeConnector
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Handshake provides the B2B Commerce platform for manufacturers and distributors that powers standout ordering experiences both in-person and online. Companies using Handshake transform their sales effectiveness and drive operational efficiency, delighting customers and growing lasting relationships.

Summary

Fields
private String antiThrottleKey Secret key provided by Handshake to by-pass throttling checks.
private String apiKey
private HandshakeClientProvider clientProvider
private String endpoint Endpoint to which the Connector should connect and call API methods
private String securityToken
Public Constructors
HandshakeConnector()
Public Methods
void connect(String apiKey, String securityToken)
Connect
String connectionId()
The key to identify the connection
Address createAddress(Address address)
Creates a Address on Handshake
Category createCategory(Category category)
Creates a Category on handshake
Customer createCustomer(Customer customer)
Creates a Customer on Handshake Take into account than neither the CustomerGroup nor the UserGroup can be created alongside the Customer You can either let them be the default values for your account (by not specifying them), or use their resourceUri property to reference an existing one
Item createItem(Item item)
Creates a Item on handshake
List<Item> createItems(List<Item> items)
Creates Items on handshake
Order createOrder(Order order)
Creates a Order on handshake
void disconnect()
Disconnect
Collection<Customer> findCustomers(Map<String, String> filters, boolean fetchAllResults)
Find all customers for the connected account that match the filters
Collection<Item> findItems(Map<String, String> filters, boolean fetchAllResults)
Get all items for the connected account that match the filters
Collection<Order> findOrders(Map<String, String> filters, boolean fetchAllResults)
Find all Sales Orders for the connected account that match the filters
Address getAddress(String resourceUri)
Get a Address, given its id
String getAntiThrottleKey()
Category getCategory(String id)
Get a Category, given its id
Customer getCustomer(String resourceUri)
Get a Customer, given its resourceUri
CustomerGroup getCustomerGroup(String id)
Get a CustomerGroup, given its id
String getEndpoint()
Item getItem(String resourceUri)
Get a Item, given its resourceUri
Order getOrder(String resourceUri)
Get a Order, given its resourceUri
UserGroup getUserGroup(String id)
Get a UserGroup, given its id
boolean isConnected()
Are we connected
void setAntiThrottleKey(String antiThrottleKey)
void setEndpoint(String endpoint)
Address updateAddress(String resourceUri, Address address)
Updates a Address on Handshake, given its resourceUri
Customer updateCustomer(String resourceUri, Customer customer)
Updates a Customer on Handshake, given her resourceUri Take into account than neither the CustomerGroup nor the UserGroup can be created alongside the Customer You can either let them be the default values for your account (by not specifying them), or use their resourceUri property to reference an existing one
Item updateItem(String resourceUri, Item item)
Updates a Item on Handshake, given its resourceUri
[Expand]
Inherited Methods
From class java.lang.Object

Fields

private String antiThrottleKey

Secret key provided by Handshake to by-pass throttling checks. If you hit API-call limits, contact Handshake to require one

private String apiKey

private HandshakeClientProvider clientProvider

private String endpoint

Endpoint to which the Connector should connect and call API methods

private String securityToken

Public Constructors

public HandshakeConnector ()

Public Methods

public void connect (String apiKey, String securityToken)

Connect

Parameters
apiKey The API key for the user
securityToken Used for sensitive data encryption. Please refer to http://www.handshake-app.com/help/kb/api/api-authentication
Throws
ConnectionException

public String connectionId ()

The key to identify the connection

public Address createAddress (Address address)

Creates a Address on Handshake

Parameters
address To create
Returns
  • the created address

public Category createCategory (Category category)

Creates a Category on handshake

Parameters
category To create
Returns
  • the created category

public Customer createCustomer (Customer customer)

Creates a Customer on Handshake Take into account than neither the CustomerGroup nor the UserGroup can be created alongside the Customer You can either let them be the default values for your account (by not specifying them), or use their resourceUri property to reference an existing one

Parameters
customer To create. Mandatory fields are ID, name and billTo (which has to be a new Address, and not a reference)
Returns
  • the created customer

public Item createItem (Item item)

Creates a Item on handshake

Parameters
item To create
Returns
  • the created item

public List<Item> createItems (List<Item> items)

Creates Items on handshake

Parameters
items To create
Returns
  • a list of the items created (if everything is ok, it should match the provided list)

public Order createOrder (Order order)

Creates a Order on handshake

Parameters
order To create
Returns
  • the created order

public void disconnect ()

Disconnect

public Collection<Customer> findCustomers (Map<String, String> filters, boolean fetchAllResults)

Find all customers for the connected account that match the filters

Parameters
filters Allowed values are: "customerGroup", "userGroup", "ctime" and "mtime" (for creation and modification times, check operators in http://www.handshake-app.com/help/kb/api/web-services-resources-overview) NOTE: filter values refer to the user-defined IDs, and not to the HandShake id
fetchAllResults Set to true if you want to get the full result instead of a paged one. WARNING: This could be slow and raise OutOfMemoryError if the result is too long
Returns
  • a Collection of all the Customers matching the filters

public Collection<Item> findItems (Map<String, String> filters, boolean fetchAllResults)

Get all items for the connected account that match the filters

Parameters
filters To apply. Allowed filters are category (by Handshake id), manufacturer (by Handshake id), order (to get items from a specific Order), search (only items with a sku or name that match will be returned), sku (you'll get either 1 or 0 results)
fetchAllResults Set to true if you want to get the full result instead of a paged one. WARNING: This could be slow and raise OutOfMemoryError if the result is too long
Returns
  • A Collection of items for the connected account that match the filters

public Collection<Order> findOrders (Map<String, String> filters, boolean fetchAllResults)

Find all Sales Orders for the connected account that match the filters

Parameters
filters Allowed values are: "customerID", "status", "ctime" and "mtime" (for creation and modification times, check operators in http://www.handshake-app.com/help/kb/api/web-services-resources-overview)
fetchAllResults Set to true if you want to get the full result instead of a paged one. WARNING: This could be slow and raise OutOfMemoryError if the result is too long
Returns
  • a Collection of all the Sales Orders matching the filters

public Address getAddress (String resourceUri)

Get a Address, given its id

Parameters
resourceUri Of the Address to get. The uri is Handshake's uid, as returned by the creation method (like '/api/v2/<resource>/<id>')
Returns

public String getAntiThrottleKey ()

public Category getCategory (String id)

Get a Category, given its id

Parameters
id Of the Category to get. The id is the one specified on creation, and not Handshake's uid
Returns
  • the category with the given id, or null if it doesn't exist

public Customer getCustomer (String resourceUri)

Get a Customer, given its resourceUri

Parameters
resourceUri Of the Customer to get. The resourceUri is Handshake's uid, as returned by the creation method (like '/api/v2/<resource>/<id>')
Returns
  • the customer with the given resourceUri, or null if it doesn't exist

public CustomerGroup getCustomerGroup (String id)

Get a CustomerGroup, given its id

Parameters
id Of the CustomerGroup to get. The id is the one specified on creation, and not Handshake's uid
Returns
  • the customer group with the given id, or null if it doesn't exist

public String getEndpoint ()

public Item getItem (String resourceUri)

Get a Item, given its resourceUri

Parameters
resourceUri Of the Item to get. The resourceUri is Handshake's uid, as returned by the creation method (like '/api/v2/<resource>/<id>')
Returns
  • the item with the given resourceUri, or null if it doesn't exist

public Order getOrder (String resourceUri)

Get a Order, given its resourceUri

Parameters
resourceUri Of the Order to get. The uri is Handshake's uid, as returned by the creation method (like '/api/v2/<resource>/<id>')
Returns

public UserGroup getUserGroup (String id)

Get a UserGroup, given its id

Parameters
id Of the UserGroup to get. The id is the one specified on creation, and not Handshake's uid
Returns
  • the user group with the given id, or null if it doesn't exist

public boolean isConnected ()

Are we connected

public void setAntiThrottleKey (String antiThrottleKey)

Parameters
antiThrottleKey

public void setEndpoint (String endpoint)

Parameters
endpoint

public Address updateAddress (String resourceUri, Address address)

Updates a Address on Handshake, given its resourceUri

Parameters
resourceUri Of the Address to edit (if you skip this, you should include the resourceUri attribute in the address)
address With the changes to update. You should only include those fields that you want to update, specially if referencing existing nested objects
Returns
  • the updated address

public Customer updateCustomer (String resourceUri, Customer customer)

Updates a Customer on Handshake, given her resourceUri Take into account than neither the CustomerGroup nor the UserGroup can be created alongside the Customer You can either let them be the default values for your account (by not specifying them), or use their resourceUri property to reference an existing one

Parameters
resourceUri Of the Customer to update (if you skip this, you should include the resourceUri attribute in the customer)
customer With the changes to update. You should only include those fields that you want to update, specially if referencing existing nested objects (e.g. try not to include billing address information if it hasn't changed)
Returns
  • the updated customer

public Item updateItem (String resourceUri, Item item)

Updates a Item on Handshake, given its resourceUri

Parameters
resourceUri Of the Item to edit (if you skip this, you should include the resourceUri attribute in the item)
item With the changes to update. You should only include those fields that you want to update, specially if referencing existing nested objects
Returns
  • the updated item