Examples of DoubanMailEntryObj


Examples of com.dongxuexidu.douban4j.model.doumail.DoubanMailEntryObj

    String url = RequestUrls.DOUBAN_MAIL_PREFIX + "/" + mailId;
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    if (keepUnread) {
      params.add(new BasicNameValuePair("keep-unread", "true"));
    }
    DoubanMailEntryObj result = this.client.getResponse(url, params, DoubanMailEntryObj.class, true);
    return result;
  }
View Full Code Here

Examples of com.dongxuexidu.douban4j.model.doumail.DoubanMailEntryObj

   * @throws DoubanException
   * @throws IOException
   */
  public boolean sendMail(String receiverId, String content, String title) throws DoubanException, IOException {
    String url = RequestUrls.DOUBAN_MAIL_PREFIX + "s";
    DoubanMailEntryObj entry = generateDoubanMailEntryObj(receiverId, content, title);
    if (entry == null) {
      throw ErrorHandler.getCustomDoubanException(100, "Illegal mail data provided");
    }
    try {
      int responseCode = this.client.postResponseCodeOnly(url, entry, true);
View Full Code Here

Examples of com.dongxuexidu.douban4j.model.doumail.DoubanMailEntryObj

    }
  }

  public boolean markMailAsRead(long mailId) throws IOException, DoubanException {
    String url = RequestUrls.DOUBAN_MAIL_PREFIX + "/" + mailId;
    DoubanMailEntryObj requestEntry = generateOnlyAttribute(null, true);
    try {
      int responseCode = this.client.putResponseCodeOnly(url, requestEntry, true);
      if (responseCode != StatusCode.HTTP_STATUS_CREATED) {
        return false;
      }
View Full Code Here

Examples of com.dongxuexidu.douban4j.model.doumail.DoubanMailEntryObj

  }

  public boolean markMailReadInBatch(List<Long> ids) throws IOException, DoubanException {
    List<DoubanMailEntryObj> entries = new ArrayList<DoubanMailEntryObj>();
    for (long id : ids) {
      DoubanMailEntryObj entry = generateOnlyAttribute("" + id, true);
      entries.add(entry);
    }
    DoubanMailFeedObj feed = new DoubanMailFeedObj();
    feed.setEntries(entries);
    String url = RequestUrls.DOUBAN_MAIL_PREFIX + "/";
View Full Code Here

Examples of com.dongxuexidu.douban4j.model.doumail.DoubanMailEntryObj

  }

  public boolean deleteMailsInBatch(List<Long> ids) throws IOException, DoubanException {
    List<DoubanMailEntryObj> entries = new ArrayList<DoubanMailEntryObj>();
    for (long id : ids) {
      DoubanMailEntryObj entry = generateOnlyAttribute("" + id, false);
      entries.add(entry);
    }
    DoubanMailFeedObj feed = new DoubanMailFeedObj();
    feed.setEntries(entries);
    String url = RequestUrls.DOUBAN_MAIL_PREFIX + "/delete";
View Full Code Here

Examples of com.dongxuexidu.douban4j.model.doumail.DoubanMailEntryObj

      }
    }
  }

  private DoubanMailEntryObj generateOnlyAttribute(String id, boolean hasAttr) {
    DoubanMailEntryObj entity = new DoubanMailEntryObj();
    if (hasAttr) {
      DoubanAttributeObj att = new DoubanAttributeObj();
      att.setName("unread");
      att.setValue("false");
      entity.setAttr(att);
    }
    if (id != null) {
      if (!id.startsWith("http://")) {
        id = "http://api.douban.com/doumail/" + id;
      }
      entity.setId(id);
    }
    return entity;
  }
View Full Code Here

Examples of com.dongxuexidu.douban4j.model.doumail.DoubanMailEntryObj

      fullId = "http://api.douban.com/people/" + receiverId;
    }
    DoubanEntityObj entity = new DoubanEntityObj();
    entity.setName("receiver");
    entity.setUri(fullId);
    DoubanMailEntryObj obj = new DoubanMailEntryObj();
    obj.setEntity(entity);
    obj.setTitle(title);
    obj.setContent(content);
    return obj;
  }
View Full Code Here

Examples of com.dongxuexidu.douban4j.model.doumail.DoubanMailEntryObj

  public void testGetMailById() throws Exception {
    System.out.println("getMailById");
    long mailId = 193287780L;
    boolean keepUnread = false;
    DoubanMailService instance = new DoubanMailService(accessToken);
    DoubanMailEntryObj result = instance.getMailById(mailId, keepUnread);
    assertEquals(result.getTitle(), "好资源分享——中国的iTune U");
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.