File tree Expand file tree Collapse file tree 6 files changed +79
-1
lines changed
src/main/scala/de/upb/cs/swt/delphi/client Expand file tree Collapse file tree 6 files changed +79
-1
lines changed Original file line number Diff line number Diff line change 1
1
name := " delphi-client"
2
2
3
- libraryDependencies += " io.spray" %% " spray-json" % " 1.3.5"
4
3
libraryDependencies += " joda-time" % " joda-time" % " 2.10.5"
5
4
5
+ /*
6
+ libraryDependencies ++= Seq(
7
+ "com.softwaremill.sttp" %% "core" % "1.5.4",
8
+ "com.softwaremill.sttp" %% "spray-json" % "1.5.4"
9
+ )*/
10
+
6
11
libraryDependencies += " org.scalatest" %% " scalatest" % " 3.0.8" % " test"
Original file line number Diff line number Diff line change
1
+ package de .upb .cs .swt .delphi .client
2
+
3
+ import scala .util .Try
4
+ import de .upb .cs .swt .delphi .client .QueryJson ._
5
+ import de .upb .cs .swt .delphi .core .model .Artifact
6
+
7
+ abstract class DelphiClient (baseUri : String ) {
8
+ def search (query : Query , prettyPrint : Boolean = false ) : Try [Seq [SearchResult ]]
9
+ /* = {
10
+ val queryParams = prettyPrint match {
11
+ case true => Map("pretty" -> "")
12
+ case false => Map()
13
+ }
14
+ val searchUri = uri"${baseUri}/search?$queryParams"
15
+
16
+ val request = sttp.body(query.toJson).post(searchUri)
17
+
18
+ //val (res, time) = processRequest(request)
19
+ //res.foreach(processResults(_, time))
20
+ }
21
+ */
22
+ def features () : Try [Seq [FieldDefinition ]]
23
+
24
+ def retrieve (identifier : String ) : Try [Artifact ]
25
+
26
+ def version () : Try [String ]
27
+
28
+ def statistics () : Try [Statistics ]
29
+ }
Original file line number Diff line number Diff line change
1
+ // Copyright (C) 2018 The Delphi Team.
2
+ // See the LICENCE file distributed with this work for additional
3
+ // information regarding copyright ownership.
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 de .upb .cs .swt .delphi .client
18
+
19
+ import spray .json .DefaultJsonProtocol
20
+
21
+ case class FieldDefinition (name : String , description : String )
22
+
23
+ object FieldDefinitionJson extends DefaultJsonProtocol {
24
+ implicit val transform = jsonFormat2(FieldDefinition )
25
+ }
Original file line number Diff line number Diff line change
1
+ package de .upb .cs .swt .delphi .client
2
+
3
+ import spray .json .DefaultJsonProtocol
4
+
5
+ case class Query (query : String , limit : Option [Int ] = Some (50 ))
6
+
7
+ object QueryJson extends DefaultJsonProtocol {
8
+ implicit val queryRequestFormat = jsonFormat2(Query )
9
+ }
Original file line number Diff line number Diff line change
1
+ package de .upb .cs .swt .delphi .client
2
+
3
+ case class Statistics (total : Long , hermesEnabled : Long )
Original file line number Diff line number Diff line change
1
+ package de .upb .cs .swt .delphi .client
2
+
3
+ import spray .json .DefaultJsonProtocol
4
+
5
+ object StatisticsJson extends DefaultJsonProtocol {
6
+ implicit val statisticsFormat = jsonFormat2(Statistics )
7
+ }
You can’t perform that action at this time.
0 commit comments