hs.lib
Class HeyStaksMethods

java.lang.Object
  extended by hs.lib.HeyStaksMethods

public class HeyStaksMethods
extends java.lang.Object

The following class contains all the methods we need for interacting with HeyStaks.

Author:
aidan

Constructor Summary
HeyStaksMethods(CallBuilder build)
          Pass in the builder to set API params (key, secret, etc.)
 
Method Summary
 boolean addPageToStak(HsLogin login, int stakid, Page page)
          Add's a page to a given Stak
 Stak createStak(java.lang.String stakName, java.lang.String type, java.lang.String description, java.lang.String tags, HsLogin login)
          Creates a Stak on HeyStaks
 ListOfPages getPagesInStak(HsLogin login, Stak stak)
          Returns all the pages located inside a given Stak.
 HsUser getUserData(HsLogin login)
          Returns the users HeyStaks data.
 ListOfStaks getUsersStaks(HsLogin login)
          Gets a list of the Users Staks from HeyStaks.
 HsLogin HeyStaksAuth(java.lang.String username, java.lang.String password)
          When given a Username and password it will log the user into HeyStaks.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HeyStaksMethods

public HeyStaksMethods(CallBuilder build)
Pass in the builder to set API params (key, secret, etc.)

Parameters:
build - the CallBuilder object.
Method Detail

HeyStaksAuth

public HsLogin HeyStaksAuth(java.lang.String username,
                            java.lang.String password)
                     throws java.security.NoSuchAlgorithmException
When given a Username and password it will log the user into HeyStaks. This will allow us to get the userid and ask for further information.

Parameters:
username - the clients username.
password - the clients password.
Returns:
returns a HsLogin object containing all the info. Null if there was an error.
Throws:
java.security.NoSuchAlgorithmException

getUserData

public HsUser getUserData(HsLogin login)
Returns the users HeyStaks data.

Parameters:
login - The HsLogin object.
Returns:
the users HeyStaks data

createStak

public Stak createStak(java.lang.String stakName,
                       java.lang.String type,
                       java.lang.String description,
                       java.lang.String tags,
                       HsLogin login)
Creates a Stak on HeyStaks

Parameters:
stakName - The Staks name
type - It's type (Public or Private)
description - The Staks description
tags - The tags to be used with the Stak
login - the HsLogin object.
Returns:
If successful the created Stak else null.

addPageToStak

public boolean addPageToStak(HsLogin login,
                             int stakid,
                             Page page)
Add's a page to a given Stak

Parameters:
login - the login object.
stakid - the Stak ID
the - page object of the page to be added.
Returns:
true if added successfully, false otherwise.

getUsersStaks

public ListOfStaks getUsersStaks(HsLogin login)
Gets a list of the Users Staks from HeyStaks.

Parameters:
user - user object
Returns:
list of Staks if successful else null.

getPagesInStak

public ListOfPages getPagesInStak(HsLogin login,
                                  Stak stak)
Returns all the pages located inside a given Stak.

Parameters:
login - the HsLogin object
stak - the Stak.
Returns:
a list of all pages in a given Stak else null.