feat: add new APi for Discussion

This commit is contained in:
Charles Moulliard
2020-05-29 16:28:47 +02:00
parent 3082622394
commit af67eb7f0b

View File

@@ -130,6 +130,19 @@ public class GHTeam extends GHObject implements Refreshable {
root.createRequest().method("PATCH").with("privacy", privacy).withUrlPath(api("")).send();
}
/**
* Retrieves the discussions.
*
* @return the paged iterable
* @throws IOException
* the io exception
*/
public PagedIterable<GHDiscussion> listDiscussions() throws IOException {
return root.createRequest()
.withUrlPath(api("/discussions"))
.toIterable(GHDiscussion[].class, item -> item.wrapUp(root));
}
/**
* Retrieves the current members.
*
@@ -297,6 +310,21 @@ public class GHTeam extends GHObject implements Refreshable {
return "/teams/" + getId() + tail;
}
/**
* Starts a builder that creates a new discussion.
*
* <p>
* You use the returned builder to set various properties, then call {@link GHDiscussionBuilder#create()} to finally
* create a discussion.
*
* @param name
* the name
* @return the gh create discussion builder
*/
public GHDiscussionBuilder createDiscussion(String name) throws IOException {
return new GHDiscussionBuilder(this, name);
}
/**
* Gets organization.
*