Skip to content

Commit

Permalink
feat(artifacts): add optional release status param to fetching artifa…
Browse files Browse the repository at this point in the history
…cts (#837)
  • Loading branch information
emjburns committed Jun 26, 2019
1 parent de6efc2 commit aa0c104
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,13 @@ List<String> artifactVersions(
}

@ApiOperation(
value = "Retrieve the available artifact versions for an artifact provider and package name")
value = "Retrieve the available artifact versions for an artifact provider and package name",
notes = "releaseStatus is an optional comma separated list of statuses to filter on.")
@RequestMapping(value = "/{provider}/{packageName}", method = RequestMethod.GET)
List<String> getVersionsOfArtifactForProvider(
@PathVariable String provider, @PathVariable String packageName) {
return artifactService.getVersionsOfArtifactForProvider(provider, packageName);
@PathVariable String provider,
@PathVariable String packageName,
@RequestParam(required = false) String releaseStatus) {
return artifactService.getVersionsOfArtifactForProvider(provider, packageName, releaseStatus);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,16 @@ public Void getArtifactContents(
.execute();
}

public List<String> getVersionsOfArtifactForProvider(String provider, String packageName) {
public List<String> getVersionsOfArtifactForProvider(
String provider, String packageName, String releaseStatus) {
if (!igorService.isPresent()) {
throw new IllegalStateException(
"Cannot fetch artifact versions because Igor is not enabled.");
}

return stringListCommand(
"artifactVersionsByProvider",
() -> igorService.get().getArtifactVersions(provider, packageName))
() -> igorService.get().getArtifactVersions(provider, packageName, releaseStatus))
.execute();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ interface IgorService {

@GET('/artifacts/{provider}/{packageName}')
List<String> getArtifactVersions(@Path("provider") String provider,
@Path("packageName") String packageName);
@Path("packageName") String packageName,
@Query("releaseStatus") String releaseStatus);

@GET('/concourse/{buildMaster}/teams/{team}/pipelines/{pipeline}/resources')
List<String> getConcourseResources(@Path("buildMaster") String buildMaster, @Path("team") String team, @Path("pipeline") String pipeline);
Expand Down

0 comments on commit aa0c104

Please sign in to comment.