mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-10 08:21:21 +00:00
rename 'fetchAssets' to 'listAssets' and return PagedIterable
This commit is contained in:
@@ -272,12 +272,12 @@ public class GHRelease extends GHObject {
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
* @deprecated The behavior of this method will change in a future release. It will then provide cached assets as
|
||||
* provided by {@link #getCachedAssets()}. Use {@link #fetchAssets()} instead to fetch up-to-date
|
||||
* provided by {@link #getCachedAssets()}. Use {@link #listAssets()} instead to fetch up-to-date
|
||||
* information of assets.
|
||||
*/
|
||||
@Deprecated
|
||||
public List<GHAsset> getAssets() throws IOException {
|
||||
return fetchAssets();
|
||||
return listAssets().toList();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -287,11 +287,10 @@ public class GHRelease extends GHObject {
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*/
|
||||
public List<GHAsset> fetchAssets() throws IOException {
|
||||
public PagedIterable<GHAsset> listAssets() throws IOException {
|
||||
Requester builder = owner.root.createRequest();
|
||||
return builder.withUrlPath(getApiTailUrl("assets"))
|
||||
.toIterable(GHAsset[].class, item -> item.wrap(this))
|
||||
.toList();
|
||||
.toIterable(GHAsset[].class, item -> item.wrap(this));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -45,7 +45,7 @@ public class LifecycleTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
private void updateAsset(GHRelease release, GHAsset asset) throws IOException {
|
||||
asset.setLabel("test label");
|
||||
assertEquals("test label", release.fetchAssets().get(0).getLabel());
|
||||
assertEquals("test label", release.getAssets().get(0).getLabel());
|
||||
}
|
||||
|
||||
private void deleteAsset(GHRelease release, GHAsset asset) throws IOException {
|
||||
@@ -58,7 +58,7 @@ public class LifecycleTest extends AbstractGitHubWireMockTest {
|
||||
assertNotNull(asset);
|
||||
List<GHAsset> cachedAssets = release.getCachedAssets();
|
||||
assertEquals(0, cachedAssets.size());
|
||||
List<GHAsset> assets = release.fetchAssets();
|
||||
List<GHAsset> assets = release.getAssets();
|
||||
assertEquals(1, assets.size());
|
||||
assertEquals("LICENSE.txt", assets.get(0).getName());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user