@@ -95,18 +95,12 @@ public GHDeploymentBuilder createDeployment(String ref) {
9595 return new GHDeploymentBuilder (this ,ref );
9696 }
9797
98- public PagedIterable <GHDeploymentStatus > getDeploymentStatuses (final int id ) {
99- return new PagedIterable <GHDeploymentStatus >() {
100- public PagedIterator <GHDeploymentStatus > _iterator (int pageSize ) {
101- return new PagedIterator <GHDeploymentStatus >(root .retrieve ().asIterator (getApiTailUrl ("deployments" )+"/" +id +"/statuses" , GHDeploymentStatus [].class , pageSize )) {
102- @ Override
103- protected void wrapUp (GHDeploymentStatus [] page ) {
104- for (GHDeploymentStatus c : page )
105- c .wrap (GHRepository .this );
106- }
107- };
108- }
109- };
98+ /**
99+ * @deprecated
100+ * Use {@code getDeployment(id).listStatuses()}
101+ */
102+ public PagedIterable <GHDeploymentStatus > getDeploymentStatuses (final int id ) throws IOException {
103+ return getDeployment (id ).listStatuses ();
110104 }
111105
112106 public PagedIterable <GHDeployment > listDeployments (String sha ,String ref ,String task ,String environment ){
@@ -123,7 +117,13 @@ protected void wrapUp(GHDeployment[] page) {
123117 };
124118 }
125119 };
120+ }
126121
122+ /**
123+ * Obtains a single {@link GHDeployment} by its ID.
124+ */
125+ public GHDeployment getDeployment (long id ) throws IOException {
126+ return root .retrieve ().to ("deployments/" + id , GHDeployment .class ).wrap (this );
127127 }
128128
129129 private String join (List <String > params , String joinStr ) {
@@ -140,8 +140,12 @@ private String getParam(String name, String value) {
140140 return StringUtils .trimToNull (value )== null ? null : name +"=" +value ;
141141 }
142142
143- public GHDeploymentStatusBuilder createDeployStatus (int deploymentId , GHDeploymentState ghDeploymentState ) {
144- return new GHDeploymentStatusBuilder (this ,deploymentId ,ghDeploymentState );
143+ /**
144+ * @deprecated
145+ * Use {@code getDeployment(deploymentId).createStatus(ghDeploymentState)}
146+ */
147+ public GHDeploymentStatusBuilder createDeployStatus (int deploymentId , GHDeploymentState ghDeploymentState ) throws IOException {
148+ return getDeployment (deploymentId ).createStatus (ghDeploymentState );
145149 }
146150
147151 private static class GHRepoPermission {
0 commit comments