Skip to content

Commit

Permalink
Deprecate gRPC API
Browse files Browse the repository at this point in the history
  • Loading branch information
Jotschi committed Oct 22, 2024
1 parent f2dbe94 commit 3c241c7
Show file tree
Hide file tree
Showing 39 changed files with 389 additions and 309 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.metaloom.loom.client.http;
package io.metaloom.loom.client.common;

import java.io.InputStream;
import java.util.Arrays;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package io.metaloom.loom.client.common;

import io.metaloom.loom.client.common.method.ClientMethods;

public interface LoomClient extends ClientMethods, CommonSettings, AutoCloseable {

/**
* Set the token to be used for authentication.
*
* @param token
*/
void setToken(String token);

/**
* Close the client and release all resources.
*/
void close();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package io.metaloom.loom.client.common;

public class LoomClientException extends Exception {

private static final long serialVersionUID = 6434236577973357902L;
private int code;

public LoomClientException(int code, String msg) {
super(msg);
this.code = code;
}

public LoomClientException(int code, String msg, Exception e) {
super(msg, e);
this.code = code;
}

public int getStatusCode() {
return code;
}

public String getStatusMsg() {
return getMessage();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package io.metaloom.loom.client.common;

import io.metaloom.loom.rest.model.RestResponseModel;
import io.reactivex.rxjava3.core.Single;

public interface LoomClientRequest<T extends RestResponseModel<T>> extends QueryParameters<T> {

Single<T> async();

T sync() throws LoomClientException;

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.metaloom.loom.client.http.parameter;
package io.metaloom.loom.client.common;

import java.time.Duration;
import java.util.UUID;
Expand All @@ -9,7 +9,6 @@
import io.metaloom.filter.key.impl.StringFilterKey;
import io.metaloom.loom.api.sort.SortDirection;
import io.metaloom.loom.api.sort.SortKey;
import io.metaloom.loom.client.http.LoomClientRequest;
import io.metaloom.loom.rest.model.RestResponseModel;
import io.metaloom.loom.rest.parameter.QueryParameterKey;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.metaloom.loom.client.http.method;
package io.metaloom.loom.client.common.method;

import java.util.UUID;

import io.metaloom.loom.client.http.LoomClientRequest;
import io.metaloom.loom.client.common.LoomClientRequest;
import io.metaloom.loom.rest.model.NoResponse;
import io.metaloom.loom.rest.model.annotation.AnnotationCreateRequest;
import io.metaloom.loom.rest.model.annotation.AnnotationListResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.metaloom.loom.client.http.method;
package io.metaloom.loom.client.common.method;

import java.util.UUID;

import io.metaloom.loom.client.http.LoomClientRequest;
import io.metaloom.loom.client.common.LoomClientRequest;
import io.metaloom.loom.rest.model.NoResponse;
import io.metaloom.loom.rest.model.asset.location.AssetLocationCreateRequest;
import io.metaloom.loom.rest.model.asset.location.AssetLocationListResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package io.metaloom.loom.client.http.method;
package io.metaloom.loom.client.common.method;

import static io.metaloom.loom.api.asset.AssetId.assetId;

import java.util.UUID;

import io.metaloom.loom.api.asset.AssetId;
import io.metaloom.loom.client.http.LoomClientRequest;
import io.metaloom.loom.client.common.LoomClientRequest;
import io.metaloom.loom.rest.model.NoResponse;
import io.metaloom.loom.rest.model.asset.AssetCreateRequest;
import io.metaloom.loom.rest.model.asset.AssetListResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package io.metaloom.loom.client.http.method;
package io.metaloom.loom.client.common.method;

import java.io.InputStream;
import java.util.UUID;

import io.metaloom.loom.client.http.LoomBinaryResponse;
import io.metaloom.loom.client.http.LoomClientRequest;
import io.metaloom.loom.client.common.LoomBinaryResponse;
import io.metaloom.loom.client.common.LoomClientRequest;
import io.metaloom.loom.rest.model.NoResponse;
import io.metaloom.loom.rest.model.attachment.AttachmentListResponse;
import io.metaloom.loom.rest.model.attachment.AttachmentResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.metaloom.loom.client.http.method;
package io.metaloom.loom.client.common.method;

import io.metaloom.loom.client.http.LoomClientRequest;
import io.metaloom.loom.client.common.LoomClientRequest;
import io.metaloom.loom.rest.model.auth.AuthLoginResponse;

public interface AuthenticationMethods {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package io.metaloom.loom.client.common.method;

public interface ClientMethods extends
UserMethods,
AssetMethods,
AssetLocationMethods,
AttachmentMethods,
ClusterMethods,
GroupMethods,
RoleMethods,
CollectionMethods,
AnnotationMethods,
TaskMethods,
TagMethods,
AuthenticationMethods,
ReactionMethods,
TokenMethods,
LibraryMethods,
ProjectMethods,
CommentMethods,
EmbeddingMethods {

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.metaloom.loom.client.http.method;
package io.metaloom.loom.client.common.method;

import java.util.UUID;

import io.metaloom.loom.client.http.LoomClientRequest;
import io.metaloom.loom.client.common.LoomClientRequest;
import io.metaloom.loom.rest.model.NoResponse;
import io.metaloom.loom.rest.model.cluster.ClusterCreateRequest;
import io.metaloom.loom.rest.model.cluster.ClusterListResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.metaloom.loom.client.http.method;
package io.metaloom.loom.client.common.method;

import java.util.UUID;

import io.metaloom.loom.client.http.LoomClientRequest;
import io.metaloom.loom.client.common.LoomClientRequest;
import io.metaloom.loom.rest.model.NoResponse;
import io.metaloom.loom.rest.model.collection.CollectionCreateRequest;
import io.metaloom.loom.rest.model.collection.CollectionListResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.metaloom.loom.client.http.method;
package io.metaloom.loom.client.common.method;

import java.util.UUID;

import io.metaloom.loom.client.http.LoomClientRequest;
import io.metaloom.loom.client.common.LoomClientRequest;
import io.metaloom.loom.rest.model.NoResponse;
import io.metaloom.loom.rest.model.comment.CommentCreateRequest;
import io.metaloom.loom.rest.model.comment.CommentListResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.metaloom.loom.client.http.method;
package io.metaloom.loom.client.common.method;

import java.util.UUID;

import io.metaloom.loom.client.http.LoomClientRequest;
import io.metaloom.loom.client.common.LoomClientRequest;
import io.metaloom.loom.rest.model.NoResponse;
import io.metaloom.loom.rest.model.embedding.EmbeddingCreateRequest;
import io.metaloom.loom.rest.model.embedding.EmbeddingListResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.metaloom.loom.client.http.method;
package io.metaloom.loom.client.common.method;

import java.util.UUID;

import io.metaloom.loom.client.http.LoomClientRequest;
import io.metaloom.loom.client.common.LoomClientRequest;
import io.metaloom.loom.rest.model.NoResponse;
import io.metaloom.loom.rest.model.group.GroupCreateRequest;
import io.metaloom.loom.rest.model.group.GroupListResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.metaloom.loom.client.http.method;
package io.metaloom.loom.client.common.method;

import java.util.UUID;

import io.metaloom.loom.client.http.LoomClientRequest;
import io.metaloom.loom.client.common.LoomClientRequest;
import io.metaloom.loom.rest.model.NoResponse;
import io.metaloom.loom.rest.model.library.LibraryCreateRequest;
import io.metaloom.loom.rest.model.library.LibraryListResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.metaloom.loom.client.http.method;
package io.metaloom.loom.client.common.method;

import java.util.UUID;

import io.metaloom.loom.client.http.LoomClientRequest;
import io.metaloom.loom.client.common.LoomClientRequest;
import io.metaloom.loom.rest.model.NoResponse;
import io.metaloom.loom.rest.model.project.ProjectCreateRequest;
import io.metaloom.loom.rest.model.project.ProjectListResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package io.metaloom.loom.client.http.method;
package io.metaloom.loom.client.common.method;

import static io.metaloom.loom.api.asset.AssetId.assetId;

import java.util.UUID;

import io.metaloom.loom.api.asset.AssetId;
import io.metaloom.loom.client.http.LoomClientRequest;
import io.metaloom.loom.client.common.LoomClientRequest;
import io.metaloom.loom.rest.model.NoResponse;
import io.metaloom.loom.rest.model.reaction.ReactionCreateRequest;
import io.metaloom.loom.rest.model.reaction.ReactionListResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.metaloom.loom.client.http.method;
package io.metaloom.loom.client.common.method;

import java.util.UUID;

import io.metaloom.loom.client.http.LoomClientRequest;
import io.metaloom.loom.client.common.LoomClientRequest;
import io.metaloom.loom.rest.model.NoResponse;
import io.metaloom.loom.rest.model.role.RoleCreateRequest;
import io.metaloom.loom.rest.model.role.RoleListResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package io.metaloom.loom.client.http.method;
package io.metaloom.loom.client.common.method;

import static io.metaloom.loom.api.asset.AssetId.assetId;

import java.util.UUID;

import io.metaloom.loom.api.asset.AssetId;
import io.metaloom.loom.client.http.LoomClientRequest;
import io.metaloom.loom.client.common.LoomClientRequest;
import io.metaloom.loom.rest.model.NoResponse;
import io.metaloom.loom.rest.model.tag.TagCreateRequest;
import io.metaloom.loom.rest.model.tag.TagListResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.metaloom.loom.client.http.method;
package io.metaloom.loom.client.common.method;

import java.util.UUID;

import io.metaloom.loom.client.http.LoomClientRequest;
import io.metaloom.loom.client.common.LoomClientRequest;
import io.metaloom.loom.rest.model.NoResponse;
import io.metaloom.loom.rest.model.task.TaskCreateRequest;
import io.metaloom.loom.rest.model.task.TaskListResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.metaloom.loom.client.http.method;
package io.metaloom.loom.client.common.method;

import java.util.UUID;

import io.metaloom.loom.client.http.LoomClientRequest;
import io.metaloom.loom.client.common.LoomClientRequest;
import io.metaloom.loom.rest.model.NoResponse;
import io.metaloom.loom.rest.model.token.TokenCreateRequest;
import io.metaloom.loom.rest.model.token.TokenListResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.metaloom.loom.client.http.method;
package io.metaloom.loom.client.common.method;

import java.util.UUID;

import io.metaloom.loom.client.http.LoomClientRequest;
import io.metaloom.loom.client.common.LoomClientRequest;
import io.metaloom.loom.rest.model.NoResponse;
import io.metaloom.loom.rest.model.user.UserCreateRequest;
import io.metaloom.loom.rest.model.user.UserListResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package io.metaloom.loom.client.grpc;

import io.metaloom.loom.client.common.LoomClient;
import io.metaloom.loom.client.grpc.impl.LoomGRPCClientImpl;
import io.metaloom.loom.client.grpc.method.AssetMethods;

public interface LoomGRPCClient extends AssetMethods, ClientSettings, AutoCloseable {
public interface LoomGRPCClient extends AssetMethods, ClientSettings, LoomClient {

static LoomGRPCClientImpl.Builder builder() {
return LoomGRPCClientImpl.builder();
Expand All @@ -12,16 +13,4 @@ static LoomGRPCClientImpl.Builder builder() {
// TODO add version info
String USER_AGENT = "Loom gRPC Client";

/**
* Close the prepared transport channel.
*/
void close();

/**
* Set the token that will be used to authenticate the requests.
*
* @param token
*/
void setToken(String token);

}
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
<modules>
<module>common</module>
<module>rest</module>
<!--
<module>grpc</module>
-->
<module>report</module>
</modules>

Expand Down Expand Up @@ -82,6 +84,12 @@
</licenses>

<dependencies>
<!-- Models-->
<dependency>
<groupId>io.metaloom.loom.shared</groupId>
<artifactId>loom-rest-model</artifactId>
</dependency>

<!--Test-->
<dependency>
<groupId>org.testcontainers</groupId>
Expand Down
4 changes: 3 additions & 1 deletion report/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<artifactId>loom-client-report</artifactId>
Expand All @@ -25,11 +25,13 @@
<artifactId>loom-client-rest</artifactId>
<version>${project.version}</version>
</dependency>
<!--
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>loom-client-grpc</artifactId>
<version>${project.version}</version>
</dependency>
-->
</dependencies>

<build>
Expand Down
Loading

0 comments on commit 3c241c7

Please sign in to comment.