// Path: src/main/java/se/bjurr/gitchangelog/api/exceptions/GitChangelogIntegrationException.java
// public class GitChangelogIntegrationException extends Exception {
// 
//   private static final long serialVersionUID = 4249741847365803709L;
// 
//   public GitChangelogIntegrationException(String message, Throwable throwable) {
//     super(message, throwable);
//   }
// 
//   public GitChangelogIntegrationException(String message) {
//     super(message);
//   }
// }


import static com.jayway.jsonpath.JsonPath.read;
import com.jayway.jsonpath.JsonPath;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import se.bjurr.gitchangelog.api.exceptions.GitChangelogIntegrationException;
            + "?fields=parent,summary,issuetype,labels,description,issuelinks";
    return endpoint;
  }

  protected JiraIssue toJiraIssue(final String issue, final String json) {
    final String title = read(json, "$.fields.summary");
    final String description = read(json, "$.fields.description");
    final String type = read(json, "$.fields.issuetype.name");
    final String link = this.api + "/browse/" + issue;
    final List<String> labels = JsonPath.read(json, "$.fields.labels");
    final List<String> linkedIssues = new ArrayList<>();
    final List<String> inwardKey = JsonPath.read(json, "$.fields.issuelinks[*].inwardIssue.key");
    final List<String> outwardKey = JsonPath.read(json, "$.fields.issuelinks[*].outwardIssue.key");
    linkedIssues.addAll(inwardKey);
    linkedIssues.addAll(outwardKey);

    final JiraIssue jiraIssue =
        new JiraIssue(title, description, link, issue, type, linkedIssues, labels);
    return jiraIssue;
  }

  public abstract JiraClient withBasicCredentials(String username, String password);

  public abstract JiraClient withBearer(String bearerToken);

  public abstract JiraClient withTokenCredentials(String token);

  public abstract JiraClient withHeaders(Map<String, String> headers);

  public abstract Optional<JiraIssue> getIssue(String matched)
// Path: src/main/java/se/bjurr/gitchangelog/api/exceptions/GitChangelogIntegrationException.java
// public class GitChangelogIntegrationException extends Exception {
// 
//   private static final long serialVersionUID = 4249741847365803709L;
// 
//   public GitChangelogIntegrationException(String message, Throwable throwable) {
//     super(message, throwable);
//   }
// 
//   public GitChangelogIntegrationException(String message) {
//     super(message);
//   }
// }


// Path: src/main/java/se/bjurr/gitchangelog/internal/integrations/jira/JiraClient.java
import static com.jayway.jsonpath.JsonPath.read;
import com.jayway.jsonpath.JsonPath;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import se.bjurr.gitchangelog.api.exceptions.GitChangelogIntegrationException;

            + "?fields=parent,summary,issuetype,labels,description,issuelinks";
    return endpoint;
  }

  protected JiraIssue toJiraIssue(final String issue, final String json) {
    final String title = read(json, "$.fields.summary");
    final String description = read(json, "$.fields.description");
    final String type = read(json, "$.fields.issuetype.name");
    final String link = this.api + "/browse/" + issue;
    final List<String> labels = JsonPath.read(json, "$.fields.labels");
    final List<String> linkedIssues = new ArrayList<>();
    final List<String> inwardKey = JsonPath.read(json, "$.fields.issuelinks[*].inwardIssue.key");
    final List<String> outwardKey = JsonPath.read(json, "$.fields.issuelinks[*].outwardIssue.key");
    linkedIssues.addAll(inwardKey);
    linkedIssues.addAll(outwardKey);

    final JiraIssue jiraIssue =
        new JiraIssue(title, description, link, issue, type, linkedIssues, labels);
    return jiraIssue;
  }

  public abstract JiraClient withBasicCredentials(String username, String password);

  public abstract JiraClient withBearer(String bearerToken);

  public abstract JiraClient withTokenCredentials(String token);

  public abstract JiraClient withHeaders(Map<String, String> headers);

  public abstract Optional<JiraIssue> getIssue(String matched)
      throws GitChangelogIntegrationException;