Skip to content

Commit 2676ef2

Browse files
committed
rename 'fetchAssets' to 'listAssets' and return PagedIterable
1 parent 98b0679 commit 2676ef2

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/main/java/org/kohsuke/github/GHRelease.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,12 @@ public List<GHAsset> getCachedAssets() {
272272
* @throws IOException
273273
* the io exception
274274
* @deprecated The behavior of this method will change in a future release. It will then provide cached assets as
275-
* provided by {@link #getCachedAssets()}. Use {@link #fetchAssets()} instead to fetch up-to-date
275+
* provided by {@link #getCachedAssets()}. Use {@link #listAssets()} instead to fetch up-to-date
276276
* information of assets.
277277
*/
278278
@Deprecated
279279
public List<GHAsset> getAssets() throws IOException {
280-
return fetchAssets();
280+
return listAssets().toList();
281281
}
282282

283283
/**
@@ -287,11 +287,10 @@ public List<GHAsset> getAssets() throws IOException {
287287
* @throws IOException
288288
* the io exception
289289
*/
290-
public List<GHAsset> fetchAssets() throws IOException {
290+
public PagedIterable<GHAsset> listAssets() throws IOException {
291291
Requester builder = owner.root.createRequest();
292292
return builder.withUrlPath(getApiTailUrl("assets"))
293-
.toIterable(GHAsset[].class, item -> item.wrap(this))
294-
.toList();
293+
.toIterable(GHAsset[].class, item -> item.wrap(this));
295294
}
296295

297296
/**

src/test/java/org/kohsuke/github/LifecycleTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public void testCreateRepository() throws IOException {
4545

4646
private void updateAsset(GHRelease release, GHAsset asset) throws IOException {
4747
asset.setLabel("test label");
48-
assertEquals("test label", release.fetchAssets().get(0).getLabel());
48+
assertEquals("test label", release.getAssets().get(0).getLabel());
4949
}
5050

5151
private void deleteAsset(GHRelease release, GHAsset asset) throws IOException {
@@ -58,7 +58,7 @@ private GHAsset uploadAsset(GHRelease release) throws IOException {
5858
assertNotNull(asset);
5959
List<GHAsset> cachedAssets = release.getCachedAssets();
6060
assertEquals(0, cachedAssets.size());
61-
List<GHAsset> assets = release.fetchAssets();
61+
List<GHAsset> assets = release.getAssets();
6262
assertEquals(1, assets.size());
6363
assertEquals("LICENSE.txt", assets.get(0).getName());
6464

0 commit comments

Comments
 (0)