Package zendeskapi.exception

Examples of zendeskapi.exception.ZendeskApiException


   */
  public boolean deleteMacro(long id) throws ZendeskApiException {
    try {
      return genericDelete("macros/" + id + ".json");
    } catch (Exception e) {
      throw new ZendeskApiException("Deletion of macro with id " + id + " failed", e);
    }
  }
View Full Code Here


   */
  public ApplyMacroResponse applyMacro(long macroId) throws ZendeskApiException {
    try {
      return genericGet("macros/" + macroId + "/apply.json", ApplyMacroResponse.class);
    } catch (Exception e) {
      throw new ZendeskApiException("Applying macro with id " + macroId + " failed", e);
    }
  }
View Full Code Here

   */
  public ApplyMacroResponse applyMacroToTicket(long ticketId, long macroId) throws ZendeskApiException {
    try {
      return genericGet("tickets/" + ticketId + "/macros/" + macroId + "/apply.json", ApplyMacroResponse.class);
    } catch (Exception e) {
      throw new ZendeskApiException("Applying macro with id " + macroId + " for ticket with id " + ticketId + " failed", e);
    }
  }
View Full Code Here

    post.setHeader("Authorization", getAuthHeader(user, password));
    post.setEntity(entity);
    try {
      HttpResponse response = client.execute(post);
      if (response.getStatusLine().getStatusCode() != HttpURLConnection.HTTP_CREATED) {
        throw new ZendeskApiException("Upload of attachment failed\n" + response.getStatusLine().getStatusCode() + " " + response.getStatusLine().getReasonPhrase());
      }
      BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
      StringBuilder sb = new StringBuilder();
      String line = "";
      while ((line = rd.readLine()) != null) {
        sb.append(line);
      }
      UploadResult uploadResult = JsonHelper.unmarshal(sb.toString(), UploadResult.class);
      return uploadResult.getUpload();
    } catch (Exception e) {
      throw new ZendeskApiException(e);
    }
  }
View Full Code Here

   */
  public GroupForumResponse getForums() throws ZendeskApiException {
    try {
      return genericGet("forums.json", GroupForumResponse.class);
    } catch (Exception e) {
      throw new ZendeskApiException(e);
    }
  }
View Full Code Here

   */
  public IndividualForumResponse getForumById(long forumId) throws ZendeskApiException {
    try {
      return genericGet("forums/" + forumId + ".json", IndividualForumResponse.class);
    } catch (Exception e) {
      throw new ZendeskApiException(e);
    }
  }
View Full Code Here

   */
  public GroupForumResponse getForumsByCategory(long categoryId) throws ZendeskApiException {
    try {
      return genericGet("categories/" + categoryId + "/forums.json", GroupForumResponse.class);
    } catch (Exception e) {
      throw new ZendeskApiException(e);
    }
  }
View Full Code Here

    IndividualForumResponse forumToCreate = new IndividualForumResponse();
    forumToCreate.setForum(forum);
    try {
      return genericPost("forums.json", forumToCreate, IndividualForumResponse.class);
    } catch (Exception e) {
      throw new ZendeskApiException("Creation of forum " + forum.getName() + " failed", e);
    }
  }
View Full Code Here

    IndividualForumResponse forumToUpdate = new IndividualForumResponse();
    forumToUpdate.setForum(forum);
    try {
      return genericPut("forums/" + forum.getId(), forumToUpdate, IndividualForumResponse.class);
    } catch (Exception e) {
      throw new ZendeskApiException("Updating forum " + forum.getName() + " failed", e);
    }
  }
View Full Code Here

   */
  public boolean deleteForum(long id) throws ZendeskApiException {
    try {
      return genericDelete("forums/" + id + ".json");
    } catch (Exception e) {
      throw new ZendeskApiException(e);
    }
  }
View Full Code Here

TOP

Related Classes of zendeskapi.exception.ZendeskApiException

Copyright © 2018 www.massapicom. 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.