1515 * Release in a github repository.
1616 *
1717 * @see GHRepository#getReleases() GHRepository#getReleases()
18+ * @see GHRepository#listReleases() () GHRepository#listReleases()
1819 * @see GHRepository#createRelease(String) GHRepository#createRelease(String)
1920 */
2021public class GHRelease extends GHObject {
@@ -23,6 +24,7 @@ public class GHRelease extends GHObject {
2324
2425 private String html_url ;
2526 private String assets_url ;
27+ private List <GHAsset > assets ;
2628 private String upload_url ;
2729 private String tag_name ;
2830 private String target_commitish ;
@@ -249,18 +251,45 @@ public GHAsset uploadAsset(String filename, InputStream stream, String contentTy
249251 }
250252
251253 /**
252- * Gets assets.
254+ * Get the cached assets.
255+ *
256+ * @return the assets
257+ *
258+ * @deprecated This should be the default behavior of {@link #getAssets()} in a future release. This method is
259+ * introduced in addition to enable a transition to using cached asset information while keeping the
260+ * existing logic in place for backwards compatibility.
261+ */
262+ @ Deprecated
263+ @ Preview
264+ public List <GHAsset > assets () {
265+ return assets ;
266+ }
267+
268+ /**
269+ * Re-fetch the assets of this release.
253270 *
254271 * @return the assets
255272 * @throws IOException
256273 * the io exception
274+ * @deprecated The behavior of this method will change in a future release. It will then provide cached assets as
275+ * provided by {@link #assets()}. Use {@link #listAssets()} instead to fetch up-to-date information of
276+ * assets.
257277 */
278+ @ Deprecated
258279 public List <GHAsset > getAssets () throws IOException {
259- Requester builder = owner .root .createRequest ();
280+ return listAssets ().toList ();
281+ }
260282
261- return builder .withUrlPath (getApiTailUrl ("assets" ))
262- .toIterable (GHAsset [].class , item -> item .wrap (this ))
263- .toList ();
283+ /**
284+ * Re-fetch the assets of this release.
285+ *
286+ * @return the assets
287+ * @throws IOException
288+ * the io exception
289+ */
290+ public PagedIterable <GHAsset > listAssets () throws IOException {
291+ Requester builder = owner .root .createRequest ();
292+ return builder .withUrlPath (getApiTailUrl ("assets" )).toIterable (GHAsset [].class , item -> item .wrap (this ));
264293 }
265294
266295 /**
0 commit comments