Class VersionEndpoints
java.lang.Object
masecla.modrinth4j.endpoints.version.VersionEndpoints
Represents the version endpoints.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddFilesToVersion(String versionId, List<File> files) Add files to versionaddFilesToVersion(String versionId, Map<String, InputStream> files) Add files to a version.Creates a new version for a project.deleteProjectVersion(String versionId) Deletes a version based on the version idfiles()Returns the version files endpoints.getProjectVersions(String slug, GetProjectVersions.GetProjectVersionsRequest requestObject) Fetches a list of versions for a project with the given slug, filtered by the given conditions.getVersion(String versionId) Fetches a version based on the version idgetVersion(String... versionIds) Fetches multiple versions based on the version idsgetVersion(List<String> versionIds) Fetches multiple versions based on the version idsgetVersionByNumber(String projectSlug, String versionNumber) Fetches a version based on the project slug and version numbermodifyProjectVersion(String versionId, ModifyVersion.ModifyVersionRequest request) Modifies a version based on the version idscheduleVersion(String versionId, ScheduleVersion.ScheduleVersionRequest request) Schedules a version.
-
Constructor Details
-
VersionEndpoints
public VersionEndpoints()
-
-
Method Details
-
files
Returns the version files endpoints.- Returns:
- The version files endpoints.
-
getProjectVersions
public CompletableFuture<List<ProjectVersion>> getProjectVersions(String slug, GetProjectVersions.GetProjectVersionsRequest requestObject) Fetches a list of versions for a project with the given slug, filtered by the given conditions.- Parameters:
slug- - The slug of the project to fetch versions for.requestObject- - The request object to use for filtering- Returns:
- - A
CompletableFuturethat will return a list of versions
-
getVersion
Fetches a version based on the version id- Parameters:
versionId- - The id of the version to fetch- Returns:
- CompletableFuture - A
CompletableFuturethat will return a version
-
getVersionByNumber
public CompletableFuture<ProjectVersion> getVersionByNumber(String projectSlug, String versionNumber) Fetches a version based on the project slug and version number -
getVersion
Fetches multiple versions based on the version ids- Parameters:
versionIds- - The ids of the versions to fetch- Returns:
- CompletableFuture - A
CompletableFuturethat will return a list of versions in the same order as the ids. Putting the same id multiple times will only return one version, but the order will be preserved. - See Also:
-
getVersion
Fetches multiple versions based on the version ids- Parameters:
versionIds- - The ids of the versions to fetch- Returns:
- CompletableFuture - A
CompletableFuturethat will return a list of versions in the same order as the ids. Putting the same id multiple times will only return one version, but the order will be preserved. - See Also:
-
modifyProjectVersion
public CompletableFuture<ProjectVersion> modifyProjectVersion(String versionId, ModifyVersion.ModifyVersionRequest request) Modifies a version based on the version id- Parameters:
versionId- - The id of the version to modifyrequest- - The request object to use for modifying- Returns:
- CompletableFuture - A
CompletableFuturethat will return the modified version object
-
deleteProjectVersion
Deletes a version based on the version id- Parameters:
versionId- - The id of the version to delete- Returns:
- CompletableFuture - A
CompletableFuturethat will return an empty response when the version has been deleted
-
createProjectVersion
public CompletableFuture<ProjectVersion> createProjectVersion(CreateVersion.CreateVersionRequest request) Creates a new version for a project.- Parameters:
request- - The request object to use for creating- Returns:
- CompletableFuture - A
CompletableFuturethat will return the created version object once it has been created
-
addFilesToVersion
public CompletableFuture<EmptyResponse> addFilesToVersion(String versionId, Map<String, InputStream> files) Add files to a version.- Parameters:
versionId- - The id of the version to add files tofiles- - AMapof file names toInputStreams which represent the file content.- Returns:
- CompletableFuture - A
CompletableFuturethat will return an empty response when the files have been added
-
addFilesToVersion
public CompletableFuture<EmptyResponse> addFilesToVersion(String versionId, List<File> files) throws FileNotFoundException Add files to version- Parameters:
versionId- - The id of the version to add files tofiles- - AListofFiles to add to the version- Returns:
- CompletableFuture - A
CompletableFuturethat will return an empty response when the files have been added - Throws:
FileNotFoundException- - If a file in the list does not exist
-
scheduleVersion
public CompletableFuture<EmptyResponse> scheduleVersion(String versionId, ScheduleVersion.ScheduleVersionRequest request) Schedules a version.- Parameters:
versionId- - The id of the version to schedule- Returns:
- CompletableFuture - A
CompletableFuturethat will return an empty response when the version has been scheduled
-