diff options
| author | mjkwiatkowski <mati.rewa@gmail.com> | 2026-02-26 19:51:57 +0100 |
|---|---|---|
| committer | mjkwiatkowski <mati.rewa@gmail.com> | 2026-02-26 19:51:57 +0100 |
| commit | 82f8418f49b0564c5093c28be1ca522a628d0b4f (patch) | |
| tree | 140e6e4579229c8eefac398e58f386f270dff328 /opendc-common/src/main/kotlin/org/opendc/common/api/AssetsController.kt | |
| parent | 4f816318b6672d40f23b22ca44cc06b77cadf961 (diff) | |
Diffstat (limited to 'opendc-common/src/main/kotlin/org/opendc/common/api/AssetsController.kt')
| -rw-r--r-- | opendc-common/src/main/kotlin/org/opendc/common/api/AssetsController.kt | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/opendc-common/src/main/kotlin/org/opendc/common/api/AssetsController.kt b/opendc-common/src/main/kotlin/org/opendc/common/api/AssetsController.kt new file mode 100644 index 00000000..c6f34d19 --- /dev/null +++ b/opendc-common/src/main/kotlin/org/opendc/common/api/AssetsController.kt @@ -0,0 +1,72 @@ +package org.opendc.common.api + +import org.opendc.common.annotations.Endpoint +import io.javalin.http.Handler + +/** + * This class represents the `/assets` endpoint. + * + * @author Mateusz Kwiatkowski + * + * */ + + +//TODO: fix -> this is all wrong. +// Sending the experiment file is completely useless. +// You need to send tasks.parquet +public class AssetsController { + /** + * Returns a concatenated JSON string of all assets. + */ + @Endpoint("GET","/assets") + public fun getAssets() : Handler { + return Handler { ctx -> ctx.status(200) + println(ctx.body()) + } + } + + /** + * Returns an asset with `id` as a JSON string. + */ + @Endpoint("GET", "/assets/{id}") + public fun getAssetsId(): Handler { + return Handler { ctx -> ctx.status(200) } + } + + /** + * Saves the asset specified in the HTTP body. + * Returns the asset `id`. + */ + @Endpoint("POST", "/assets") + public fun postAsset() : Handler { + return Handler { ctx -> ctx.status(200) + println(ctx.body()) + } + } + + /** + * Modifies the specified asset. + * Deletes all results from experiments with this asset. + */ + @Endpoint("PUT", "/assets/{id}") + public fun putAssetId() : Handler { + return Handler { ctx -> ctx.status(200) } + } + + /** + * Deletes an asset with `id`. + * Deletes all results from experiments with this asset. + */ + @Endpoint("DELETE", "/assets/{id}") + public fun deleteAssetId() : Handler { + return Handler { ctx -> ctx.status(200) } + } + + /** + * Deletes all assets + */ + @Endpoint("DELETE", "/assets") + public fun deleteAsset() : Handler { + return Handler { ctx -> ctx.status(200) } + } +}
\ No newline at end of file |
