Skip to content

Commit

Permalink
Add optional parameter to support pagination in getTrayByType
Browse files Browse the repository at this point in the history
  • Loading branch information
mnovozhylov committed Jan 27, 2016
1 parent 733f01d commit 7ca3c7c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Release History

## 1.1.1
* Add optional parameter to support pagination in getTrayByType

## 1.1.0
* Get Categories (V1) is now fully depricated
* Added new Activities API - Assign to specific engagement the list of activities
Expand Down
13 changes: 13 additions & 0 deletions src/com/Upwork/api/Routers/Mc.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,19 @@ public JSONObject getTrays() throws JSONException {
public JSONObject getTrayByType(String username, String type) throws JSONException {
return oClient.get("/mc/v1/trays/" + username + "/" + type);
}

/**
* Get tray by type
*
* @param username Username
* @param type Tray type/name
* @param params Parameters
* @throws JSONException If error occurred
* @return {@link JSONObject}
*/
public JSONObject getTrayByType(String username, String type, HashMap<String, String> params) throws JSONException {
return oClient.get("/mc/v1/trays/" + username + "/" + type, params);
}

/**
* List thread details based on thread id
Expand Down
8 changes: 5 additions & 3 deletions test/com/Upwork/api/Routers/McTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ public class McTest extends Helper {

@Test public void getTrayByType() throws Exception {
Mc mc = new Mc(client);
JSONObject json = mc.getTrayByType("username", "inbox");
JSONObject json1 = mc.getTrayByType("username", "inbox");
JSONObject json2 = mc.getTrayByType("username", "inbox", new HashMap<String, String>());

assertTrue(json instanceof JSONObject);
assertTrue(json1 instanceof JSONObject);
assertTrue(json2 instanceof JSONObject);
}

@Test public void getThreadDetails() throws Exception {
Expand Down Expand Up @@ -77,4 +79,4 @@ public class McTest extends Helper {

assertTrue(json instanceof JSONObject);
}
}
}

0 comments on commit 7ca3c7c

Please sign in to comment.