diff --git a/settings.xml b/settings.xml new file mode 100644 index 0000000..c02de4d --- /dev/null +++ b/settings.xml @@ -0,0 +1,9 @@ + + ${user.home}/.m2/repository + true + false + false + \ No newline at end of file diff --git a/src/main/java/com/podio/conversation/Conversation.java b/src/main/java/com/podio/conversation/Conversation.java index bf5e262..88d8e7a 100644 --- a/src/main/java/com/podio/conversation/Conversation.java +++ b/src/main/java/com/podio/conversation/Conversation.java @@ -23,6 +23,16 @@ public class Conversation { */ private List participants; + private int unreadCount; + private String excerpt; + @JsonProperty("unread_count") + public int getUnreadCount() { + return unreadCount; + } + public String getExcerpt() { + return excerpt; + } + @JsonProperty("conversation_id") public int getId() { return id; @@ -32,6 +42,13 @@ public int getId() { public void setId(int id) { this.id = id; } + @JsonProperty("unread_count") + public void setUnreadCount(int unreadCount) { + this.unreadCount = unreadCount; + } + public void setExcerpt(String excerpt) { + this.excerpt =excerpt; + } public String getSubject() { return subject; diff --git a/src/main/java/com/podio/conversation/ConversationAPI.java b/src/main/java/com/podio/conversation/ConversationAPI.java index 1b0a6ec..4944c8c 100644 --- a/src/main/java/com/podio/conversation/ConversationAPI.java +++ b/src/main/java/com/podio/conversation/ConversationAPI.java @@ -94,6 +94,14 @@ public List getConversationsOnObject(Reference object) { }); } + + public List getConversations() { + WebResource resource = getResourceFactory().getApiResource( + "/conversation/"); + resource=resource.queryParam("limit","15"); + return resource.get(new GenericType>() {}); + } + /** * Creates a reply to the conversation. * @@ -110,4 +118,10 @@ public int addReply(int conversationId, String text) { MediaType.APPLICATION_JSON_TYPE) .get(MessageCreateResponse.class).getMessageId(); } + public void markRead(int conversationId) { + getResourceFactory() + .getApiResource("/conversation/" + conversationId + "/read") + .method("POST"); + } + } diff --git a/src/main/java/com/podio/notification/Notification.java b/src/main/java/com/podio/notification/Notification.java new file mode 100644 index 0000000..7fbaff9 --- /dev/null +++ b/src/main/java/com/podio/notification/Notification.java @@ -0,0 +1,34 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package com.podio.notification; + +import java.util.List; +import org.codehaus.jackson.annotate.JsonProperty; + +/** + * + * @author MrBr + */ +public class Notification { + private List nots; + private NotificationContext context; + @JsonProperty("notifications") + public List getNotifications(){ + return this.nots; + } + public NotificationContext getContext(){ + return this.context; + } + public void setContext(NotificationContext context){ + this.context=context; + } + + @JsonProperty("notifications") + public void setNotifications(List nots){ + this.nots=nots; + } +} diff --git a/src/main/java/com/podio/notification/NotificationAPI.java b/src/main/java/com/podio/notification/NotificationAPI.java index cd0e880..24061df 100644 --- a/src/main/java/com/podio/notification/NotificationAPI.java +++ b/src/main/java/com/podio/notification/NotificationAPI.java @@ -1,19 +1,21 @@ package com.podio.notification; -import java.util.Collection; -import java.util.List; - -import javax.ws.rs.core.MediaType; - -import org.joda.time.DateTime; - import com.podio.BaseAPI; import com.podio.ResourceFactory; import com.podio.common.CSVUtil; import com.podio.common.Empty; +import com.podio.conversation.Conversation; import com.podio.serialize.DateTimeUtil; import com.sun.jersey.api.client.GenericType; import com.sun.jersey.api.client.WebResource; +import com.sun.jersey.core.util.MultivaluedMapImpl; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import org.joda.time.DateTime; /** * A notification is an information about an event that occured in Podio. A @@ -38,7 +40,14 @@ public int getInboxNewCount() { return resource.get(InboxNewCount.class).getNewNotifications(); } - + public List getUnviewedNotifications(MultivaluedMap filters) { + WebResource resource = getResourceFactory().getApiResource( + "/notification/"); +// MultivaluedMap filters=new MultivaluedMap(); + resource=resource.queryParams(filters); + return resource.get(new GenericType>() { + }); + } /** * Mark the notification as viewed. This will move the notification from the * inbox to the viewed archive. diff --git a/src/main/java/com/podio/notification/NotificationContext.java b/src/main/java/com/podio/notification/NotificationContext.java new file mode 100644 index 0000000..5758881 --- /dev/null +++ b/src/main/java/com/podio/notification/NotificationContext.java @@ -0,0 +1,22 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package com.podio.notification; + +/** + * + * @author MrBr + */ +public class NotificationContext { + private String link; + public String getLink(){ + return this.link; + } + public void setLink(String link){ + this.link=link; + } + +} diff --git a/src/main/java/com/podio/notification/NotificationData.java b/src/main/java/com/podio/notification/NotificationData.java new file mode 100644 index 0000000..7db52af --- /dev/null +++ b/src/main/java/com/podio/notification/NotificationData.java @@ -0,0 +1,60 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package com.podio.notification; + +import com.podio.status.StatusQuestion; +import org.codehaus.jackson.annotate.JsonProperty; + +/** + * + * @author MrBr + */ +public class NotificationData { + private String value; + private String text; + private String type; + private StatusQuestion questionOption; + public void setValue(String value){ + this.value=value; + } + public String getValue(){ + return this.value; + } + public void setText(String text){ + this.text=text; + } + public String getText(){ + return this.text; + } + public void setType(String type){ + this.type=type; + } + public String getType(){ + return this.type; + } + @JsonProperty("question_option") + public void setQuestionOption(StatusQuestion questionOption){ + this.questionOption=questionOption; + } + @JsonProperty("question_option") + public StatusQuestion getQuestionOption(){ + return this.questionOption; + } + public String getInfoText(){ + if("like".equals(type)){ + return "Liked"; + }else if(value!=null){ + return value; + }else if(text!=null){ + return text; + }else if(questionOption!=null){ + return questionOption.getText(); + }else{ + return null; + } + } +} diff --git a/src/main/java/com/podio/notification/NotificationMini.java b/src/main/java/com/podio/notification/NotificationMini.java new file mode 100644 index 0000000..5bb8e65 --- /dev/null +++ b/src/main/java/com/podio/notification/NotificationMini.java @@ -0,0 +1,65 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package com.podio.notification; + +import org.codehaus.jackson.annotate.JsonProperty; + +/** + * + * @author MrBr + */ +public class NotificationMini { + private int id;//notification_id + private String textShort; + private String text; + private NotificationData data; + private String viewedOn; + private Boolean starred; + @JsonProperty("notification_id") + public int getId(){ + return this.id; + } + @JsonProperty("viewed_on") + public String getViewedOn(){ + return this.viewedOn; + } + public Boolean getStarred(){ + return this.starred; + } + + public String getText(){ + return this.text; + } + public String getNotificationShortText(){ + return textShort; + } + @JsonProperty("notification_id") + public void setId(int id){ + this.id=id; + } + @JsonProperty("viewed_on") + public void setViewedOn(String viewedOn){ + this.viewedOn=viewedOn; + } + public void setStarred(Boolean starred){ + this.starred=starred; + } + + public void setText(String text){ + this.text=text; + } + @JsonProperty("text_short") + public void setNotificationShortText(String TextShort){ + textShort=TextShort; + } + public NotificationData getData(){ + return this.data; + } + public void setData(NotificationData data){ + this.data=data; + } +} diff --git a/src/main/java/com/podio/notification/NotificationRef.java b/src/main/java/com/podio/notification/NotificationRef.java new file mode 100644 index 0000000..d42439e --- /dev/null +++ b/src/main/java/com/podio/notification/NotificationRef.java @@ -0,0 +1,35 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package com.podio.notification; + +/** + * + * @author MrBr + */ +public class NotificationRef { + private int id; + private String type; + public void setValue(int id){ + this.id=id; + } + public int getValue(){ + return this.id; + } + public void setType(String type){ + this.type=type; + } + public String getType(){ + return this.type; + } + public String getInfoValue(){ + if("status".equals(type)){ + return "Liked"; + }else{ + return "UNKNOW TYPE"; + } + } +} diff --git a/src/main/java/com/podio/status/StatusQuestion.java b/src/main/java/com/podio/status/StatusQuestion.java new file mode 100644 index 0000000..937df14 --- /dev/null +++ b/src/main/java/com/podio/status/StatusQuestion.java @@ -0,0 +1,22 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package com.podio.status; + +/** + * + * @author MrBr + */ +public class StatusQuestion { + private String text; + public void setText(String text){ + this.text=text; + } + public String getText(){ + return this.text; + } + +} diff --git a/src/main/java/com/podio/task/TaskAPI.java b/src/main/java/com/podio/task/TaskAPI.java index 2532432..780f4ef 100644 --- a/src/main/java/com/podio/task/TaskAPI.java +++ b/src/main/java/com/podio/task/TaskAPI.java @@ -11,6 +11,7 @@ import com.podio.common.Empty; import com.podio.common.Reference; import com.sun.jersey.api.client.GenericType; +import com.sun.jersey.api.client.WebResource; /** * Tasks are used to track what work has to be done. Tasks have the following @@ -236,4 +237,12 @@ public List getCompletedTasks() { new GenericType>() { }); } + public List getUncomletedTasks(int userId) { + WebResource resource= getResourceFactory().getApiResource("/task/"); + resource=resource.queryParam("completed", "0"); + resource=resource.queryParam("responsible", Integer.toString(userId)); + resource=resource.queryParam("limit", "25"); + return resource.get(new GenericType>() { + }); + } }