|
| 1 | +/* |
| 2 | + * Source++, the continuous feedback platform for developers. |
| 3 | + * Copyright (C) 2022-2023 CodeBrig, Inc. |
| 4 | + * |
| 5 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | + * you may not use this file except in compliance with the License. |
| 7 | + * You may obtain a copy of the License at |
| 8 | + * |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * See the License for the specific language governing permissions and |
| 15 | + * limitations under the License. |
| 16 | + */ |
| 17 | +package spp.protocol.service |
| 18 | + |
| 19 | +import io.vertx.codegen.annotations.GenIgnore |
| 20 | +import io.vertx.codegen.annotations.ProxyGen |
| 21 | +import io.vertx.codegen.annotations.VertxGen |
| 22 | +import io.vertx.core.Future |
| 23 | +import io.vertx.core.Vertx |
| 24 | +import io.vertx.core.eventbus.DeliveryOptions |
| 25 | +import io.vertx.core.json.JsonArray |
| 26 | +import io.vertx.core.json.JsonObject |
| 27 | +import spp.protocol.artifact.ArtifactQualifiedName |
| 28 | + |
| 29 | +@ProxyGen |
| 30 | +@VertxGen |
| 31 | +interface LiveInsightService { |
| 32 | + @GenIgnore |
| 33 | + companion object { |
| 34 | + @JvmStatic |
| 35 | + fun createProxy(vertx: Vertx, authToken: String? = null): LiveInsightService { |
| 36 | + val deliveryOptions = DeliveryOptions().apply { |
| 37 | + authToken?.let { addHeader("auth-token", it) } |
| 38 | + } |
| 39 | + return LiveInsightServiceVertxEBProxy(vertx, SourceServices.LIVE_INSIGHT, deliveryOptions) |
| 40 | + } |
| 41 | + } |
| 42 | + |
| 43 | + /** |
| 44 | + * Uploads source code to the workspace. |
| 45 | + * @param sourceCode The source code to upload. |
| 46 | + */ |
| 47 | + fun uploadSourceCode(workspaceId: String, sourceCode: JsonObject): Future<Void> |
| 48 | + |
| 49 | + /** |
| 50 | + * Uploads source code repository to the workspace. |
| 51 | + * |
| 52 | + * @param repository The source code repository to upload. |
| 53 | + */ |
| 54 | + fun uploadRepository(workspaceId: String, repository: JsonObject): Future<Void> |
| 55 | + |
| 56 | + fun getArtifactInsights(workspaceId: String, artifact: ArtifactQualifiedName, types: JsonArray): Future<JsonObject> |
| 57 | + |
| 58 | + fun getProjectClasses(workspaceId: String, offset: Int, limit: Int): Future<JsonArray> |
| 59 | + |
| 60 | + fun getProjectFunctions(workspaceId: String, offset: Int, limit: Int): Future<JsonArray> |
| 61 | + |
| 62 | + fun getFunctionCode(workspaceId: String, function: ArtifactQualifiedName): Future<JsonObject> |
| 63 | +} |
0 commit comments