11/*
22 * The MIT License
33 *
4- * Copyright (c) 2011, Eric Maupin
4+ * Copyright (c) 2011, Eric Maupin, Kohsuke Kawaguchi
55 *
66 * Permission is hereby granted, free of charge, to any person obtaining a copy
77 * of this software and associated documentation files (the "Software"), to deal
2424
2525package org .kohsuke .github ;
2626
27+ import java .io .IOException ;
2728import java .net .URL ;
2829import java .util .Collection ;
2930import java .util .Collections ;
3233import java .util .Locale ;
3334
3435/**
36+ * Represents an issue on GitHub.
37+ *
3538 * @author Eric Maupin
39+ * @author Kohsuke Kawaguchi
3640 */
3741public class GHIssue {
3842 GitHub root ;
43+ GHRepository owner ;
3944
4045 private String gravatar_id ,body ,title ,state ,created_at ,updated_at ,html_url ;
4146 private List <String > labels ;
4247 private int number ,votes ,comments ;
4348 private int position ;
4449
50+ /**
51+ * Repository to which the issue belongs.
52+ */
53+ public GHRepository getRepository () {
54+ return owner ;
55+ }
56+
4557 /**
4658 * The description of this pull request.
4759 */
@@ -83,4 +95,12 @@ public Date getCreatedAt() {
8395 public Date getUpdatedAt () {
8496 return GitHub .parseDate (updated_at );
8597 }
98+
99+ /**
100+ * Updates the issue by adding a comment.
101+ */
102+ public void comment (String message ) throws IOException {
103+ new Poster (root ).withCredential ().with ("comment" ,message ).to ("/issues/comment/" +
104+ owner .getOwnerName ()+"/" +owner .getName ()+"/" +number );
105+ }
86106}
0 commit comments