Skip to content

Commit d8e56ba

Browse files
committed
Renaming Command to EndPoint
1 parent ac0aa2d commit d8e56ba

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

pinecone-client/src/main/scala/io/cequence/pineconescala/service/Command.scala renamed to pinecone-client/src/main/scala/io/cequence/pineconescala/service/EndPoint.scala

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ package io.cequence.pineconescala.service
22

33
import io.cequence.pineconescala.domain.EnumValue
44

5-
sealed abstract class Command(value: String = "") extends EnumValue(value)
5+
sealed abstract class EndPoint(value: String = "") extends EnumValue(value)
66

7-
object Command {
8-
case object describe_index_stats extends Command
9-
case object query extends Command
10-
case object vectors_delete extends Command("vectors/delete")
11-
case object vectors_fetch extends Command("vectors/fetch")
12-
case object vectors_update extends Command("vectors/update")
13-
case object vectors_upsert extends Command("vectors/upsert")
14-
case object collections extends Command
15-
case object databases extends Command
7+
object EndPoint {
8+
case object describe_index_stats extends EndPoint
9+
case object query extends EndPoint
10+
case object vectors_delete extends EndPoint("vectors/delete")
11+
case object vectors_fetch extends EndPoint("vectors/fetch")
12+
case object vectors_update extends EndPoint("vectors/update")
13+
case object vectors_upsert extends EndPoint("vectors/upsert")
14+
case object collections extends EndPoint
15+
case object databases extends EndPoint
1616
}
1717

1818
sealed abstract class Tag(value: String = "") extends EnumValue(value)

pinecone-client/src/main/scala/io/cequence/pineconescala/service/PineconeIndexServiceImpl.scala

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ private class PineconeIndexServiceImpl(
2828
implicit val ec: ExecutionContext, val materializer: Materializer
2929
) extends PineconeIndexService with WSRequestHelper {
3030

31-
override protected type PEP = Command
31+
override protected type PEP = EndPoint
3232
override protected type PT = Tag
3333
override protected val coreUrl = s"https://controller.${environment}.pinecone.io/"
3434

@@ -41,7 +41,7 @@ private class PineconeIndexServiceImpl(
4141
)
4242

4343
override def listCollections: Future[Seq[String]] =
44-
execGET(Command.collections).map(
44+
execGET(EndPoint.collections).map(
4545
_.asSafe[Seq[String]]
4646
)
4747

@@ -50,7 +50,7 @@ private class PineconeIndexServiceImpl(
5050
source: String
5151
): Future[CreateResponse] =
5252
execPOSTWithStatus(
53-
Command.collections,
53+
EndPoint.collections,
5454
bodyParams = jsonBodyParams(
5555
Tag.name -> Some(name),
5656
Tag.source -> Some(source)
@@ -71,7 +71,7 @@ private class PineconeIndexServiceImpl(
7171
collectionName: String
7272
): Future[Option[CollectionInfo]] =
7373
execGETWithStatus(
74-
Command.collections,
74+
EndPoint.collections,
7575
endPointParam = Some(collectionName)
7676
).map { response =>
7777
handleNotFoundAndError(response).map(
@@ -83,7 +83,7 @@ private class PineconeIndexServiceImpl(
8383
collectionName: String
8484
): Future[DeleteResponse] =
8585
execDELETEWithStatus(
86-
Command.collections,
86+
EndPoint.collections,
8787
endPointParam = Some(collectionName),
8888
acceptableStatusCodes = Nil // don't parse response at all
8989
).map { response =>
@@ -97,7 +97,7 @@ private class PineconeIndexServiceImpl(
9797
}
9898

9999
override def listIndexes: Future[Seq[String]] =
100-
execGET(Command.databases).map(
100+
execGET(EndPoint.databases).map(
101101
_.asSafe[Seq[String]]
102102
)
103103

@@ -107,7 +107,7 @@ private class PineconeIndexServiceImpl(
107107
settings: CreateIndexSettings
108108
): Future[CreateResponse] =
109109
execPOSTWithStatus(
110-
Command.databases,
110+
EndPoint.databases,
111111
bodyParams = jsonBodyParams(
112112
Tag.name -> Some(name),
113113
Tag.dimension -> Some(dimension),
@@ -134,7 +134,7 @@ private class PineconeIndexServiceImpl(
134134
indexName: String
135135
): Future[Option[IndexInfo]] =
136136
execGETWithStatus(
137-
Command.databases,
137+
EndPoint.databases,
138138
endPointParam = Some(indexName)
139139
).map { response =>
140140
handleNotFoundAndError(response).map(
@@ -146,7 +146,7 @@ private class PineconeIndexServiceImpl(
146146
indexName: String
147147
): Future[DeleteResponse] =
148148
execDELETEWithStatus(
149-
Command.databases,
149+
EndPoint.databases,
150150
endPointParam = Some(indexName),
151151
acceptableStatusCodes = Nil // don't parse response at all
152152
).map { response =>
@@ -165,7 +165,7 @@ private class PineconeIndexServiceImpl(
165165
pod_type: Option[PodType.Value]
166166
): Future[ConfigureIndexResponse] =
167167
execPATCHWithStatus(
168-
Command.databases,
168+
EndPoint.databases,
169169
endPointParam = Some(indexName),
170170
bodyParams = jsonBodyParams(
171171
Tag.replicas -> replicas,

pinecone-client/src/main/scala/io/cequence/pineconescala/service/PineconeVectorServiceImpl.scala

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ private class PineconeVectorServiceImpl(
3333
implicit val ec: ExecutionContext, val materializer: Materializer
3434
) extends PineconeVectorService with WSRequestHelper {
3535

36-
override protected type PEP = Command
36+
override protected type PEP = EndPoint
3737
override protected type PT = Tag
3838

3939
// override protected val coreUrl = s"https://${indexName}-${projectId}.svc.${environment}.pinecone.io/"
@@ -47,7 +47,7 @@ private class PineconeVectorServiceImpl(
4747
)
4848

4949
override def describeIndexStats: Future[IndexStats] =
50-
execGET(Command.describe_index_stats).map(
50+
execGET(EndPoint.describe_index_stats).map(
5151
_.asSafe[IndexStats]
5252
)
5353

@@ -57,7 +57,7 @@ private class PineconeVectorServiceImpl(
5757
settings: QuerySettings
5858
): Future[QueryResponse] =
5959
execPOST(
60-
Command.query,
60+
EndPoint.query,
6161
bodyParams = jsonBodyParams(
6262
Tag.vector -> Some(vector),
6363
Tag.namespace -> Some(namespace),
@@ -77,7 +77,7 @@ private class PineconeVectorServiceImpl(
7777
settings: QuerySettings
7878
): Future[QueryResponse] =
7979
execPOST(
80-
Command.query,
80+
EndPoint.query,
8181
bodyParams = jsonBodyParams(
8282
Tag.id -> Some(id),
8383
Tag.namespace -> Some(namespace),
@@ -96,7 +96,7 @@ private class PineconeVectorServiceImpl(
9696
namespace: String
9797
): Future[Unit] =
9898
execPOST(
99-
Command.vectors_delete,
99+
EndPoint.vectors_delete,
100100
bodyParams = jsonBodyParams(
101101
Tag.ids -> Some(ids),
102102
Tag.namespace -> Some(namespace)
@@ -110,7 +110,7 @@ private class PineconeVectorServiceImpl(
110110
assert(filter.nonEmpty, "Filter must be defined.")
111111

112112
execPOST(
113-
Command.vectors_delete,
113+
EndPoint.vectors_delete,
114114
bodyParams = jsonBodyParams(
115115
Tag.filter -> Some(filter),
116116
Tag.namespace -> Some(namespace)
@@ -122,7 +122,7 @@ private class PineconeVectorServiceImpl(
122122
namespace: String
123123
): Future[Unit] =
124124
execPOST(
125-
Command.vectors_delete,
125+
EndPoint.vectors_delete,
126126
bodyParams = jsonBodyParams(
127127
Tag.deleteAll -> Some(true),
128128
Tag.namespace -> Some(namespace)
@@ -134,7 +134,7 @@ private class PineconeVectorServiceImpl(
134134
namespace: String
135135
): Future[FetchResponse] =
136136
execGET(
137-
Command.vectors_fetch,
137+
EndPoint.vectors_fetch,
138138
params = Seq(
139139
Tag.namespace -> Some(namespace)
140140
) ++ ids.map(Tag.ids -> Some(_))
@@ -150,7 +150,7 @@ private class PineconeVectorServiceImpl(
150150
setMetaData: Map[String, String]
151151
): Future[Unit] =
152152
execPOST(
153-
Command.vectors_update,
153+
EndPoint.vectors_update,
154154
bodyParams = jsonBodyParams(
155155
Tag.id -> Some(id),
156156
Tag.namespace -> Some(namespace),
@@ -165,7 +165,7 @@ private class PineconeVectorServiceImpl(
165165
namespace: String
166166
): Future[Int] =
167167
execPOST(
168-
Command.vectors_upsert,
168+
EndPoint.vectors_upsert,
169169
bodyParams = jsonBodyParams(
170170
Tag.vectors -> Some(vectors.map(Json.toJson(_))),
171171
Tag.namespace -> Some(namespace)

0 commit comments

Comments
 (0)