コード例 #1
0
  public Update postReportUpdate(
      String reportId, String body, String link, MediaFile image, VideoAttachment video)
      throws N0ticeException {
    OAuthRequest request = createOauthRequest(Verb.POST, apiUrl + "/" + reportId + "/update/new");
    MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
    populateUpdateFields(body, link, image, video, entity);

    request.addHeader("Content-Type", entity.getContentType().getValue());
    addMultipartEntity(request, entity);
    oauthSignRequest(request);

    final Response response = request.send();

    if (response.getCode() == 200) {
      return searchParser.parseUpdate(response.getBody());
    }

    handleExceptions(response);
    throw new N0ticeException(response.getBody());
  }
コード例 #2
0
 public Update getUpdate(String id) throws N0ticeException {
   return searchParser.parseUpdate(httpFetcher.fetchContent(urlBuilder.get(id), UTF_8));
 }