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) } } }