Skip to content

Commit

Permalink
Add filesEndpoint to Uploader interface
Browse files Browse the repository at this point in the history
  • Loading branch information
hb0 committed Oct 31, 2023
1 parent dc48f55 commit 2a6547c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/main/kotlin/de/cyface/uploader/DefaultUploader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import javax.net.ssl.SSLException
* To use this interface just call [DefaultUploader.upload] with an authentication token.
*
* @author Armin Schnabel
* @version 1.0.0
* @version 1.1.0
* @since 1.0.0
* @property apiEndpoint An API endpoint running a Cyface data collector service, like `https://some.url/api/v3`
*/
Expand Down Expand Up @@ -201,6 +201,10 @@ class DefaultUploader(private val apiEndpoint: String) : Uploader {
return URL(returnUrlWithTrailingSlash(apiEndpoint) + "measurements")
}

override fun filesEndpoint(measurementId: Long): URL {
return URL(returnUrlWithTrailingSlash(apiEndpoint) + "measurements/$measurementId/files")
}

@Throws(
BadRequestException::class,
UnauthorizedException::class,
Expand Down
12 changes: 10 additions & 2 deletions src/main/kotlin/de/cyface/uploader/Uploader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import java.net.URL
* Interface for uploading files to a Cyface Data Collector.
*
* @author Armin Schnabel
* @version 1.0.0
* @version 1.1.0
* @since 1.0.0
*/
interface Uploader {
Expand All @@ -54,9 +54,17 @@ interface Uploader {
): Result

/**
* @return the endpoint which will be used for the upload.
* @return the endpoint which will be used to upload the core measurement file.
* @throws MalformedURLException if the endpoint address provided is malformed.
*/
@Throws(MalformedURLException::class)
fun endpoint(): URL

/**
* @param measurementId The id of the measurement the files are captured for.
* @return the endpoint which will be used to upload the attached files of a measurement.
* @throws MalformedURLException if the endpoint address provided is malformed.
*/
@Throws(MalformedURLException::class)
fun filesEndpoint(measurementId: Long): URL
}

0 comments on commit 2a6547c

Please sign in to comment.