├── .editorconfig ├── .github ├── CODEOWNERS └── workflows │ ├── create-release.yaml │ └── test.yaml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTE.md ├── LICENSE ├── README.md ├── decrypt_secret.sh ├── pom.xml ├── secrets.tar.gpg ├── src ├── main │ ├── java │ │ └── io │ │ │ └── weaviate │ │ │ └── client │ │ │ ├── Config.java │ │ │ ├── WeaviateAuthClient.java │ │ │ ├── WeaviateClient.java │ │ │ ├── base │ │ │ ├── AsyncBaseClient.java │ │ │ ├── AsyncBaseGraphQLClient.java │ │ │ ├── AsyncClientResult.java │ │ │ ├── BaseClient.java │ │ │ ├── BaseGraphQLClient.java │ │ │ ├── ClientResult.java │ │ │ ├── Response.java │ │ │ ├── Result.java │ │ │ ├── Serializer.java │ │ │ ├── WeaviateError.java │ │ │ ├── WeaviateErrorMessage.java │ │ │ ├── WeaviateErrorResponse.java │ │ │ ├── grpc │ │ │ │ ├── AsyncGrpcClient.java │ │ │ │ ├── GrpcClient.java │ │ │ │ └── base │ │ │ │ │ └── BaseGrpcClient.java │ │ │ ├── http │ │ │ │ ├── HttpClient.java │ │ │ │ ├── HttpResponse.java │ │ │ │ ├── async │ │ │ │ │ ├── AsyncHttpClient.java │ │ │ │ │ ├── ResponseParser.java │ │ │ │ │ ├── WeaviateGraphQLTypedResponseConsumer.java │ │ │ │ │ └── WeaviateResponseConsumer.java │ │ │ │ ├── builder │ │ │ │ │ └── HttpApacheClientBuilder.java │ │ │ │ └── impl │ │ │ │ │ └── CommonsHttpClientImpl.java │ │ │ └── util │ │ │ │ ├── Assert.java │ │ │ │ ├── BeaconPath.java │ │ │ │ ├── CrossReference.java │ │ │ │ ├── DbVersionProvider.java │ │ │ │ ├── DbVersionSupport.java │ │ │ │ ├── Futures.java │ │ │ │ ├── GroupHitDeserializer.java │ │ │ │ ├── GrpcVersionSupport.java │ │ │ │ ├── TriConsumer.java │ │ │ │ └── UrlEncoder.java │ │ │ ├── grpc │ │ │ └── protocol │ │ │ │ ├── v0 │ │ │ │ ├── WeaviateGrpc.java │ │ │ │ ├── WeaviateProto.java │ │ │ │ ├── WeaviateProtoBatch.java │ │ │ │ └── WeaviateProtoSearchGet.java │ │ │ │ └── v1 │ │ │ │ ├── WeaviateGrpc.java │ │ │ │ ├── WeaviateProto.java │ │ │ │ ├── WeaviateProtoAggregate.java │ │ │ │ ├── WeaviateProtoBase.java │ │ │ │ ├── WeaviateProtoBaseSearch.java │ │ │ │ ├── WeaviateProtoBatch.java │ │ │ │ ├── WeaviateProtoBatchDelete.java │ │ │ │ ├── WeaviateProtoGenerative.java │ │ │ │ ├── WeaviateProtoProperties.java │ │ │ │ ├── WeaviateProtoSearchGet.java │ │ │ │ └── WeaviateProtoTenants.java │ │ │ └── v1 │ │ │ ├── async │ │ │ ├── WeaviateAsyncClient.java │ │ │ ├── backup │ │ │ │ ├── Backup.java │ │ │ │ └── api │ │ │ │ │ ├── BackupCanceler.java │ │ │ │ │ ├── BackupCreateStatusGetter.java │ │ │ │ │ ├── BackupCreator.java │ │ │ │ │ ├── BackupGetter.java │ │ │ │ │ ├── BackupRestoreStatusGetter.java │ │ │ │ │ └── BackupRestorer.java │ │ │ ├── batch │ │ │ │ ├── Batch.java │ │ │ │ └── api │ │ │ │ │ ├── ObjectsBatchDeleter.java │ │ │ │ │ ├── ObjectsBatcher.java │ │ │ │ │ └── ReferencesBatcher.java │ │ │ ├── classifications │ │ │ │ ├── Classifications.java │ │ │ │ └── api │ │ │ │ │ ├── Getter.java │ │ │ │ │ └── Scheduler.java │ │ │ ├── cluster │ │ │ │ ├── Cluster.java │ │ │ │ └── api │ │ │ │ │ └── NodesStatusGetter.java │ │ │ ├── data │ │ │ │ ├── Data.java │ │ │ │ └── api │ │ │ │ │ ├── ObjectCreator.java │ │ │ │ │ ├── ObjectDeleter.java │ │ │ │ │ ├── ObjectUpdater.java │ │ │ │ │ ├── ObjectValidator.java │ │ │ │ │ ├── ObjectsChecker.java │ │ │ │ │ ├── ObjectsGetter.java │ │ │ │ │ ├── ReferenceCreator.java │ │ │ │ │ ├── ReferenceDeleter.java │ │ │ │ │ └── ReferenceReplacer.java │ │ │ ├── graphql │ │ │ │ ├── GraphQL.java │ │ │ │ └── api │ │ │ │ │ ├── Aggregate.java │ │ │ │ │ ├── Explore.java │ │ │ │ │ ├── Get.java │ │ │ │ │ └── Raw.java │ │ │ ├── misc │ │ │ │ ├── Misc.java │ │ │ │ └── api │ │ │ │ │ ├── LiveChecker.java │ │ │ │ │ ├── MetaGetter.java │ │ │ │ │ ├── OpenIDConfigGetter.java │ │ │ │ │ └── ReadyChecker.java │ │ │ ├── rbac │ │ │ │ ├── Roles.java │ │ │ │ └── api │ │ │ │ │ ├── AssignedUsersGetter.java │ │ │ │ │ ├── PermissionAdder.java │ │ │ │ │ ├── PermissionChecker.java │ │ │ │ │ ├── PermissionRemover.java │ │ │ │ │ ├── RoleAllGetter.java │ │ │ │ │ ├── RoleCreator.java │ │ │ │ │ ├── RoleDeleter.java │ │ │ │ │ ├── RoleExists.java │ │ │ │ │ ├── RoleGetter.java │ │ │ │ │ └── UserAssignmentsGetter.java │ │ │ ├── schema │ │ │ │ ├── Schema.java │ │ │ │ └── api │ │ │ │ │ ├── ClassCreator.java │ │ │ │ │ ├── ClassDeleter.java │ │ │ │ │ ├── ClassExists.java │ │ │ │ │ ├── ClassGetter.java │ │ │ │ │ ├── ClassUpdater.java │ │ │ │ │ ├── PropertyCreator.java │ │ │ │ │ ├── SchemaDeleter.java │ │ │ │ │ ├── SchemaGetter.java │ │ │ │ │ ├── ShardUpdater.java │ │ │ │ │ ├── ShardsGetter.java │ │ │ │ │ ├── ShardsUpdater.java │ │ │ │ │ ├── TenantsCreator.java │ │ │ │ │ ├── TenantsDeleter.java │ │ │ │ │ ├── TenantsExists.java │ │ │ │ │ ├── TenantsGetter.java │ │ │ │ │ └── TenantsUpdater.java │ │ │ └── users │ │ │ │ ├── DbUsers.java │ │ │ │ ├── OidcUsers.java │ │ │ │ ├── Users.java │ │ │ │ └── api │ │ │ │ ├── MyUserGetter.java │ │ │ │ ├── RoleAssigner.java │ │ │ │ ├── RoleRevoker.java │ │ │ │ ├── UserRolesGetter.java │ │ │ │ ├── common │ │ │ │ └── AssignedRolesGetter.java │ │ │ │ └── db │ │ │ │ ├── Activator.java │ │ │ │ ├── AllGetter.java │ │ │ │ ├── ByNameGetter.java │ │ │ │ ├── Creator.java │ │ │ │ ├── Deactivator.java │ │ │ │ ├── Deleter.java │ │ │ │ └── KeyRotator.java │ │ │ ├── auth │ │ │ ├── ApiKeyFlow.java │ │ │ ├── Authentication.java │ │ │ ├── BearerTokenFlow.java │ │ │ ├── ClientCredentialsFlow.java │ │ │ ├── ResourceOwnerPasswordFlow.java │ │ │ ├── exception │ │ │ │ └── AuthException.java │ │ │ ├── nimbus │ │ │ │ ├── AuthType.java │ │ │ │ ├── BaseAuth.java │ │ │ │ └── NimbusAuth.java │ │ │ └── provider │ │ │ │ ├── AccessTokenProvider.java │ │ │ │ ├── AuthClientCredentialsTokenProvider.java │ │ │ │ └── AuthRefreshTokenProvider.java │ │ │ ├── backup │ │ │ ├── Backup.java │ │ │ ├── api │ │ │ │ ├── BackupCanceler.java │ │ │ │ ├── BackupCreateStatusGetter.java │ │ │ │ ├── BackupCreator.java │ │ │ │ ├── BackupGetter.java │ │ │ │ ├── BackupRestoreStatusGetter.java │ │ │ │ └── BackupRestorer.java │ │ │ └── model │ │ │ │ ├── Backend.java │ │ │ │ ├── BackupCreateResponse.java │ │ │ │ ├── BackupCreateStatusResponse.java │ │ │ │ ├── BackupRestoreResponse.java │ │ │ │ ├── BackupRestoreStatusResponse.java │ │ │ │ ├── CreateStatus.java │ │ │ │ └── RestoreStatus.java │ │ │ ├── batch │ │ │ ├── Batch.java │ │ │ ├── api │ │ │ │ ├── ObjectsBatchDeleter.java │ │ │ │ ├── ObjectsBatcher.java │ │ │ │ ├── ReferencePayloadBuilder.java │ │ │ │ └── ReferencesBatcher.java │ │ │ ├── grpc │ │ │ │ └── BatchObjectConverter.java │ │ │ ├── model │ │ │ │ ├── BatchDeleteOutput.java │ │ │ │ ├── BatchDeleteResponse.java │ │ │ │ ├── BatchDeleteResultStatus.java │ │ │ │ ├── BatchReference.java │ │ │ │ ├── BatchReferenceResponse.java │ │ │ │ ├── BatchReferenceResponseAO1Result.java │ │ │ │ ├── BatchReferenceResponseStatus.java │ │ │ │ ├── ObjectGetResponse.java │ │ │ │ ├── ObjectGetResponseStatus.java │ │ │ │ ├── ObjectsBatchRequestBody.java │ │ │ │ └── ObjectsGetResponseAO2Result.java │ │ │ └── util │ │ │ │ ├── ObjectsPath.java │ │ │ │ └── ReferencesPath.java │ │ │ ├── classifications │ │ │ ├── Classifications.java │ │ │ ├── api │ │ │ │ ├── Getter.java │ │ │ │ └── Scheduler.java │ │ │ └── model │ │ │ │ ├── Classification.java │ │ │ │ ├── ClassificationFilters.java │ │ │ │ ├── ClassificationMeta.java │ │ │ │ ├── ClassificationType.java │ │ │ │ └── ParamsKNN.java │ │ │ ├── cluster │ │ │ ├── Cluster.java │ │ │ ├── api │ │ │ │ └── NodesStatusGetter.java │ │ │ └── model │ │ │ │ ├── NodeStatusOutput.java │ │ │ │ └── NodesStatusResponse.java │ │ │ ├── contextionary │ │ │ ├── Contextionary.java │ │ │ ├── api │ │ │ │ ├── ConceptsGetter.java │ │ │ │ └── ExtensionCreator.java │ │ │ └── model │ │ │ │ ├── C11yExtension.java │ │ │ │ ├── C11yNearestNeighbor.java │ │ │ │ ├── C11yWordsResponse.java │ │ │ │ ├── C11yWordsResponseConcatenatedWord.java │ │ │ │ ├── C11yWordsResponseIndividualWordsItems.java │ │ │ │ └── C11yWordsResponseIndividualWordsItems0Info.java │ │ │ ├── data │ │ │ ├── Data.java │ │ │ ├── api │ │ │ │ ├── ObjectCreator.java │ │ │ │ ├── ObjectDeleter.java │ │ │ │ ├── ObjectUpdater.java │ │ │ │ ├── ObjectValidator.java │ │ │ │ ├── ObjectsChecker.java │ │ │ │ ├── ObjectsGetter.java │ │ │ │ ├── ReferenceCreator.java │ │ │ │ ├── ReferenceDeleter.java │ │ │ │ └── ReferenceReplacer.java │ │ │ ├── builder │ │ │ │ └── ReferencePayloadBuilder.java │ │ │ ├── model │ │ │ │ ├── Deprecation.java │ │ │ │ ├── ObjectReference.java │ │ │ │ ├── ObjectsListResponse.java │ │ │ │ ├── ReferenceMetaClassification.java │ │ │ │ ├── SingleRef.java │ │ │ │ └── WeaviateObject.java │ │ │ ├── replication │ │ │ │ └── model │ │ │ │ │ └── ConsistencyLevel.java │ │ │ └── util │ │ │ │ ├── ObjectsPath.java │ │ │ │ └── ReferencesPath.java │ │ │ ├── experimental │ │ │ ├── Batcher.java │ │ │ ├── Collection.java │ │ │ ├── Collections.java │ │ │ ├── DataClient.java │ │ │ ├── Metadata.java │ │ │ ├── MetadataField.java │ │ │ ├── NearVector.java │ │ │ ├── Operand.java │ │ │ ├── SearchClient.java │ │ │ ├── SearchOptions.java │ │ │ ├── SearchResult.java │ │ │ └── Where.java │ │ │ ├── filters │ │ │ ├── Operator.java │ │ │ └── WhereFilter.java │ │ │ ├── graphql │ │ │ ├── GraphQL.java │ │ │ ├── model │ │ │ │ ├── ExploreFields.java │ │ │ │ ├── GraphQLError.java │ │ │ │ ├── GraphQLErrorLocationsItems.java │ │ │ │ ├── GraphQLGetBaseObject.java │ │ │ │ ├── GraphQLQuery.java │ │ │ │ ├── GraphQLResponse.java │ │ │ │ └── GraphQLTypedResponse.java │ │ │ └── query │ │ │ │ ├── Aggregate.java │ │ │ │ ├── Explore.java │ │ │ │ ├── Get.java │ │ │ │ ├── Raw.java │ │ │ │ ├── argument │ │ │ │ ├── Argument.java │ │ │ │ ├── AskArgument.java │ │ │ │ ├── Bm25Argument.java │ │ │ │ ├── FusionType.java │ │ │ │ ├── GroupArgument.java │ │ │ │ ├── GroupByArgument.java │ │ │ │ ├── GroupType.java │ │ │ │ ├── HybridArgument.java │ │ │ │ ├── NearAudioArgument.java │ │ │ │ ├── NearDepthArgument.java │ │ │ │ ├── NearImageArgument.java │ │ │ │ ├── NearImuArgument.java │ │ │ │ ├── NearMediaArgumentHelper.java │ │ │ │ ├── NearObjectArgument.java │ │ │ │ ├── NearTextArgument.java │ │ │ │ ├── NearTextMoveParameters.java │ │ │ │ ├── NearThermalArgument.java │ │ │ │ ├── NearVectorArgument.java │ │ │ │ ├── NearVideoArgument.java │ │ │ │ ├── SortArgument.java │ │ │ │ ├── SortArguments.java │ │ │ │ ├── SortOrder.java │ │ │ │ ├── Targets.java │ │ │ │ └── WhereArgument.java │ │ │ │ ├── builder │ │ │ │ ├── AggregateBuilder.java │ │ │ │ ├── ExploreBuilder.java │ │ │ │ ├── GetBuilder.java │ │ │ │ └── Query.java │ │ │ │ ├── fields │ │ │ │ ├── Field.java │ │ │ │ ├── Fields.java │ │ │ │ └── GenerativeSearchBuilder.java │ │ │ │ └── util │ │ │ │ └── Serializer.java │ │ │ ├── grpc │ │ │ ├── GRPC.java │ │ │ └── query │ │ │ │ └── Raw.java │ │ │ ├── misc │ │ │ ├── Misc.java │ │ │ ├── api │ │ │ │ ├── LiveChecker.java │ │ │ │ ├── MetaGetter.java │ │ │ │ ├── OpenIDConfigGetter.java │ │ │ │ └── ReadyChecker.java │ │ │ └── model │ │ │ │ ├── BM25Config.java │ │ │ │ ├── BQConfig.java │ │ │ │ ├── DistanceType.java │ │ │ │ ├── InvertedIndexConfig.java │ │ │ │ ├── Meta.java │ │ │ │ ├── MultiTenancyConfig.java │ │ │ │ ├── MultiVectorConfig.java │ │ │ │ ├── MuveraConfig.java │ │ │ │ ├── OpenIDConfiguration.java │ │ │ │ ├── PQConfig.java │ │ │ │ ├── ReplicationConfig.java │ │ │ │ ├── SQConfig.java │ │ │ │ ├── ShardingConfig.java │ │ │ │ ├── StopwordConfig.java │ │ │ │ └── VectorIndexConfig.java │ │ │ ├── rbac │ │ │ ├── Roles.java │ │ │ ├── api │ │ │ │ ├── AssignedUsersGetter.java │ │ │ │ ├── PermissionAdder.java │ │ │ │ ├── PermissionChecker.java │ │ │ │ ├── PermissionRemover.java │ │ │ │ ├── RoleAllGetter.java │ │ │ │ ├── RoleCreator.java │ │ │ │ ├── RoleDeleter.java │ │ │ │ ├── RoleExists.java │ │ │ │ ├── RoleGetter.java │ │ │ │ ├── UserAssignmentsGetter.java │ │ │ │ ├── WeaviatePermission.java │ │ │ │ └── WeaviateRole.java │ │ │ └── model │ │ │ │ ├── BackupsPermission.java │ │ │ │ ├── ClusterPermission.java │ │ │ │ ├── CollectionsPermission.java │ │ │ │ ├── DataPermission.java │ │ │ │ ├── NodesPermission.java │ │ │ │ ├── Permission.java │ │ │ │ ├── RbacAction.java │ │ │ │ ├── Role.java │ │ │ │ ├── RolesPermission.java │ │ │ │ ├── TenantsPermission.java │ │ │ │ ├── UserAssignment.java │ │ │ │ └── UsersPermission.java │ │ │ ├── schema │ │ │ ├── Schema.java │ │ │ ├── api │ │ │ │ ├── ClassCreator.java │ │ │ │ ├── ClassDeleter.java │ │ │ │ ├── ClassExists.java │ │ │ │ ├── ClassGetter.java │ │ │ │ ├── ClassUpdater.java │ │ │ │ ├── PropertyCreator.java │ │ │ │ ├── SchemaDeleter.java │ │ │ │ ├── SchemaGetter.java │ │ │ │ ├── ShardUpdater.java │ │ │ │ ├── ShardsGetter.java │ │ │ │ ├── ShardsUpdater.java │ │ │ │ ├── TenantsCreator.java │ │ │ │ ├── TenantsDeleter.java │ │ │ │ ├── TenantsExists.java │ │ │ │ ├── TenantsGetter.java │ │ │ │ └── TenantsUpdater.java │ │ │ └── model │ │ │ │ ├── ActivityStatus.java │ │ │ │ ├── DataType.java │ │ │ │ ├── Property.java │ │ │ │ ├── Schema.java │ │ │ │ ├── Shard.java │ │ │ │ ├── ShardStatus.java │ │ │ │ ├── ShardStatuses.java │ │ │ │ ├── Tenant.java │ │ │ │ ├── Tokenization.java │ │ │ │ └── WeaviateClass.java │ │ │ └── users │ │ │ ├── DbUsers.java │ │ │ ├── OidcUsers.java │ │ │ ├── Users.java │ │ │ ├── api │ │ │ ├── MyUserGetter.java │ │ │ ├── RoleAssigner.java │ │ │ ├── RoleRevoker.java │ │ │ ├── UserRolesGetter.java │ │ │ ├── WeaviateUser.java │ │ │ ├── common │ │ │ │ └── AssignedRolesGetter.java │ │ │ └── db │ │ │ │ ├── Activator.java │ │ │ │ ├── AllGetter.java │ │ │ │ ├── ByNameGetter.java │ │ │ │ ├── Creator.java │ │ │ │ ├── Deactivator.java │ │ │ │ ├── Deleter.java │ │ │ │ └── KeyRotator.java │ │ │ └── model │ │ │ ├── User.java │ │ │ └── UserDb.java │ └── proto │ │ ├── v0 │ │ ├── batch.proto │ │ ├── search_get.proto │ │ └── weaviate.proto │ │ └── v1 │ │ ├── aggregate.proto │ │ ├── base.proto │ │ ├── base_search.proto │ │ ├── batch.proto │ │ ├── batch_delete.proto │ │ ├── generative.proto │ │ ├── properties.proto │ │ ├── search_get.proto │ │ ├── tenants.proto │ │ └── weaviate.proto └── test │ ├── java │ └── io │ │ └── weaviate │ │ ├── client │ │ ├── ConfigTest.java │ │ ├── WeaviateAuthClientTest.java │ │ ├── base │ │ │ ├── SerializerTest.java │ │ │ ├── http │ │ │ │ └── impl │ │ │ │ │ └── CommonsHttpClientImplTest.java │ │ │ └── util │ │ │ │ ├── BeaconPathTest.java │ │ │ │ ├── CrossReferenceTest.java │ │ │ │ ├── DbVersionProviderTest.java │ │ │ │ ├── DbVersionSupportTest.java │ │ │ │ └── GrpcVersionSupportTest.java │ │ └── v1 │ │ │ ├── auth │ │ │ └── provider │ │ │ │ └── AccessTokenProviderTest.java │ │ │ ├── batch │ │ │ ├── api │ │ │ │ └── ReferencePayloadBuilderTest.java │ │ │ ├── model │ │ │ │ └── BatchReferenceResponseTest.java │ │ │ └── util │ │ │ │ ├── ObjectsPathTest.java │ │ │ │ └── ReferencesPathTest.java │ │ │ ├── contextionary │ │ │ └── model │ │ │ │ └── C11yWordsResponseTest.java │ │ │ ├── data │ │ │ ├── builder │ │ │ │ └── ReferencePayloadBuilderTest.java │ │ │ ├── model │ │ │ │ ├── ObjectTest.java │ │ │ │ ├── ObjectsListResponseTest.java │ │ │ │ └── WeaviateObjectAdapterTest.java │ │ │ └── util │ │ │ │ ├── ObjectsPathTest.java │ │ │ │ └── ReferencesPathTest.java │ │ │ ├── graphql │ │ │ ├── model │ │ │ │ └── GraphQLTypedResponseTest.java │ │ │ └── query │ │ │ │ ├── argument │ │ │ │ ├── AskArgumentTest.java │ │ │ │ ├── Bm25ArgumentTest.java │ │ │ │ ├── GroupArgumentTest.java │ │ │ │ ├── GroupByArgumentTest.java │ │ │ │ ├── HybridArgumentTest.java │ │ │ │ ├── NearAudioArgumentTest.java │ │ │ │ ├── NearDepthArgumentTest.java │ │ │ │ ├── NearImageArgumentTest.java │ │ │ │ ├── NearImuArgumentTest.java │ │ │ │ ├── NearMediaArgumentHelperTest.java │ │ │ │ ├── NearMediaTargetsArgument.java │ │ │ │ ├── NearObjectArgumentTest.java │ │ │ │ ├── NearTextArgumentTest.java │ │ │ │ ├── NearThermalArgumentTest.java │ │ │ │ ├── NearVectorArgumentTest.java │ │ │ │ ├── NearVideoArgumentTest.java │ │ │ │ ├── SortArgumentTest.java │ │ │ │ ├── SortArgumentsTest.java │ │ │ │ ├── TargetsTest.java │ │ │ │ └── WhereArgumentTest.java │ │ │ │ ├── builder │ │ │ │ ├── AggregateBuilderTest.java │ │ │ │ ├── ExploreBuilderTest.java │ │ │ │ └── GetBuilderTest.java │ │ │ │ ├── fields │ │ │ │ ├── FieldTest.java │ │ │ │ ├── FieldsTest.java │ │ │ │ └── GenerativeSearchBuilderTest.java │ │ │ │ └── util │ │ │ │ └── SerializerTest.java │ │ │ ├── grpc │ │ │ └── GRPCTest.java │ │ │ ├── rbac │ │ │ ├── api │ │ │ │ └── WeaviatePermissionTest.java │ │ │ └── model │ │ │ │ └── PermissionTest.java │ │ │ ├── schema │ │ │ └── model │ │ │ │ ├── PropertyTest.java │ │ │ │ └── WeaviateClassTest.java │ │ │ └── users │ │ │ └── api │ │ │ └── WeaviateUserTest.java │ │ └── integration │ │ ├── client │ │ ├── AssertMultiTenancy.java │ │ ├── WeaviateDockerCompose.java │ │ ├── WeaviateDockerComposeCluster.java │ │ ├── WeaviateDockerImage.java │ │ ├── WeaviateTestGenerics.java │ │ ├── WeaviateVersion.java │ │ ├── WeaviateWithAzureContainer.java │ │ ├── WeaviateWithOidcContainer.java │ │ ├── WeaviateWithOktaCcContainer.java │ │ ├── WeaviateWithOktaUsersContainer.java │ │ ├── WeaviateWithRbacContainer.java │ │ ├── async │ │ │ ├── backup │ │ │ │ └── ClientBackupTest.java │ │ │ ├── batch │ │ │ │ ├── ClientBatchCreateMockServerTest.java │ │ │ │ ├── ClientBatchCreateTest.java │ │ │ │ ├── ClientBatchDeleteTest.java │ │ │ │ ├── ClientBatchGrpcCreateNamedVectorsTest.java │ │ │ │ ├── ClientBatchGrpcCreateTest.java │ │ │ │ ├── ClientBatchReferencesCreateMockServerTest.java │ │ │ │ └── ClientBatchReferencesCreateTest.java │ │ │ ├── classifications │ │ │ │ └── ClientClassificationsTest.java │ │ │ ├── cluster │ │ │ │ ├── ClientClusterMultiTenancyTest.java │ │ │ │ └── ClientClusterTest.java │ │ │ ├── data │ │ │ │ ├── ClientDataTest.java │ │ │ │ └── ClientReferencesTest.java │ │ │ ├── graphql │ │ │ │ ├── AbstractAsyncClientTest.java │ │ │ │ ├── ClientGraphQLMultiTargetSearchTest.java │ │ │ │ ├── ClientGraphQLMultiTenancyTest.java │ │ │ │ ├── ClientGraphQLTest.java │ │ │ │ ├── ClientGraphQLTypedTest.java │ │ │ │ └── ClusterGraphQLTest.java │ │ │ ├── misc │ │ │ │ └── ClientMiscTest.java │ │ │ ├── rbac │ │ │ │ └── ClientRbacTest.java │ │ │ ├── schema │ │ │ │ ├── ClientSchemaMultiTenancyTest.java │ │ │ │ └── ClientSchemaTest.java │ │ │ └── users │ │ │ │ └── ClientUsersTest.java │ │ ├── auth │ │ │ ├── AuthAzureClientCredentialsTest.java │ │ │ ├── AuthOktaClientCredentialsTest.java │ │ │ ├── AuthOktaUsersTest.java │ │ │ ├── AuthWCSUsersApiKeyTest.java │ │ │ ├── AuthWCSUsersResourceOwnerTest.java │ │ │ ├── AuthWeaviateEmbeddingHeadersTest.java │ │ │ └── provider │ │ │ │ ├── NimbusAuthClientCredentialsRefreshTokenTest.java │ │ │ │ └── NimbusAuthRefreshTokenTest.java │ │ ├── backup │ │ │ └── ClientBackupTest.java │ │ ├── batch │ │ │ ├── ClientBatchCreateMockServer2Test.java │ │ │ ├── ClientBatchCreateMockServerTest.java │ │ │ ├── ClientBatchCreateTest.java │ │ │ ├── ClientBatchDeleteTest.java │ │ │ ├── ClientBatchGrpcCreateNamedVectorsTest.java │ │ │ ├── ClientBatchGrpcCreateTest.java │ │ │ ├── ClientBatchGrpcVectorBytesTest.java │ │ │ ├── ClientBatchMultiTenancyTest.java │ │ │ ├── ClientBatchReferencesCreateMockServerTest.java │ │ │ ├── ClientBatchReferencesCreateTest.java │ │ │ └── ClientBatchReferencesMultiTenancyTest.java │ │ ├── classifications │ │ │ └── ClientClassificationsTest.java │ │ ├── cluster │ │ │ ├── ClientClusterMultiTenancyTest.java │ │ │ └── ClientClusterTest.java │ │ ├── contextionary │ │ │ └── ClientContextionaryTest.java │ │ ├── data │ │ │ ├── ClientDataMultiTenancyTest.java │ │ │ ├── ClientDataTest.java │ │ │ ├── ClientReferencesMultiTenancyTest.java │ │ │ └── ClientReferencesTest.java │ │ ├── deprecated │ │ │ ├── batch │ │ │ │ └── ClientBatchCreateDeprecatedAPITest.java │ │ │ └── data │ │ │ │ ├── ClientDataDeprecatedAPITest.java │ │ │ │ └── ClientReferencesDeprecatedAPITest.java │ │ ├── graphql │ │ │ ├── AbstractClientGraphQLTest.java │ │ │ ├── ClientGraphQLMultiTargetSearchTest.java │ │ │ ├── ClientGraphQLMultiTenancyTest.java │ │ │ ├── ClientGraphQLTest.java │ │ │ ├── ClientGraphQLTypedTest.java │ │ │ └── ClusterGraphQLTest.java │ │ ├── grpc │ │ │ └── GRPCBenchTest.java │ │ ├── misc │ │ │ └── ClientMiscTest.java │ │ ├── proxy │ │ │ └── ClientProxyTest.java │ │ ├── rbac │ │ │ └── ClientRbacTest.java │ │ ├── schema │ │ │ ├── ClientSchemaDefaultsAndMigrationTest.java │ │ │ ├── ClientSchemaMultiTenancyTest.java │ │ │ ├── ClientSchemaTenantOffloadingTest.java │ │ │ ├── ClientSchemaTest.java │ │ │ ├── ClusterSchemaTest.java │ │ │ └── NestedObjectsUtils.java │ │ └── users │ │ │ └── ClientUsersTest.java │ │ └── tests │ │ ├── backup │ │ └── BackupTestSuite.java │ │ ├── batch │ │ ├── BatchObjectsMockServerTestSuite.java │ │ ├── BatchObjectsTestSuite.java │ │ ├── BatchReferencesMockServerTestSuite.java │ │ ├── BatchReferencesTestSuite.java │ │ ├── ClientBatchDeleteTestSuite.java │ │ ├── ClientBatchGrpcCreateNamedVectorsTestSuite.java │ │ └── ClientBatchGrpcCreateTestSuite.java │ │ ├── classifications │ │ └── ClassificationsTestSuite.java │ │ ├── cluster │ │ ├── ClusterMultiTenancyTestSuite.java │ │ └── ClusterTestSuite.java │ │ ├── data │ │ └── DataTestSuite.java │ │ ├── graphql │ │ └── ClientGraphQLTypedTestSuite.java │ │ ├── misc │ │ └── MiscTestSuite.java │ │ ├── rbac │ │ └── ClientRbacTestSuite.java │ │ ├── schema │ │ └── SchemaTestSuite.java │ │ └── users │ │ └── ClientUsersTestSuite.java │ └── resources │ ├── docker-compose-proxy.yaml │ ├── image │ ├── base64.txt │ └── pixel.png │ ├── json │ ├── batch-reference-response.json │ ├── c11y-concepts.json │ ├── graphql-group-by-response.json │ ├── graphql-response.json │ ├── nested-array-object.json │ ├── nested-one-object.json │ ├── object.json │ ├── object2.json │ └── objects-list-response.json │ └── logback-test.xml └── tools └── prepare_release.sh /.editorconfig: -------------------------------------------------------------------------------- 1 | [*] 2 | charset = utf-8 3 | indent_style = space 4 | indent_size = 2 5 | insert_final_newline = true -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Ci related folders 2 | /.github/ @weaviate/core 3 | decrypt_secret.sh @weaviate/core 4 | secrets.tar.gp @weaviate/core 5 | -------------------------------------------------------------------------------- /.github/workflows/test.yaml: -------------------------------------------------------------------------------- 1 | name: Tests 2 | on: 3 | push: 4 | branches: 5 | - main 6 | pull_request: 7 | 8 | jobs: 9 | tests: 10 | name: Tests 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v3 14 | - name: Login to Docker Hub 15 | if: ${{ !github.event.pull_request.head.repo.fork }} 16 | uses: docker/login-action@v2 17 | with: 18 | username: ${{secrets.DOCKER_USERNAME}} 19 | password: ${{secrets.DOCKER_PASSWORD}} 20 | - name: Run Build 21 | run: mvn -DskipTests clean package 22 | - name: Run Tests 23 | env: 24 | OKTA_DUMMY_CI_PW: ${{ secrets.OKTA_DUMMY_CI_PW }} 25 | WCS_DUMMY_CI_PW: ${{ secrets.WCS_DUMMY_CI_PW }} 26 | OKTA_CLIENT_SECRET: ${{ secrets.OKTA_CLIENT_SECRET }} 27 | AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }} 28 | OPENAI_APIKEY: ${{ secrets.OPENAI_APIKEY }} 29 | run: | 30 | mvn clean test 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # macOS 2 | .DS_Store 3 | # Eclipse 4 | .project 5 | .classpath 6 | .settings 7 | # Idea 8 | .idea 9 | *.iml 10 | # Maven 11 | target/ 12 | # maven-lombok-plugin 13 | .factorypath 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020, Weaviate B.V. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | 3. Neither the name of the copyright holder nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /decrypt_secret.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | 4 | # --batch to prevent interactive command 5 | # --yes to assume "yes" for questions 6 | gpg --quiet --batch --yes --decrypt --passphrase="$GPG_PASSPHRASE" --output secrets.tar secrets.tar.gpg 7 | tar xvf secrets.tar 8 | gpg --batch --import key.gpg 9 | gpg --list-secret-keys 10 | echo "Success" 11 | -------------------------------------------------------------------------------- /secrets.tar.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/java-client/03cf63d6f0ebf486387166cbc3b3b6473a29dd71/secrets.tar.gpg -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/base/AsyncBaseGraphQLClient.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.base; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.base.http.async.WeaviateGraphQLTypedResponseConsumer; 5 | import io.weaviate.client.v1.auth.provider.AccessTokenProvider; 6 | import io.weaviate.client.v1.graphql.model.GraphQLTypedResponse; 7 | import java.util.concurrent.Future; 8 | import org.apache.hc.client5.http.async.methods.SimpleRequestProducer; 9 | import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient; 10 | import org.apache.hc.core5.concurrent.FutureCallback; 11 | 12 | public class AsyncBaseGraphQLClient extends AsyncBaseClient { 13 | public AsyncBaseGraphQLClient(CloseableHttpAsyncClient client, Config config, AccessTokenProvider tokenProvider) { 14 | super(client, config, tokenProvider); 15 | } 16 | 17 | protected Future>> sendGraphQLTypedRequest(Object payload, Class classOfC, 18 | FutureCallback>> callback) { 19 | return client.execute(SimpleRequestProducer.create(getRequest("/graphql", payload, "POST")), new WeaviateGraphQLTypedResponseConsumer<>(classOfC), callback); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/base/AsyncClientResult.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.base; 2 | 3 | import org.apache.hc.core5.concurrent.FutureCallback; 4 | 5 | import java.util.concurrent.Future; 6 | 7 | public interface AsyncClientResult { 8 | default Future> run() { 9 | return run(null); 10 | } 11 | 12 | Future> run(FutureCallback> callback); 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/base/BaseGraphQLClient.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.base; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.base.http.HttpClient; 5 | import io.weaviate.client.base.http.HttpResponse; 6 | import io.weaviate.client.v1.graphql.model.GraphQLTypedResponse; 7 | 8 | public abstract class BaseGraphQLClient extends BaseClient { 9 | public BaseGraphQLClient(HttpClient client, Config config) { 10 | super(client, config); 11 | } 12 | 13 | private GraphQLTypedResponse toResponseTyped(String response, Class classOfC) { 14 | return serializer.toGraphQLTypedResponse(response, classOfC); 15 | } 16 | 17 | protected Response> sendGraphQLTypedRequest(Object payload, Class classOfC) { 18 | try { 19 | HttpResponse response = this.sendHttpRequest("/graphql", payload, "POST"); 20 | int statusCode = response.getStatusCode(); 21 | String responseBody = response.getBody(); 22 | 23 | if (statusCode < 399) { 24 | GraphQLTypedResponse body = toResponseTyped(responseBody, classOfC); 25 | return new Response<>(statusCode, body, null); 26 | } 27 | 28 | WeaviateErrorResponse error = toResponse(responseBody, WeaviateErrorResponse.class); 29 | return new Response<>(statusCode, null, error); 30 | } catch (Exception e) { 31 | WeaviateErrorResponse errors = getWeaviateErrorResponse(e); 32 | return new Response<>(0, null, errors); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/base/ClientResult.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.base; 2 | 3 | public interface ClientResult { 4 | Result run(); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/base/Response.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.base; 2 | 3 | import io.weaviate.client.v1.graphql.model.GraphQLResponse; 4 | import java.util.List; 5 | import lombok.AccessLevel; 6 | import lombok.Getter; 7 | import lombok.experimental.FieldDefaults; 8 | 9 | @Getter 10 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 11 | public class Response { 12 | int statusCode; 13 | T body; 14 | WeaviateErrorResponse errors; 15 | 16 | public Response(int statusCode, T body, WeaviateErrorResponse errors) { 17 | this.statusCode = statusCode; 18 | this.body = body; 19 | if (body instanceof GraphQLResponse) { 20 | this.errors = getWeaviateGraphQLErrorResponse((GraphQLResponse) body, statusCode);; 21 | } else { 22 | this.errors = errors; 23 | } 24 | } 25 | 26 | /** 27 | * Extract errors from {@link WeaviateErrorResponse} from a GraphQL response body. 28 | * 29 | * @param gql GraphQL response body. 30 | * @param code HTTP status code to pass in the {@link WeaviateErrorResponse}. 31 | * @return Error response to be returned to the caller. 32 | */ 33 | private WeaviateErrorResponse getWeaviateGraphQLErrorResponse(GraphQLResponse gql, int code) { 34 | List messages = gql.errorMessages(); 35 | if (messages == null || messages.isEmpty()) { 36 | return null; 37 | } 38 | return WeaviateErrorResponse.builder().code(code).error(gql.errorMessages()).build(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/base/WeaviateError.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.base; 2 | 3 | import java.util.List; 4 | import lombok.AccessLevel; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @AllArgsConstructor 12 | @ToString 13 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 14 | public class WeaviateError { 15 | int statusCode; 16 | List messages; 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/base/WeaviateErrorMessage.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.base; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @Builder 12 | @ToString 13 | @AllArgsConstructor(access = AccessLevel.PUBLIC) 14 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 15 | public class WeaviateErrorMessage { 16 | String message; 17 | transient Throwable throwable; // transient = not serialized by gson. This field is only used on Java. 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/base/WeaviateErrorResponse.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.base; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import lombok.AccessLevel; 7 | import lombok.Builder; 8 | import lombok.Getter; 9 | import lombok.ToString; 10 | import lombok.experimental.FieldDefaults; 11 | 12 | @Getter 13 | @Builder 14 | @ToString 15 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 16 | public class WeaviateErrorResponse { 17 | Integer code; 18 | String message; 19 | 20 | @Builder.Default 21 | List error = new ArrayList<>(); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/base/http/HttpClient.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.base.http; 2 | 3 | public interface HttpClient { 4 | HttpResponse sendGetRequest(String url) throws Exception; 5 | HttpResponse sendPostRequest(String url, String json) throws Exception; 6 | HttpResponse sendPutRequest(String url, String json) throws Exception; 7 | HttpResponse sendPatchRequest(String url, String json) throws Exception; 8 | HttpResponse sendDeleteRequest(String url, String json) throws Exception; 9 | HttpResponse sendHeadRequest(String url) throws Exception; 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/base/http/HttpResponse.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.base.http; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Getter; 6 | import lombok.experimental.FieldDefaults; 7 | 8 | @Getter 9 | @AllArgsConstructor 10 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 11 | public class HttpResponse { 12 | int statusCode; 13 | String body; 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/base/http/async/AsyncHttpClient.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.base.http.async; 2 | 3 | import io.weaviate.client.Config; 4 | import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient; 5 | import org.apache.hc.client5.http.impl.async.HttpAsyncClients; 6 | import org.apache.hc.core5.reactor.IOReactorConfig; 7 | import org.apache.hc.core5.util.Timeout; 8 | 9 | public class AsyncHttpClient { 10 | 11 | public static CloseableHttpAsyncClient create(Config config) { 12 | IOReactorConfig ioReactorConfig = IOReactorConfig.custom() 13 | .setSoTimeout(Timeout.ofSeconds(config.getSocketTimeout())) 14 | .build(); 15 | 16 | return HttpAsyncClients.custom() 17 | .setIOReactorConfig(ioReactorConfig) 18 | .build(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/base/http/async/ResponseParser.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.base.http.async; 2 | 3 | import io.weaviate.client.base.Result; 4 | import io.weaviate.client.base.Serializer; 5 | import org.apache.hc.core5.http.ContentType; 6 | import org.apache.hc.core5.http.HttpResponse; 7 | 8 | public abstract class ResponseParser { 9 | protected final Serializer serializer; 10 | 11 | public ResponseParser() { 12 | this.serializer = new Serializer(); 13 | } 14 | 15 | public abstract Result parse(HttpResponse response, String body, ContentType contentType); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/base/http/builder/HttpApacheClientBuilder.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.base.http.builder; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.base.http.impl.CommonsHttpClientImpl; 5 | import java.util.concurrent.TimeUnit; 6 | import org.apache.hc.client5.http.config.RequestConfig; 7 | import org.apache.hc.client5.http.impl.classic.HttpClientBuilder; 8 | import org.apache.hc.core5.http.HttpHost; 9 | import org.apache.hc.core5.util.Timeout; 10 | 11 | public class HttpApacheClientBuilder { 12 | 13 | private HttpApacheClientBuilder() {} 14 | 15 | public static CommonsHttpClientImpl.CloseableHttpClientBuilder build(Config config) { 16 | RequestConfig.Builder requestConfigBuilder = RequestConfig.custom() 17 | .setConnectTimeout(Timeout.of(config.getConnectionTimeout(), TimeUnit.SECONDS)) 18 | .setConnectionRequestTimeout(Timeout.of(config.getConnectionRequestTimeout(), TimeUnit.SECONDS)) 19 | .setResponseTimeout(Timeout.of(config.getSocketTimeout(), TimeUnit.SECONDS)); 20 | 21 | if (config.getProxyHost() != null) { 22 | requestConfigBuilder.setProxy(new HttpHost(config.getProxyScheme(), config.getProxyHost(), config.getProxyPort())); 23 | } 24 | 25 | RequestConfig requestConfig = requestConfigBuilder.build(); 26 | return HttpClientBuilder.create().setDefaultRequestConfig(requestConfig)::build; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/base/util/Assert.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.base.util; 2 | 3 | import java.util.Objects; 4 | 5 | public class Assert { 6 | 7 | private Assert(){} 8 | 9 | public static void requireGreater(int value, int minValue, String paramName) { 10 | if (value <= minValue) { 11 | throw new IllegalArgumentException(String.format("%s should be greater than %d", paramName, minValue)); 12 | } 13 | } 14 | 15 | public static void requireGreaterEqual(int value, int minValue, String paramName) { 16 | if (value < minValue) { 17 | throw new IllegalArgumentException(String.format("%s should be greater than or equal %d", paramName, minValue)); 18 | } 19 | } 20 | 21 | public static void requiredNotNull(Object value, String paramName) { 22 | if (Objects.isNull(value)) { 23 | throw new IllegalArgumentException(String.format("%s should not be null", paramName)); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/base/util/CrossReference.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.base.util; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Getter; 5 | import lombok.ToString; 6 | import lombok.experimental.FieldDefaults; 7 | import org.apache.commons.lang3.StringUtils; 8 | 9 | @ToString 10 | @Getter 11 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 12 | public class CrossReference { 13 | String peerName; 14 | String className; 15 | String targetID; 16 | boolean local; 17 | 18 | public CrossReference(String peerName, String className, String targetID) { 19 | this.local = peerName != null && peerName.equals("localhost"); 20 | this.peerName = peerName; 21 | this.className = className; 22 | this.targetID = targetID; 23 | } 24 | 25 | public static CrossReference fromBeacon(String beacon) { 26 | if (StringUtils.isNotBlank(beacon) && beacon.startsWith("weaviate://")) { 27 | String path = beacon.replaceFirst("weaviate://", ""); 28 | String[] parts = path.split("/"); 29 | if (parts.length == 3) { 30 | return new CrossReference(parts[0], parts[1], parts[2]); 31 | } 32 | if (parts.length == 2) { 33 | return new CrossReference(parts[0], "", parts[1]); 34 | } 35 | } 36 | return null; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/base/util/DbVersionProvider.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.base.util; 2 | 3 | import java.util.Optional; 4 | 5 | public class DbVersionProvider { 6 | 7 | private static final String EMPTY_VERSION = ""; 8 | 9 | private final VersionGetter getter; 10 | private String version; 11 | 12 | 13 | public DbVersionProvider(VersionGetter getter) { 14 | this.getter = getter; 15 | this.version = EMPTY_VERSION; 16 | } 17 | 18 | 19 | public String getVersion() { 20 | refresh(); 21 | return version; 22 | } 23 | 24 | public void refresh() { 25 | refresh(false); 26 | } 27 | 28 | public void refresh(boolean force) { 29 | if (force || EMPTY_VERSION.equals(version)) { 30 | this.version = getter.get().orElse(EMPTY_VERSION); 31 | } 32 | } 33 | 34 | 35 | public interface VersionGetter { 36 | Optional get(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/base/util/GroupHitDeserializer.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.base.util; 2 | 3 | import com.google.gson.JsonDeserializationContext; 4 | import com.google.gson.JsonDeserializer; 5 | import com.google.gson.JsonElement; 6 | import com.google.gson.JsonObject; 7 | import com.google.gson.JsonParseException; 8 | import com.google.gson.reflect.TypeToken; 9 | import io.weaviate.client.v1.graphql.model.GraphQLGetBaseObject; 10 | import java.lang.reflect.Type; 11 | import java.util.Map; 12 | 13 | public class GroupHitDeserializer implements JsonDeserializer { 14 | 15 | @Override 16 | public GraphQLGetBaseObject.Additional.Group.GroupHit deserialize(JsonElement json, Type typeOfT, 17 | JsonDeserializationContext context) throws JsonParseException { 18 | JsonObject jsonObject = json.getAsJsonObject(); 19 | 20 | GraphQLGetBaseObject.Additional.Group.GroupHit.AdditionalGroupHit additional = 21 | context.deserialize(jsonObject.get("_additional"), GraphQLGetBaseObject.Additional.Group.GroupHit.AdditionalGroupHit.class); 22 | 23 | // Remove _additional from the JSON object 24 | jsonObject.remove("_additional"); 25 | 26 | // Deserialize the rest into a Map 27 | Type mapType = new TypeToken>() {}.getType(); 28 | Map properties = context.deserialize(jsonObject, mapType); 29 | 30 | return new GraphQLGetBaseObject.Additional.Group.GroupHit(properties, additional); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/base/util/GrpcVersionSupport.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.base.util; 2 | 3 | import lombok.RequiredArgsConstructor; 4 | import org.apache.commons.lang3.StringUtils; 5 | 6 | @RequiredArgsConstructor 7 | public class GrpcVersionSupport { 8 | 9 | private final DbVersionProvider provider; 10 | 11 | public boolean supportsVectorBytesField() { 12 | String[] versionNumbers = StringUtils.split(provider.getVersion(), "."); 13 | if (versionNumbers != null && versionNumbers.length >= 2) { 14 | int major = Integer.parseInt(versionNumbers[0]); 15 | int minor = Integer.parseInt(versionNumbers[1]); 16 | if (major == 1 && minor == 22 && versionNumbers.length == 3) { 17 | String patch = versionNumbers[2]; 18 | if (!patch.contains("rc") && Integer.parseInt(patch) >= 6) { 19 | return true; 20 | } 21 | } 22 | return (major == 1 && minor >= 23) || major >= 2; 23 | } 24 | return false; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/base/util/TriConsumer.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.base.util; 2 | 3 | @FunctionalInterface 4 | public interface TriConsumer { 5 | 6 | /** 7 | * Performs this operation on the given arguments. 8 | * 9 | * @param t the first input argument 10 | * @param u the second input argument 11 | * @param v the third input argument 12 | */ 13 | void accept(T t, U u, V v); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/base/util/UrlEncoder.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.base.util; 2 | 3 | import org.apache.commons.lang3.StringUtils; 4 | 5 | import java.io.UnsupportedEncodingException; 6 | import java.net.URLEncoder; 7 | import java.nio.charset.StandardCharsets; 8 | 9 | public class UrlEncoder { 10 | 11 | private UrlEncoder() {} 12 | 13 | public static String encodeQueryParam(String key, String value) { 14 | return String.format("%s=%s", encode(StringUtils.trim(key)), encode(StringUtils.trim(value))); 15 | } 16 | 17 | public static String encodePathParam(String value) { 18 | return encode(StringUtils.trim(value)); 19 | } 20 | 21 | public static String encode(String value) { 22 | try { 23 | return URLEncoder.encode(value, StandardCharsets.UTF_8.toString()); 24 | } catch (UnsupportedEncodingException e) { 25 | return value; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/async/backup/api/BackupGetter.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.async.backup.api; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.base.AsyncBaseClient; 5 | import io.weaviate.client.base.AsyncClientResult; 6 | import io.weaviate.client.base.Result; 7 | import io.weaviate.client.base.util.UrlEncoder; 8 | import io.weaviate.client.v1.auth.provider.AccessTokenProvider; 9 | import io.weaviate.client.v1.backup.model.BackupCreateResponse; 10 | import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient; 11 | import org.apache.hc.core5.concurrent.FutureCallback; 12 | 13 | import java.util.concurrent.Future; 14 | 15 | public class BackupGetter extends AsyncBaseClient 16 | implements AsyncClientResult { 17 | 18 | private String backend; 19 | 20 | 21 | public BackupGetter(CloseableHttpAsyncClient client, Config config, AccessTokenProvider tokenProvider) { 22 | super(client, config, tokenProvider); 23 | } 24 | 25 | 26 | public BackupGetter withBackend(String backend) { 27 | this.backend = backend; 28 | return this; 29 | } 30 | 31 | 32 | @Override 33 | public Future> run(FutureCallback> callback) { 34 | String path = String.format("/backups/%s", UrlEncoder.encodePathParam(backend)); 35 | return sendGetRequest(path, BackupCreateResponse[].class, callback); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/async/classifications/Classifications.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.async.classifications; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.v1.async.classifications.api.Getter; 5 | import io.weaviate.client.v1.async.classifications.api.Scheduler; 6 | import io.weaviate.client.v1.auth.provider.AccessTokenProvider; 7 | import lombok.RequiredArgsConstructor; 8 | import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient; 9 | 10 | import java.util.concurrent.Executor; 11 | 12 | @RequiredArgsConstructor 13 | public class Classifications { 14 | 15 | private final CloseableHttpAsyncClient client; 16 | private final Config config; 17 | private final AccessTokenProvider tokenProvider; 18 | 19 | 20 | public Scheduler scheduler() { 21 | return scheduler(null); 22 | } 23 | 24 | public Scheduler scheduler(Executor executor) { 25 | return new Scheduler(client, config, tokenProvider, getter(), executor); 26 | } 27 | 28 | public Getter getter() { 29 | return new Getter(client, config, tokenProvider); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/async/cluster/Cluster.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.async.cluster; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.v1.async.cluster.api.NodesStatusGetter; 5 | import io.weaviate.client.v1.auth.provider.AccessTokenProvider; 6 | import lombok.RequiredArgsConstructor; 7 | import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient; 8 | 9 | @RequiredArgsConstructor 10 | public class Cluster { 11 | 12 | private final CloseableHttpAsyncClient client; 13 | private final Config config; 14 | private final AccessTokenProvider tokenProvider; 15 | 16 | 17 | public NodesStatusGetter nodesStatusGetter() { 18 | return new NodesStatusGetter(client, config, tokenProvider); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/async/graphql/GraphQL.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.async.graphql; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.v1.async.graphql.api.Aggregate; 5 | import io.weaviate.client.v1.async.graphql.api.Explore; 6 | import io.weaviate.client.v1.async.graphql.api.Get; 7 | import io.weaviate.client.v1.async.graphql.api.Raw; 8 | import io.weaviate.client.v1.auth.provider.AccessTokenProvider; 9 | import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient; 10 | 11 | public class GraphQL { 12 | private final Config config; 13 | private final CloseableHttpAsyncClient client; 14 | private final AccessTokenProvider tokenProvider; 15 | 16 | public GraphQL(CloseableHttpAsyncClient client, Config config, AccessTokenProvider tokenProvider) { 17 | this.client = client; 18 | this.config = config; 19 | this.tokenProvider = tokenProvider; 20 | } 21 | 22 | public Get get() { 23 | return new Get(client, config, tokenProvider); 24 | } 25 | 26 | public Raw raw() { 27 | return new Raw(client, config, tokenProvider); 28 | } 29 | 30 | public Explore explore() { 31 | return new Explore(client, config, tokenProvider); 32 | } 33 | 34 | public Aggregate aggregate() { 35 | return new Aggregate(client, config, tokenProvider); 36 | } 37 | 38 | public io.weaviate.client.v1.graphql.GraphQL.Arguments arguments() { 39 | return new io.weaviate.client.v1.graphql.GraphQL.Arguments(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/async/graphql/api/Raw.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.async.graphql.api; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.base.AsyncBaseClient; 5 | import io.weaviate.client.base.AsyncClientResult; 6 | import io.weaviate.client.base.Result; 7 | import io.weaviate.client.v1.auth.provider.AccessTokenProvider; 8 | import io.weaviate.client.v1.graphql.model.GraphQLQuery; 9 | import io.weaviate.client.v1.graphql.model.GraphQLResponse; 10 | import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient; 11 | import org.apache.hc.core5.concurrent.FutureCallback; 12 | 13 | import java.util.concurrent.Future; 14 | 15 | public class Raw extends AsyncBaseClient implements AsyncClientResult { 16 | private String query; 17 | 18 | public Raw(CloseableHttpAsyncClient client, Config config, AccessTokenProvider tokenProvider) { 19 | super(client, config, tokenProvider); 20 | } 21 | 22 | public Raw withQuery(String query) { 23 | this.query = query; 24 | return this; 25 | } 26 | 27 | @Override 28 | public Future> run(FutureCallback> callback) { 29 | GraphQLQuery query = GraphQLQuery.builder() 30 | .query(this.query) 31 | .build(); 32 | return sendPostRequest("/graphql", query, GraphQLResponse.class, callback); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/async/misc/Misc.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.async.misc; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.v1.async.misc.api.LiveChecker; 5 | import io.weaviate.client.v1.async.misc.api.MetaGetter; 6 | import io.weaviate.client.v1.async.misc.api.OpenIDConfigGetter; 7 | import io.weaviate.client.v1.async.misc.api.ReadyChecker; 8 | import io.weaviate.client.v1.auth.provider.AccessTokenProvider; 9 | import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient; 10 | 11 | public class Misc { 12 | private final CloseableHttpAsyncClient client; 13 | private final Config config; 14 | private final AccessTokenProvider tokenProvider; 15 | 16 | public Misc(CloseableHttpAsyncClient client, Config config, AccessTokenProvider tokenProvider) { 17 | this.client = client; 18 | this.config = config; 19 | this.tokenProvider = tokenProvider; 20 | } 21 | 22 | public MetaGetter metaGetter() { 23 | return new MetaGetter(client, config, tokenProvider); 24 | } 25 | 26 | public OpenIDConfigGetter openIDConfigGetter() { 27 | return new OpenIDConfigGetter(client, config, tokenProvider); 28 | } 29 | 30 | public LiveChecker liveChecker() { 31 | return new LiveChecker(client, config, tokenProvider); 32 | } 33 | 34 | public ReadyChecker readyChecker() { 35 | return new ReadyChecker(client, config, tokenProvider); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/async/misc/api/LiveChecker.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.async.misc.api; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.base.AsyncBaseClient; 5 | import io.weaviate.client.base.AsyncClientResult; 6 | import io.weaviate.client.base.Response; 7 | import io.weaviate.client.base.Result; 8 | import io.weaviate.client.base.http.async.ResponseParser; 9 | import io.weaviate.client.v1.auth.provider.AccessTokenProvider; 10 | import java.util.concurrent.Future; 11 | import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient; 12 | import org.apache.hc.core5.concurrent.FutureCallback; 13 | import org.apache.hc.core5.http.ContentType; 14 | import org.apache.hc.core5.http.HttpResponse; 15 | 16 | public class LiveChecker extends AsyncBaseClient implements AsyncClientResult { 17 | 18 | public LiveChecker(CloseableHttpAsyncClient client, Config config, AccessTokenProvider tokenProvider) { 19 | super(client, config, tokenProvider); 20 | } 21 | 22 | @Override 23 | public Future> run(FutureCallback> callback) { 24 | return sendGetRequest("/.well-known/live", callback, new ResponseParser() { 25 | @Override 26 | public Result parse(HttpResponse response, String body, ContentType contentType) { 27 | Response resp = this.serializer.toResponse(response.getCode(), body, String.class); 28 | return new Result<>(resp.getStatusCode(), resp.getStatusCode() == 200, resp.getErrors()); 29 | } 30 | }); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/async/misc/api/MetaGetter.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.async.misc.api; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.base.AsyncBaseClient; 5 | import io.weaviate.client.base.AsyncClientResult; 6 | import io.weaviate.client.base.Result; 7 | import io.weaviate.client.v1.auth.provider.AccessTokenProvider; 8 | import io.weaviate.client.v1.misc.model.Meta; 9 | import java.util.concurrent.Future; 10 | import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient; 11 | import org.apache.hc.core5.concurrent.FutureCallback; 12 | 13 | public class MetaGetter extends AsyncBaseClient implements AsyncClientResult { 14 | 15 | public MetaGetter(CloseableHttpAsyncClient client, Config config, AccessTokenProvider tokenProvider) { 16 | super(client, config, tokenProvider); 17 | } 18 | 19 | @Override 20 | public Future> run(FutureCallback> callback) { 21 | return sendGetRequest("/meta", Meta.class, callback); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/async/misc/api/OpenIDConfigGetter.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.async.misc.api; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.base.AsyncBaseClient; 5 | import io.weaviate.client.base.AsyncClientResult; 6 | import io.weaviate.client.base.Result; 7 | import io.weaviate.client.v1.auth.provider.AccessTokenProvider; 8 | import io.weaviate.client.v1.misc.model.OpenIDConfiguration; 9 | import java.util.concurrent.Future; 10 | import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient; 11 | import org.apache.hc.core5.concurrent.FutureCallback; 12 | 13 | public class OpenIDConfigGetter extends AsyncBaseClient implements AsyncClientResult { 14 | 15 | public OpenIDConfigGetter(CloseableHttpAsyncClient client, Config config, AccessTokenProvider tokenProvider) { 16 | super(client, config, tokenProvider); 17 | } 18 | 19 | @Override 20 | public Future> run(FutureCallback> callback) { 21 | return sendGetRequest("/meta", OpenIDConfiguration.class, callback); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/async/misc/api/ReadyChecker.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.async.misc.api; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.base.AsyncBaseClient; 5 | import io.weaviate.client.base.AsyncClientResult; 6 | import io.weaviate.client.base.Response; 7 | import io.weaviate.client.base.Result; 8 | import io.weaviate.client.base.http.async.ResponseParser; 9 | import io.weaviate.client.v1.auth.provider.AccessTokenProvider; 10 | import java.util.concurrent.Future; 11 | import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient; 12 | import org.apache.hc.core5.concurrent.FutureCallback; 13 | import org.apache.hc.core5.http.ContentType; 14 | import org.apache.hc.core5.http.HttpResponse; 15 | 16 | public class ReadyChecker extends AsyncBaseClient implements AsyncClientResult { 17 | 18 | public ReadyChecker(CloseableHttpAsyncClient client, Config config, AccessTokenProvider tokenProvider) { 19 | super(client, config, tokenProvider); 20 | } 21 | 22 | @Override 23 | public Future> run(FutureCallback> callback) { 24 | return sendGetRequest("/.well-known/ready", callback, new ResponseParser() { 25 | @Override 26 | public Result parse(HttpResponse response, String body, ContentType contentType) { 27 | Response resp = this.serializer.toResponse(response.getCode(), body, String.class); 28 | return new Result<>(resp.getStatusCode(), resp.getStatusCode() == 200, resp.getErrors()); 29 | } 30 | }); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/async/rbac/api/PermissionChecker.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.async.rbac.api; 2 | 3 | import java.util.concurrent.Future; 4 | 5 | import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient; 6 | import org.apache.hc.core5.concurrent.FutureCallback; 7 | 8 | import io.weaviate.client.Config; 9 | import io.weaviate.client.base.AsyncBaseClient; 10 | import io.weaviate.client.base.AsyncClientResult; 11 | import io.weaviate.client.base.Result; 12 | import io.weaviate.client.v1.auth.provider.AccessTokenProvider; 13 | import io.weaviate.client.v1.rbac.model.Permission; 14 | 15 | public class PermissionChecker extends AsyncBaseClient implements AsyncClientResult { 16 | private String role; 17 | private Permission permission; 18 | 19 | public PermissionChecker(CloseableHttpAsyncClient httpClient, Config config, AccessTokenProvider tokenProvider) { 20 | super(httpClient, config, tokenProvider); 21 | } 22 | 23 | public PermissionChecker withRole(String role) { 24 | this.role = role; 25 | return this; 26 | } 27 | 28 | public PermissionChecker withPermission(Permission permission) { 29 | this.permission = permission; 30 | return this; 31 | } 32 | 33 | @Override 34 | public Future> run(FutureCallback> callback) { 35 | return sendPostRequest(path(), permission.firstToWeaviate(), Boolean.class, callback); 36 | } 37 | 38 | private String path() { 39 | return String.format("/authz/roles/%s/has-permission", this.role); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/async/rbac/api/RoleDeleter.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.async.rbac.api; 2 | 3 | import java.util.concurrent.Future; 4 | 5 | import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient; 6 | import org.apache.hc.core5.concurrent.FutureCallback; 7 | 8 | import io.weaviate.client.Config; 9 | import io.weaviate.client.base.AsyncBaseClient; 10 | import io.weaviate.client.base.AsyncClientResult; 11 | import io.weaviate.client.base.Result; 12 | import io.weaviate.client.v1.auth.provider.AccessTokenProvider; 13 | 14 | public class RoleDeleter extends AsyncBaseClient implements AsyncClientResult { 15 | private String name; 16 | 17 | public RoleDeleter(CloseableHttpAsyncClient httpClient, Config config, AccessTokenProvider tokenProvider) { 18 | super(httpClient, config, tokenProvider); 19 | } 20 | 21 | public RoleDeleter withName(String name) { 22 | this.name = name; 23 | return this; 24 | } 25 | 26 | @Override 27 | public Future> run(FutureCallback> callback) { 28 | return sendDeleteRequest("/authz/roles/" + this.name, null, callback, Result.voidToBooleanParser()); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/async/rbac/api/UserAssignmentsGetter.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.async.rbac.api; 2 | 3 | import java.util.List; 4 | import java.util.concurrent.Future; 5 | 6 | import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient; 7 | import org.apache.hc.core5.concurrent.FutureCallback; 8 | 9 | import io.weaviate.client.Config; 10 | import io.weaviate.client.base.AsyncBaseClient; 11 | import io.weaviate.client.base.AsyncClientResult; 12 | import io.weaviate.client.base.Result; 13 | import io.weaviate.client.v1.auth.provider.AccessTokenProvider; 14 | import io.weaviate.client.v1.rbac.model.UserAssignment; 15 | 16 | public class UserAssignmentsGetter extends AsyncBaseClient> 17 | implements AsyncClientResult> { 18 | private String role; 19 | 20 | public UserAssignmentsGetter(CloseableHttpAsyncClient httpClient, Config config, AccessTokenProvider tokenProvider) { 21 | super(httpClient, config, tokenProvider); 22 | } 23 | 24 | public UserAssignmentsGetter withRole(String role) { 25 | this.role = role; 26 | return this; 27 | } 28 | 29 | @Override 30 | public Future>> run(FutureCallback>> callback) { 31 | return sendGetRequest(path(), callback, Result.arrayToListParser(UserAssignment[].class)); 32 | } 33 | 34 | private String path() { 35 | return String.format("/authz/roles/%s/user-assignments", this.role); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/async/schema/api/SchemaGetter.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.async.schema.api; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.base.AsyncBaseClient; 5 | import io.weaviate.client.base.AsyncClientResult; 6 | import io.weaviate.client.base.Result; 7 | import io.weaviate.client.v1.auth.provider.AccessTokenProvider; 8 | import io.weaviate.client.v1.schema.model.Schema; 9 | import java.util.concurrent.Future; 10 | import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient; 11 | import org.apache.hc.core5.concurrent.FutureCallback; 12 | 13 | public class SchemaGetter extends AsyncBaseClient implements AsyncClientResult { 14 | 15 | public SchemaGetter(CloseableHttpAsyncClient client, Config config, AccessTokenProvider tokenProvider) { 16 | super(client, config, tokenProvider); 17 | } 18 | 19 | @Override 20 | public Future> run(FutureCallback> callback) { 21 | return sendGetRequest("/schema", Schema.class, callback); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/async/users/OidcUsers.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.async.users; 2 | 3 | import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient; 4 | 5 | import io.weaviate.client.Config; 6 | import io.weaviate.client.v1.async.users.api.RoleAssigner; 7 | import io.weaviate.client.v1.async.users.api.RoleRevoker; 8 | import io.weaviate.client.v1.async.users.api.common.AssignedRolesGetter; 9 | import io.weaviate.client.v1.auth.provider.AccessTokenProvider; 10 | import lombok.RequiredArgsConstructor; 11 | 12 | @RequiredArgsConstructor 13 | public class OidcUsers { 14 | private static final String USER_TYPE = "oidc"; 15 | 16 | private final CloseableHttpAsyncClient client; 17 | private final Config config; 18 | private final AccessTokenProvider tokenProvider; 19 | 20 | /** Assign a role to a user. Note that 'root' cannot be assigned. */ 21 | public RoleAssigner assigner() { 22 | return new RoleAssigner(client, config, tokenProvider, USER_TYPE); 23 | } 24 | 25 | /** Revoke a role from a user. Note that 'root' cannot be revoked. */ 26 | public RoleRevoker revoker() { 27 | return new RoleRevoker(client, config, tokenProvider, USER_TYPE); 28 | } 29 | 30 | /** Get roles assigned to a user. */ 31 | public AssignedRolesGetter userRolesGetter() { 32 | return new AssignedRolesGetter(client, config, tokenProvider, USER_TYPE); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/async/users/api/db/Activator.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.async.users.api.db; 2 | 3 | import java.util.concurrent.Future; 4 | 5 | import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient; 6 | import org.apache.hc.core5.concurrent.FutureCallback; 7 | import org.apache.hc.core5.http.HttpStatus; 8 | 9 | import io.weaviate.client.Config; 10 | import io.weaviate.client.base.AsyncBaseClient; 11 | import io.weaviate.client.base.AsyncClientResult; 12 | import io.weaviate.client.base.Result; 13 | import io.weaviate.client.v1.auth.provider.AccessTokenProvider; 14 | 15 | public class Activator extends AsyncBaseClient implements AsyncClientResult { 16 | private String userId; 17 | 18 | public Activator(CloseableHttpAsyncClient httpClient, Config config, AccessTokenProvider tokenProvider) { 19 | super(httpClient, config, tokenProvider); 20 | } 21 | 22 | public Activator withUserId(String userId) { 23 | this.userId = userId; 24 | return this; 25 | } 26 | 27 | @Override 28 | public Future> run(FutureCallback> callback) { 29 | return sendPostRequest("/users/db/" + userId + "/activate", null, callback, 30 | Result.voidToBooleanParser(HttpStatus.SC_CONFLICT)); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/async/users/api/db/AllGetter.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.async.users.api.db; 2 | 3 | import java.util.List; 4 | import java.util.concurrent.Future; 5 | 6 | import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient; 7 | import org.apache.hc.core5.concurrent.FutureCallback; 8 | 9 | import io.weaviate.client.Config; 10 | import io.weaviate.client.base.AsyncBaseClient; 11 | import io.weaviate.client.base.AsyncClientResult; 12 | import io.weaviate.client.base.Result; 13 | import io.weaviate.client.v1.auth.provider.AccessTokenProvider; 14 | import io.weaviate.client.v1.users.model.UserDb; 15 | 16 | public class AllGetter extends AsyncBaseClient> implements AsyncClientResult> { 17 | 18 | public AllGetter(CloseableHttpAsyncClient httpClient, Config config, AccessTokenProvider tokenProvider) { 19 | super(httpClient, config, tokenProvider); 20 | } 21 | 22 | @Override 23 | public Future>> run(FutureCallback>> callback) { 24 | return sendGetRequest("/users/db", callback, Result.arrayToListParser(UserDb[].class)); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/async/users/api/db/ByNameGetter.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.async.users.api.db; 2 | 3 | import java.util.concurrent.Future; 4 | 5 | import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient; 6 | import org.apache.hc.core5.concurrent.FutureCallback; 7 | 8 | import io.weaviate.client.Config; 9 | import io.weaviate.client.base.AsyncBaseClient; 10 | import io.weaviate.client.base.AsyncClientResult; 11 | import io.weaviate.client.base.Result; 12 | import io.weaviate.client.v1.auth.provider.AccessTokenProvider; 13 | import io.weaviate.client.v1.users.model.UserDb; 14 | 15 | public class ByNameGetter extends AsyncBaseClient implements AsyncClientResult { 16 | private String userId; 17 | 18 | public ByNameGetter(CloseableHttpAsyncClient httpClient, Config config, AccessTokenProvider tokenProvider) { 19 | super(httpClient, config, tokenProvider); 20 | } 21 | 22 | public ByNameGetter withUserId(String userId) { 23 | this.userId = userId; 24 | return this; 25 | } 26 | 27 | @Override 28 | public Future> run(FutureCallback> callback) { 29 | return sendGetRequest("/users/db/" + userId, UserDb.class, callback); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/async/users/api/db/Deleter.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.async.users.api.db; 2 | 3 | import java.util.concurrent.Future; 4 | 5 | import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient; 6 | import org.apache.hc.core5.concurrent.FutureCallback; 7 | 8 | import io.weaviate.client.Config; 9 | import io.weaviate.client.base.AsyncBaseClient; 10 | import io.weaviate.client.base.AsyncClientResult; 11 | import io.weaviate.client.base.Result; 12 | import io.weaviate.client.v1.auth.provider.AccessTokenProvider; 13 | 14 | public class Deleter extends AsyncBaseClient implements AsyncClientResult { 15 | private String userId; 16 | 17 | public Deleter(CloseableHttpAsyncClient httpClient, Config config, AccessTokenProvider tokenProvider) { 18 | super(httpClient, config, tokenProvider); 19 | } 20 | 21 | public Deleter withUserId(String userId) { 22 | this.userId = userId; 23 | return this; 24 | } 25 | 26 | @Override 27 | public Future> run(FutureCallback> callback) { 28 | return sendDeleteRequest("/users/db/" + userId, null, callback, Result.voidToBooleanParser()); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/auth/ApiKeyFlow.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.auth; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.WeaviateClient; 5 | import io.weaviate.client.v1.auth.exception.AuthException; 6 | import lombok.RequiredArgsConstructor; 7 | 8 | import java.util.List; 9 | 10 | @RequiredArgsConstructor 11 | public class ApiKeyFlow implements Authentication { 12 | 13 | private final String apiKey; 14 | 15 | @Override 16 | public WeaviateClient getAuthClient(Config config, List scopes) throws AuthException { 17 | return getAuthClient(config); 18 | } 19 | 20 | @Override 21 | public WeaviateClient getAuthClient(Config config) throws AuthException { 22 | return new WeaviateClient(config, () -> apiKey); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/auth/Authentication.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.auth; 2 | 3 | import io.weaviate.client.v1.auth.exception.AuthException; 4 | import java.util.List; 5 | import io.weaviate.client.Config; 6 | import io.weaviate.client.WeaviateClient; 7 | 8 | public interface Authentication { 9 | WeaviateClient getAuthClient(Config config, List scopes) throws AuthException; 10 | WeaviateClient getAuthClient(Config config) throws AuthException; 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/auth/ClientCredentialsFlow.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.auth; 2 | 3 | import io.weaviate.client.v1.auth.exception.AuthException; 4 | import io.weaviate.client.v1.auth.nimbus.AuthType; 5 | import io.weaviate.client.v1.auth.nimbus.NimbusAuth; 6 | import io.weaviate.client.v1.auth.provider.AccessTokenProvider; 7 | import java.util.List; 8 | import io.weaviate.client.Config; 9 | import io.weaviate.client.WeaviateClient; 10 | 11 | public class ClientCredentialsFlow implements Authentication { 12 | 13 | private final NimbusAuth nimbusAuth; 14 | private final String clientSecret; 15 | 16 | public ClientCredentialsFlow(String clientSecret) { 17 | this.nimbusAuth = new NimbusAuth(); 18 | this.clientSecret = clientSecret; 19 | } 20 | 21 | @Override 22 | public WeaviateClient getAuthClient(Config config, List scopes) throws AuthException { 23 | AccessTokenProvider tokenProvider = nimbusAuth.getAccessTokenProvider(config, clientSecret, "", "", scopes, AuthType.CLIENT_CREDENTIALS); 24 | return new WeaviateClient(config, tokenProvider); 25 | } 26 | 27 | @Override 28 | public WeaviateClient getAuthClient(Config config) throws AuthException { 29 | return getAuthClient(config, null); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/auth/exception/AuthException.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.auth.exception; 2 | 3 | public class AuthException extends Exception { 4 | public AuthException(String message) { 5 | super(message); 6 | } 7 | 8 | public AuthException(Throwable cause) { 9 | super(cause); 10 | } 11 | 12 | public AuthException(String message, Throwable cause) { 13 | super(message, cause); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/auth/nimbus/AuthType.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.auth.nimbus; 2 | 3 | public enum AuthType { 4 | USER_PASSWORD, 5 | CLIENT_CREDENTIALS, 6 | REFRESH_TOKEN 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/auth/provider/AccessTokenProvider.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.auth.provider; 2 | 3 | public interface AccessTokenProvider { 4 | String getAccessToken(); 5 | default void shutdown(){} 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/backup/Backup.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.backup; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.base.http.HttpClient; 5 | import io.weaviate.client.v1.backup.api.*; 6 | import lombok.RequiredArgsConstructor; 7 | 8 | @RequiredArgsConstructor 9 | public class Backup { 10 | 11 | private final HttpClient httpClient; 12 | private final Config config; 13 | 14 | public BackupCreator creator() { 15 | return new BackupCreator(httpClient, config, createStatusGetter()); 16 | } 17 | 18 | public BackupCreateStatusGetter createStatusGetter() { 19 | return new BackupCreateStatusGetter(httpClient, config); 20 | } 21 | 22 | public BackupRestorer restorer() { 23 | return new BackupRestorer(httpClient, config, restoreStatusGetter()); 24 | } 25 | 26 | public BackupRestoreStatusGetter restoreStatusGetter() { 27 | return new BackupRestoreStatusGetter(httpClient, config); 28 | } 29 | 30 | public BackupCanceler canceler() { 31 | return new BackupCanceler(httpClient, config); 32 | } 33 | 34 | public BackupGetter getter() { 35 | return new BackupGetter(httpClient, config); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/backup/api/BackupGetter.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.backup.api; 2 | 3 | import io.weaviate.client.v1.backup.model.BackupCreateResponse; 4 | import io.weaviate.client.Config; 5 | import io.weaviate.client.base.BaseClient; 6 | import io.weaviate.client.base.ClientResult; 7 | import io.weaviate.client.base.Response; 8 | import io.weaviate.client.base.Result; 9 | import io.weaviate.client.base.http.HttpClient; 10 | 11 | public class BackupGetter extends BaseClient implements ClientResult { 12 | 13 | private String backend; 14 | 15 | public BackupGetter(HttpClient httpClient, Config config) { 16 | super(httpClient, config); 17 | } 18 | 19 | public BackupGetter withBackend(String backend) { 20 | this.backend = backend; 21 | return this; 22 | } 23 | 24 | @Override 25 | public Result run() { 26 | Response response = this.sendGetRequest(path(), BackupCreateResponse[].class); 27 | return new Result<>(response); 28 | } 29 | 30 | private String path() { 31 | return String.format("/backups/%s", backend); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/backup/model/Backend.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.backup.model; 2 | 3 | public interface Backend { 4 | 5 | String FILESYSTEM = "filesystem"; 6 | String S3 = "s3"; 7 | String GCS = "gcs"; 8 | String AZURE = "azure"; 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/backup/model/BackupCreateResponse.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.backup.model; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import lombok.AccessLevel; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.Setter; 8 | import lombok.ToString; 9 | import lombok.experimental.FieldDefaults; 10 | 11 | @Getter 12 | @Setter 13 | @ToString 14 | @EqualsAndHashCode 15 | @FieldDefaults(level = AccessLevel.PRIVATE) 16 | public class BackupCreateResponse { 17 | 18 | String id; 19 | String path; 20 | String backend; 21 | @SerializedName("classes") 22 | String[] classNames; 23 | String status; 24 | String error; 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/backup/model/BackupCreateStatusResponse.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.backup.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @Setter 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(level = AccessLevel.PRIVATE) 15 | public class BackupCreateStatusResponse { 16 | 17 | String id; 18 | String path; 19 | String backend; 20 | String status; 21 | String error; 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/backup/model/BackupRestoreResponse.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.backup.model; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import lombok.AccessLevel; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.Setter; 8 | import lombok.ToString; 9 | import lombok.experimental.FieldDefaults; 10 | 11 | @Getter 12 | @Setter 13 | @ToString 14 | @EqualsAndHashCode 15 | @FieldDefaults(level = AccessLevel.PRIVATE) 16 | public class BackupRestoreResponse { 17 | 18 | String id; 19 | String path; 20 | String backend; 21 | @SerializedName("classes") 22 | String[] classNames; 23 | String status; 24 | String error; 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/backup/model/BackupRestoreStatusResponse.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.backup.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @Setter 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(level = AccessLevel.PRIVATE) 15 | public class BackupRestoreStatusResponse { 16 | 17 | String id; 18 | String path; 19 | String backend; 20 | String status; 21 | String error; 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/backup/model/CreateStatus.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.backup.model; 2 | 3 | public interface CreateStatus { 4 | 5 | String STARTED = "STARTED"; 6 | String TRANSFERRING = "TRANSFERRING"; 7 | String TRANSFERRED = "TRANSFERRED"; 8 | String SUCCESS = "SUCCESS"; 9 | String FAILED = "FAILED"; 10 | String CANCELED = "CANCELED"; 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/backup/model/RestoreStatus.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.backup.model; 2 | 3 | public interface RestoreStatus { 4 | 5 | String STARTED = "STARTED"; 6 | String TRANSFERRING = "TRANSFERRING"; 7 | String TRANSFERRED = "TRANSFERRED"; 8 | String SUCCESS = "SUCCESS"; 9 | String FAILED = "FAILED"; 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/batch/model/BatchDeleteOutput.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.batch.model; 2 | 3 | public interface BatchDeleteOutput { 4 | 5 | String VERBOSE = "verbose"; 6 | String MINIMAL = "minimal"; 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/batch/model/BatchDeleteResultStatus.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.batch.model; 2 | 3 | public interface BatchDeleteResultStatus { 4 | 5 | String SUCCESS = "SUCCESS"; 6 | String FAILED = "FAILED"; 7 | String DRYRUN = "DRYRUN"; 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/batch/model/BatchReference.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.batch.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @Builder 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(level = AccessLevel.PRIVATE) 15 | public class BatchReference { 16 | String from; 17 | String to; 18 | String tenant; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/batch/model/BatchReferenceResponse.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.batch.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @Builder 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(level = AccessLevel.PRIVATE) 15 | public class BatchReferenceResponse { 16 | String from; 17 | String to; 18 | BatchReferenceResponseAO1Result result; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/batch/model/BatchReferenceResponseAO1Result.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.batch.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | import java.util.List; 11 | 12 | @Getter 13 | @Setter 14 | @ToString 15 | @EqualsAndHashCode 16 | @FieldDefaults(level = AccessLevel.PRIVATE) 17 | public class BatchReferenceResponseAO1Result { 18 | ErrorResponse errors; 19 | String status; 20 | 21 | 22 | @Getter 23 | @ToString 24 | @EqualsAndHashCode 25 | @FieldDefaults(level = AccessLevel.PRIVATE) 26 | public static class ErrorResponse { 27 | List error; 28 | } 29 | 30 | @Getter 31 | @ToString 32 | @EqualsAndHashCode 33 | @FieldDefaults(level = AccessLevel.PRIVATE) 34 | public static class ErrorItem { 35 | String message; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/batch/model/BatchReferenceResponseStatus.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.batch.model; 2 | 3 | public interface BatchReferenceResponseStatus { 4 | 5 | String SUCCESS = "SUCCESS"; 6 | String PENDING = "PENDING"; 7 | String FAILED = "FAILED"; 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/batch/model/ObjectGetResponse.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.batch.model; 2 | 3 | import java.util.Map; 4 | 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | import io.weaviate.client.v1.data.model.Deprecation; 8 | import lombok.AccessLevel; 9 | import lombok.EqualsAndHashCode; 10 | import lombok.Getter; 11 | import lombok.Setter; 12 | import lombok.ToString; 13 | import lombok.experimental.FieldDefaults; 14 | 15 | @Getter 16 | @Setter 17 | @ToString 18 | @EqualsAndHashCode 19 | @FieldDefaults(level = AccessLevel.PRIVATE) 20 | public class ObjectGetResponse { 21 | String id; 22 | @SerializedName("class") 23 | String className; 24 | Long creationTimeUnix; 25 | Long lastUpdateTimeUnix; 26 | Map properties; 27 | Map additional; 28 | Float[] vector; 29 | Map vectors; 30 | Map multiVectors; 31 | Object vectorWeights; 32 | String tenant; 33 | 34 | Deprecation[] deprecations; 35 | ObjectsGetResponseAO2Result result; 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/batch/model/ObjectGetResponseStatus.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.batch.model; 2 | 3 | public interface ObjectGetResponseStatus { 4 | 5 | String SUCCESS = "SUCCESS"; 6 | String PENDING = "PENDING"; 7 | String FAILED = "FAILED"; 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/batch/model/ObjectsBatchRequestBody.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.batch.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | import io.weaviate.client.v1.data.model.WeaviateObject; 10 | 11 | @Getter 12 | @Builder 13 | @ToString 14 | @EqualsAndHashCode 15 | @FieldDefaults(level = AccessLevel.PRIVATE) 16 | public class ObjectsBatchRequestBody { 17 | String[] fields; 18 | WeaviateObject[] objects; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/batch/model/ObjectsGetResponseAO2Result.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.batch.model; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | import java.util.stream.Collectors; 6 | 7 | import lombok.AccessLevel; 8 | import lombok.AllArgsConstructor; 9 | import lombok.EqualsAndHashCode; 10 | import lombok.Getter; 11 | import lombok.Setter; 12 | import lombok.ToString; 13 | import lombok.experimental.FieldDefaults; 14 | 15 | @Getter 16 | @Setter 17 | @ToString 18 | @EqualsAndHashCode 19 | @FieldDefaults(level = AccessLevel.PRIVATE) 20 | public class ObjectsGetResponseAO2Result { 21 | ErrorResponse errors; 22 | String status; 23 | 24 | @Getter 25 | @ToString 26 | @EqualsAndHashCode 27 | @FieldDefaults(level = AccessLevel.PRIVATE) 28 | public static class ErrorResponse { 29 | List error; 30 | 31 | public ErrorResponse(String... errors) { 32 | this.error = Arrays.stream(errors).map(ErrorItem::new).collect(Collectors.toList()); 33 | } 34 | } 35 | 36 | @Getter 37 | @ToString 38 | @EqualsAndHashCode 39 | @FieldDefaults(level = AccessLevel.PRIVATE) 40 | @AllArgsConstructor 41 | public static class ErrorItem { 42 | String message; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/classifications/Classifications.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.classifications; 2 | 3 | import io.weaviate.client.base.http.HttpClient; 4 | import io.weaviate.client.v1.classifications.api.Getter; 5 | import io.weaviate.client.v1.classifications.api.Scheduler; 6 | import io.weaviate.client.Config; 7 | 8 | public class Classifications { 9 | private final Config config; 10 | private final HttpClient httpClient; 11 | 12 | public Classifications(HttpClient httpClient, Config config) { 13 | this.config = config; 14 | this.httpClient = httpClient; 15 | } 16 | 17 | public Scheduler scheduler() { 18 | return new Scheduler(httpClient, config); 19 | } 20 | 21 | public Getter getter() { 22 | return new Getter(httpClient, config); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/classifications/api/Getter.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.classifications.api; 2 | 3 | import io.weaviate.client.v1.classifications.model.Classification; 4 | import org.apache.commons.lang3.StringUtils; 5 | import io.weaviate.client.Config; 6 | import io.weaviate.client.base.BaseClient; 7 | import io.weaviate.client.base.ClientResult; 8 | import io.weaviate.client.base.Response; 9 | import io.weaviate.client.base.Result; 10 | import io.weaviate.client.base.http.HttpClient; 11 | 12 | public class Getter extends BaseClient implements ClientResult { 13 | 14 | private String id; 15 | 16 | public Getter(HttpClient httpClient, Config config) { 17 | super(httpClient, config); 18 | } 19 | 20 | public Getter withID(String id) { 21 | this.id = id; 22 | return this; 23 | } 24 | 25 | @Override 26 | public Result run() { 27 | if (StringUtils.isBlank(id)) { 28 | return null; 29 | } 30 | String path = String.format("/classifications/%s", id); 31 | Response resp = sendGetRequest(path, Classification.class); 32 | return new Result<>(resp); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/classifications/model/Classification.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.classifications.model; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import lombok.AccessLevel; 5 | import lombok.Builder; 6 | import lombok.EqualsAndHashCode; 7 | import lombok.Getter; 8 | import lombok.ToString; 9 | import lombok.experimental.FieldDefaults; 10 | 11 | @Getter 12 | @Builder 13 | @ToString 14 | @EqualsAndHashCode 15 | @FieldDefaults(level = AccessLevel.PRIVATE) 16 | public class Classification { 17 | String[] basedOnProperties; 18 | @SerializedName("class") 19 | String className; 20 | String[] classifyProperties; 21 | String error; 22 | ClassificationFilters filters; 23 | String id; 24 | ClassificationMeta meta; 25 | Object settings; 26 | String status; 27 | String type; 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/classifications/model/ClassificationFilters.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.classifications.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | import io.weaviate.client.v1.filters.WhereFilter; 10 | 11 | @Getter 12 | @Builder 13 | @ToString 14 | @EqualsAndHashCode 15 | @FieldDefaults(level = AccessLevel.PRIVATE) 16 | public class ClassificationFilters { 17 | WhereFilter sourceWhere; 18 | WhereFilter targetWhere; 19 | WhereFilter trainingSetWhere; 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/classifications/model/ClassificationMeta.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.classifications.model; 2 | 3 | import java.util.Date; 4 | import lombok.AccessLevel; 5 | import lombok.Builder; 6 | import lombok.EqualsAndHashCode; 7 | import lombok.Getter; 8 | import lombok.ToString; 9 | import lombok.experimental.FieldDefaults; 10 | 11 | @Getter 12 | @Builder 13 | @ToString 14 | @EqualsAndHashCode 15 | @FieldDefaults(level = AccessLevel.PRIVATE) 16 | public class ClassificationMeta { 17 | Date completed; 18 | Long count; 19 | Long countFailed; 20 | Long countSucceeded; 21 | Date started; 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/classifications/model/ClassificationType.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.classifications.model; 2 | 3 | public final class ClassificationType { 4 | // KNN (k nearest neighbours) a non parametric classification based on training data 5 | public static final String KNN = "knn"; 6 | // Contextual classification labels a data object with 7 | // the closest label based on their vector position (which describes the context) 8 | public static final String Contextual = "text2vec-contextionary"; 9 | // ZeroShot classification labels a data object with 10 | // the closest label based on their vector position (which describes the context) 11 | // It can be used with any vectorizer or custom vectors. 12 | public static final String ZeroShot = "zeroshot"; 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/classifications/model/ParamsKNN.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.classifications.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @Builder 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(level = AccessLevel.PRIVATE) 15 | public class ParamsKNN { 16 | Integer k; 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/cluster/Cluster.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.cluster; 2 | 3 | import io.weaviate.client.base.http.HttpClient; 4 | import io.weaviate.client.v1.cluster.api.NodesStatusGetter; 5 | import io.weaviate.client.Config; 6 | 7 | public class Cluster { 8 | 9 | private final Config config; 10 | private final HttpClient httpClient; 11 | 12 | public Cluster(HttpClient httpClient, Config config) { 13 | this.config = config; 14 | this.httpClient = httpClient; 15 | } 16 | 17 | public NodesStatusGetter nodesStatusGetter() { 18 | return new NodesStatusGetter(httpClient, config); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/cluster/model/NodeStatusOutput.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.cluster.model; 2 | 3 | public interface NodeStatusOutput { 4 | String VERBOSE = "verbose"; 5 | String MINIMAL = "minimal"; 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/cluster/model/NodesStatusResponse.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.cluster.model; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import lombok.AccessLevel; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @ToString 12 | @EqualsAndHashCode 13 | @FieldDefaults(level = AccessLevel.PRIVATE) 14 | public class NodesStatusResponse { 15 | 16 | NodeStatus[] nodes; 17 | 18 | 19 | @Getter 20 | @ToString 21 | @EqualsAndHashCode 22 | @FieldDefaults(level = AccessLevel.PRIVATE) 23 | public static class NodeStatus { 24 | 25 | String name; 26 | String status; 27 | String version; 28 | String gitHash; 29 | Stats stats; 30 | ShardStatus[] shards; 31 | } 32 | 33 | @Getter 34 | @ToString 35 | @EqualsAndHashCode 36 | @FieldDefaults(level = AccessLevel.PRIVATE) 37 | public static class Stats { 38 | 39 | Long shardCount; 40 | Long objectCount; 41 | } 42 | 43 | @Getter 44 | @ToString 45 | @EqualsAndHashCode 46 | @FieldDefaults(level = AccessLevel.PRIVATE) 47 | public static class ShardStatus { 48 | 49 | String name; 50 | @SerializedName("class") 51 | String className; 52 | Long objectCount; 53 | } 54 | 55 | public interface Status { 56 | 57 | String HEALTHY = "HEALTHY"; 58 | String UNHEALTHY = "UNHEALTHY"; 59 | String UNAVAILABLE = "UNAVAILABLE"; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/contextionary/Contextionary.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.contextionary; 2 | 3 | import io.weaviate.client.v1.contextionary.api.ConceptsGetter; 4 | import io.weaviate.client.v1.contextionary.api.ExtensionCreator; 5 | import io.weaviate.client.Config; 6 | import io.weaviate.client.base.http.HttpClient; 7 | 8 | public class Contextionary { 9 | private final Config config; 10 | private final HttpClient httpClient; 11 | 12 | public Contextionary(HttpClient httpClient, Config config) { 13 | this.config = config; 14 | this.httpClient = httpClient; 15 | } 16 | 17 | public ConceptsGetter conceptsGetter() { 18 | return new ConceptsGetter(httpClient, config); 19 | } 20 | 21 | public ExtensionCreator extensionCreator() { 22 | return new ExtensionCreator(httpClient, config); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/contextionary/api/ConceptsGetter.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.contextionary.api; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.base.BaseClient; 5 | import io.weaviate.client.base.ClientResult; 6 | import io.weaviate.client.base.Response; 7 | import io.weaviate.client.base.Result; 8 | import io.weaviate.client.base.http.HttpClient; 9 | import io.weaviate.client.v1.contextionary.model.C11yWordsResponse; 10 | 11 | public class ConceptsGetter extends BaseClient implements ClientResult { 12 | 13 | private String concept; 14 | 15 | public ConceptsGetter(HttpClient httpClient, Config config) { 16 | super(httpClient, config); 17 | } 18 | 19 | public ConceptsGetter withConcept(String concept) { 20 | this.concept = concept; 21 | return this; 22 | } 23 | 24 | @Override 25 | public Result run() { 26 | String path = String.format("/modules/text2vec-contextionary/concepts/%s", concept); 27 | Response resp = sendGetRequest(path, C11yWordsResponse.class); 28 | return new Result<>(resp); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/contextionary/model/C11yExtension.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.contextionary.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @Builder 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(level = AccessLevel.PRIVATE) 15 | public class C11yExtension { 16 | String concept; 17 | String definition; 18 | Float weight; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/contextionary/model/C11yNearestNeighbor.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.contextionary.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.AllArgsConstructor; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @AllArgsConstructor 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(level = AccessLevel.PRIVATE) 15 | public class C11yNearestNeighbor { 16 | Float distance; 17 | String word; 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/contextionary/model/C11yWordsResponse.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.contextionary.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.AllArgsConstructor; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @AllArgsConstructor 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(level = AccessLevel.PRIVATE) 15 | public class C11yWordsResponse { 16 | C11yWordsResponseConcatenatedWord concatenatedWord; 17 | C11yWordsResponseIndividualWordsItems[] individualWords; 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/contextionary/model/C11yWordsResponseConcatenatedWord.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.contextionary.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.AllArgsConstructor; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @AllArgsConstructor 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(level = AccessLevel.PRIVATE) 15 | public class C11yWordsResponseConcatenatedWord { 16 | C11yNearestNeighbor[] concatenatedNearestNeighbors; 17 | Float[] concatenatedVector; 18 | String concatenatedWord; 19 | String[] singleWords; 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/contextionary/model/C11yWordsResponseIndividualWordsItems.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.contextionary.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.AllArgsConstructor; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @AllArgsConstructor 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(level = AccessLevel.PRIVATE) 15 | public class C11yWordsResponseIndividualWordsItems { 16 | C11yWordsResponseIndividualWordsItems0Info info; 17 | Boolean present; 18 | String word; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/contextionary/model/C11yWordsResponseIndividualWordsItems0Info.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.contextionary.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.AllArgsConstructor; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @AllArgsConstructor 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(level = AccessLevel.PRIVATE) 15 | public class C11yWordsResponseIndividualWordsItems0Info { 16 | C11yNearestNeighbor[] nearestNeighbors; 17 | Float[] vector; 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/data/builder/ReferencePayloadBuilder.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.data.builder; 2 | 3 | import io.weaviate.client.base.util.BeaconPath; 4 | import io.weaviate.client.v1.data.model.SingleRef; 5 | import java.util.Objects; 6 | 7 | public class ReferencePayloadBuilder { 8 | 9 | private final BeaconPath beaconPath; 10 | private String id; 11 | private String className; 12 | 13 | @Deprecated 14 | public ReferencePayloadBuilder() { 15 | this.beaconPath = null; 16 | System.err.println("WARNING: Deprecated constructor for ReferencePayloadBuilder class was used. Please use parametrized one."); 17 | } 18 | 19 | public ReferencePayloadBuilder(BeaconPath beaconPath) { 20 | this.beaconPath = Objects.requireNonNull(beaconPath); 21 | } 22 | 23 | public ReferencePayloadBuilder withID(String id) { 24 | this.id = id; 25 | return this; 26 | } 27 | 28 | public ReferencePayloadBuilder withClassName(String className) { 29 | this.className = className; 30 | return this; 31 | } 32 | 33 | public SingleRef payload() { 34 | String beacon; 35 | if (beaconPath != null) { 36 | beacon = beaconPath.buildSingle(BeaconPath.Params.builder() 37 | .id(id) 38 | .className(className) 39 | .build()); 40 | } else { 41 | beacon = beaconDeprecated(); 42 | } 43 | 44 | return SingleRef.builder().beacon(beacon).build(); 45 | } 46 | 47 | private String beaconDeprecated() { 48 | return String.format("weaviate://localhost/%s", id); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/data/model/Deprecation.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.data.model; 2 | 3 | import java.util.Date; 4 | import lombok.AccessLevel; 5 | import lombok.Builder; 6 | import lombok.EqualsAndHashCode; 7 | import lombok.Getter; 8 | import lombok.ToString; 9 | import lombok.experimental.FieldDefaults; 10 | 11 | @Getter 12 | @Builder 13 | @ToString 14 | @EqualsAndHashCode 15 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 16 | public class Deprecation { 17 | String apiType; 18 | String id; 19 | String[] locations; 20 | String mitigation; 21 | String msg; 22 | String plannedRemovalVersion; 23 | String removedIn; 24 | Date removedTime; 25 | Date sinceTime; 26 | String sinceVersion; 27 | String status; 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/data/model/ObjectReference.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.data.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @Builder 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 15 | public class ObjectReference { 16 | String beacon; 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/data/model/ObjectsListResponse.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.data.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @Builder 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 15 | public class ObjectsListResponse { 16 | Deprecation[] deprecations; 17 | WeaviateObject[] objects; 18 | int totalResults; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/data/model/ReferenceMetaClassification.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.data.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @Builder 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 15 | public class ReferenceMetaClassification { 16 | Double closestLosingDistance; 17 | Double closestOverallDistance; 18 | Double closestWinningDistance; 19 | Long losingCount; 20 | Double losingDistance; 21 | Double meanLosingDistance; 22 | Double meanWinningDistance; 23 | Long overallCount; 24 | Long winningCount; 25 | Double winningDistance; 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/data/model/SingleRef.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.data.model; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import java.util.Map; 5 | import lombok.AccessLevel; 6 | import lombok.Builder; 7 | import lombok.EqualsAndHashCode; 8 | import lombok.Getter; 9 | import lombok.ToString; 10 | import lombok.experimental.FieldDefaults; 11 | 12 | @Getter 13 | @Builder 14 | @ToString 15 | @EqualsAndHashCode 16 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 17 | public class SingleRef { 18 | @SerializedName("class") 19 | String clazz; 20 | String beacon; 21 | ReferenceMetaClassification classification; 22 | String href; 23 | Map schema; 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/data/replication/model/ConsistencyLevel.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.data.replication.model; 2 | 3 | public interface ConsistencyLevel { 4 | String ALL = "ALL"; 5 | String ONE = "ONE"; 6 | String QUORUM = "QUORUM"; 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/experimental/Collection.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.experimental; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.v1.auth.provider.AccessTokenProvider; 5 | 6 | public class Collection { 7 | public final SearchClient query; 8 | 9 | Collection(Config config, AccessTokenProvider tokenProvider, String collection, Class cls) { 10 | this.query = new SearchClient(config, tokenProvider, collection, cls); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/experimental/Collections.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.experimental; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.v1.auth.provider.AccessTokenProvider; 5 | import lombok.RequiredArgsConstructor; 6 | 7 | @RequiredArgsConstructor 8 | public class Collections { 9 | private final Config config; 10 | private final AccessTokenProvider tokenProvider; 11 | 12 | public Collection use(String collection, Class cls) { 13 | return new Collection(config, tokenProvider, collection, cls); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/experimental/DataClient.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.experimental; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.base.http.HttpClient; 5 | import io.weaviate.client.base.util.DbVersionSupport; 6 | import io.weaviate.client.base.util.GrpcVersionSupport; 7 | import io.weaviate.client.v1.auth.provider.AccessTokenProvider; 8 | import io.weaviate.client.v1.data.Data; 9 | import lombok.RequiredArgsConstructor; 10 | 11 | /** DataClient handles insertions, updates, and deletes, as well as batching. */ 12 | @RequiredArgsConstructor 13 | public class DataClient { 14 | private final Config config; 15 | private final HttpClient httpClient; 16 | private final AccessTokenProvider tokenProvider; 17 | private final DbVersionSupport dbVersion; 18 | private final GrpcVersionSupport grpcVersion; 19 | private final Data data; 20 | 21 | public Batcher batch(Class cls) { 22 | return new Batcher<>(config, httpClient, tokenProvider, dbVersion, grpcVersion, data, cls); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/experimental/Metadata.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.experimental; 2 | 3 | import io.weaviate.client.grpc.protocol.v1.WeaviateProtoSearchGet.MetadataRequest; 4 | 5 | /** 6 | * Metadata is the common base for all properties that are requestes as 7 | * "_additional". It is an inteface all metadata properties MUST implement to be 8 | * used in {@link SearchOptions}. 9 | */ 10 | public interface Metadata { 11 | void append(MetadataRequest.Builder metadata); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/experimental/MetadataField.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.experimental; 2 | 3 | import io.weaviate.client.grpc.protocol.v1.WeaviateProtoSearchGet.MetadataRequest; 4 | 5 | /** 6 | * MetadataField are collection properties that can be requested for any object. 7 | */ 8 | public enum MetadataField implements Metadata { 9 | ID("id"), 10 | VECTOR("vector"), 11 | DISTANCE("distance"); 12 | 13 | private final String name; 14 | 15 | private MetadataField(String name) { 16 | this.name = name; 17 | } 18 | 19 | // FIXME: ideally, we don't want to surface this method in the public API 20 | public void append(MetadataRequest.Builder metadata) { 21 | switch (this.name) { 22 | case "id": 23 | metadata.setUuid(true); 24 | break; 25 | case "vector": 26 | metadata.setVector(true); 27 | break; 28 | case "distance": 29 | metadata.setDistance(true); 30 | break; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/experimental/Operand.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.experimental; 2 | 3 | import io.weaviate.client.grpc.protocol.v1.WeaviateProtoBase.Filters; 4 | 5 | public interface Operand { 6 | void append(Filters.Builder where); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/experimental/SearchResult.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.experimental; 2 | 3 | import java.util.List; 4 | 5 | import lombok.AllArgsConstructor; 6 | import lombok.ToString; 7 | 8 | @AllArgsConstructor 9 | public class SearchResult { 10 | public final List> objects; 11 | 12 | @AllArgsConstructor 13 | public static class SearchObject { 14 | public final T properties; 15 | public final SearchMetadata metadata; 16 | 17 | @AllArgsConstructor 18 | @ToString 19 | public static class SearchMetadata { 20 | public final String id; 21 | public final Float distance; 22 | public final Float[] vector; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/filters/Operator.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.filters; 2 | 3 | public interface Operator { 4 | 5 | String And = "And"; 6 | String Like = "Like"; 7 | String Or = "Or"; 8 | String Equal = "Equal"; 9 | String Not = "Not"; 10 | String NotEqual = "NotEqual"; 11 | String GreaterThan = "GreaterThan"; 12 | String GreaterThanEqual = "GreaterThanEqual"; 13 | String LessThan = "LessThan"; 14 | String LessThanEqual = "LessThanEqual"; 15 | String WithinGeoRange = "WithinGeoRange"; 16 | String ContainsAny = "ContainsAny"; 17 | String ContainsAll = "ContainsAll"; 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/graphql/model/ExploreFields.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.model; 2 | 3 | public enum ExploreFields { 4 | CERTAINTY("certainty"), 5 | DISTANCE("distance"), 6 | BEACON("beacon"), 7 | CLASS_NAME("className"); 8 | 9 | private final String field; 10 | 11 | ExploreFields(String field) { 12 | this.field = field; 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return field; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/graphql/model/GraphQLError.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @Builder 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(level = AccessLevel.PRIVATE) 15 | public class GraphQLError { 16 | String message; 17 | String[] path; 18 | GraphQLErrorLocationsItems[] locations; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/graphql/model/GraphQLErrorLocationsItems.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @Builder 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(level = AccessLevel.PRIVATE) 15 | public class GraphQLErrorLocationsItems { 16 | Long column; 17 | Long line; 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/graphql/model/GraphQLQuery.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @Builder 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(level = AccessLevel.PRIVATE) 15 | public class GraphQLQuery { 16 | String operationName; 17 | String query; 18 | Object variables; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/graphql/model/GraphQLResponse.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.model; 2 | 3 | import io.weaviate.client.base.WeaviateErrorMessage; 4 | import java.util.Arrays; 5 | import java.util.List; 6 | import java.util.stream.Collectors; 7 | import lombok.AccessLevel; 8 | import lombok.Builder; 9 | import lombok.EqualsAndHashCode; 10 | import lombok.Getter; 11 | import lombok.ToString; 12 | import lombok.experimental.FieldDefaults; 13 | 14 | @Getter 15 | @Builder 16 | @ToString 17 | @EqualsAndHashCode 18 | @FieldDefaults(level = AccessLevel.PRIVATE) 19 | public class GraphQLResponse { 20 | T data; 21 | GraphQLError[] errors; 22 | 23 | 24 | /** 25 | * Extract the 'message' portion of every error in the response, omitting 'path' and 'location'. 26 | * 27 | * @return Non-throwable WeaviateErrorMessages 28 | */ 29 | public List errorMessages() { 30 | if (errors == null || errors.length == 0) { 31 | return null; 32 | } 33 | return Arrays.stream(errors) 34 | .map(err -> new WeaviateErrorMessage(err.getMessage(), null)) 35 | .collect(Collectors.toList()); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/graphql/model/GraphQLTypedResponse.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.model; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import lombok.AccessLevel; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Builder; 7 | import lombok.EqualsAndHashCode; 8 | import lombok.Getter; 9 | import lombok.ToString; 10 | import lombok.experimental.FieldDefaults; 11 | 12 | @Getter 13 | @ToString 14 | @EqualsAndHashCode 15 | @AllArgsConstructor 16 | @FieldDefaults(level = AccessLevel.PRIVATE) 17 | public class GraphQLTypedResponse { 18 | Operation data; 19 | GraphQLError[] errors; 20 | 21 | @Getter 22 | @ToString 23 | @EqualsAndHashCode 24 | @AllArgsConstructor 25 | @FieldDefaults(level = AccessLevel.PRIVATE) 26 | public static class Operation { 27 | @SerializedName(value = "Get", alternate = {"Aggregate", "Explore"}) 28 | private T objects; 29 | } 30 | } 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/graphql/query/Raw.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.query; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.base.BaseClient; 5 | import io.weaviate.client.base.ClientResult; 6 | import io.weaviate.client.base.Response; 7 | import io.weaviate.client.base.Result; 8 | import io.weaviate.client.base.http.HttpClient; 9 | import io.weaviate.client.v1.graphql.model.GraphQLQuery; 10 | import io.weaviate.client.v1.graphql.model.GraphQLResponse; 11 | 12 | public class Raw extends BaseClient implements ClientResult { 13 | private String query; 14 | 15 | public Raw(HttpClient httpClient, Config config) { 16 | super(httpClient, config); 17 | } 18 | 19 | public Raw withQuery(String query) { 20 | this.query = query; 21 | return this; 22 | } 23 | 24 | @Override 25 | public Result run() { 26 | GraphQLQuery query = GraphQLQuery.builder().query(this.query).build(); 27 | Response resp = sendPostRequest("/graphql", query, GraphQLResponse.class); 28 | return new Result<>(resp); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/graphql/query/argument/Argument.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.query.argument; 2 | 3 | public interface Argument { 4 | String build(); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/graphql/query/argument/Bm25Argument.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.query.argument; 2 | 3 | import io.weaviate.client.v1.graphql.query.util.Serializer; 4 | import lombok.AccessLevel; 5 | import lombok.Builder; 6 | import lombok.EqualsAndHashCode; 7 | import lombok.Getter; 8 | import lombok.ToString; 9 | import lombok.experimental.FieldDefaults; 10 | 11 | import java.util.LinkedHashSet; 12 | import java.util.Set; 13 | 14 | @Getter 15 | @Builder 16 | @ToString 17 | @EqualsAndHashCode 18 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 19 | public class Bm25Argument implements Argument { 20 | String query; 21 | String[] properties; 22 | 23 | @Override 24 | public String build() { 25 | Set arg = new LinkedHashSet<>(); 26 | 27 | arg.add(String.format("query:%s", Serializer.quote(query))); 28 | if (properties != null) { 29 | arg.add(String.format("properties:%s", Serializer.arrayWithQuotes(properties))); 30 | } 31 | 32 | return String.format("bm25:{%s}", String.join(" ", arg)); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/graphql/query/argument/FusionType.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.query.argument; 2 | 3 | public interface FusionType { 4 | 5 | String RANKED = "rankedFusion"; 6 | String RELATIVE_SCORE = "relativeScoreFusion"; 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/graphql/query/argument/GroupArgument.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.query.argument; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | import java.util.LinkedHashSet; 11 | import java.util.Set; 12 | 13 | @Getter 14 | @Builder 15 | @ToString 16 | @EqualsAndHashCode 17 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 18 | public class GroupArgument implements Argument { 19 | GroupType type; 20 | Float force; 21 | 22 | @Override 23 | public String build() { 24 | Set arg = new LinkedHashSet<>(); 25 | 26 | if (type != null) { 27 | arg.add(String.format("type:%s", type)); 28 | } 29 | if (force != null) { 30 | arg.add(String.format("force:%s", force)); 31 | } 32 | 33 | return String.format("group:{%s}", String.join(" ", arg)); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/graphql/query/argument/GroupByArgument.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.query.argument; 2 | 3 | import io.weaviate.client.v1.graphql.query.util.Serializer; 4 | import java.util.LinkedHashSet; 5 | import java.util.Set; 6 | import lombok.AccessLevel; 7 | import lombok.Builder; 8 | import lombok.EqualsAndHashCode; 9 | import lombok.Getter; 10 | import lombok.ToString; 11 | import lombok.experimental.FieldDefaults; 12 | import org.apache.commons.lang3.ArrayUtils; 13 | 14 | @Getter 15 | @Builder 16 | @ToString 17 | @EqualsAndHashCode 18 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 19 | public class GroupByArgument implements Argument { 20 | String[] path; 21 | Integer groups; 22 | Integer objectsPerGroup; 23 | 24 | @Override 25 | public String build() { 26 | Set args = new LinkedHashSet<>(); 27 | 28 | if (ArrayUtils.isNotEmpty(path)) { 29 | args.add(String.format("path:%s", Serializer.arrayWithQuotes(path))); 30 | } 31 | if (groups != null) { 32 | args.add(String.format("groups:%s", groups)); 33 | } 34 | if (objectsPerGroup != null) { 35 | args.add(String.format("objectsPerGroup:%s", objectsPerGroup)); 36 | } 37 | 38 | return String.format("groupBy:{%s}", String.join(" ", args)); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/graphql/query/argument/GroupType.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.query.argument; 2 | 3 | public enum GroupType { 4 | merge("merge"), 5 | closest("closest"); 6 | 7 | private final String type; 8 | 9 | GroupType(String type) { 10 | this.type = type; 11 | } 12 | 13 | @Override 14 | public String toString() { 15 | return type; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/graphql/query/argument/NearAudioArgument.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.query.argument; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | import java.io.File; 11 | 12 | @Getter 13 | @Builder 14 | @ToString 15 | @EqualsAndHashCode 16 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 17 | public class NearAudioArgument implements Argument { 18 | 19 | String audio; 20 | File audioFile; 21 | Float certainty; 22 | Float distance; 23 | String[] targetVectors; 24 | Targets targets; 25 | 26 | @Override 27 | public String build() { 28 | return NearMediaArgumentHelper.builder() 29 | .certainty(certainty) 30 | .distance(distance) 31 | .targetVectors(targetVectors) 32 | .data(audio) 33 | .dataFile(audioFile) 34 | .targets(targets) 35 | .mediaField("audio") 36 | .mediaName("nearAudio") 37 | .build().build(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/graphql/query/argument/NearDepthArgument.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.query.argument; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | import java.io.File; 11 | 12 | @Getter 13 | @Builder 14 | @ToString 15 | @EqualsAndHashCode 16 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 17 | public class NearDepthArgument implements Argument { 18 | 19 | String depth; 20 | File depthFile; 21 | Float certainty; 22 | Float distance; 23 | String[] targetVectors; 24 | Targets targets; 25 | 26 | @Override 27 | public String build() { 28 | return NearMediaArgumentHelper.builder() 29 | .certainty(certainty) 30 | .distance(distance) 31 | .targetVectors(targetVectors) 32 | .data(depth) 33 | .dataFile(depthFile) 34 | .targets(targets) 35 | .mediaField("depth") 36 | .mediaName("nearDepth") 37 | .build().build(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/graphql/query/argument/NearImageArgument.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.query.argument; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | import java.io.File; 11 | 12 | @Getter 13 | @Builder 14 | @ToString 15 | @EqualsAndHashCode 16 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 17 | public class NearImageArgument implements Argument { 18 | 19 | String image; 20 | File imageFile; 21 | Float certainty; 22 | Float distance; 23 | String[] targetVectors; 24 | Targets targets; 25 | 26 | @Override 27 | public String build() { 28 | return NearMediaArgumentHelper.builder() 29 | .certainty(certainty) 30 | .distance(distance) 31 | .targetVectors(targetVectors) 32 | .data(image) 33 | .dataFile(imageFile) 34 | .targets(targets) 35 | .mediaField("image") 36 | .mediaName("nearImage") 37 | .build().build(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/graphql/query/argument/NearImuArgument.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.query.argument; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | import java.io.File; 11 | 12 | @Getter 13 | @Builder 14 | @ToString 15 | @EqualsAndHashCode 16 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 17 | public class NearImuArgument implements Argument { 18 | 19 | String imu; 20 | File imuFile; 21 | Float certainty; 22 | Float distance; 23 | String[] targetVectors; 24 | Targets targets; 25 | 26 | @Override 27 | public String build() { 28 | return NearMediaArgumentHelper.builder() 29 | .certainty(certainty) 30 | .distance(distance) 31 | .targetVectors(targetVectors) 32 | .data(imu) 33 | .dataFile(imuFile) 34 | .targets(targets) 35 | .mediaField("imu") 36 | .mediaName("nearIMU") 37 | .build().build(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/graphql/query/argument/NearTextMoveParameters.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.query.argument; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @Builder 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 15 | public class NearTextMoveParameters { 16 | String[] concepts; 17 | Float force; 18 | ObjectMove[] objects; 19 | 20 | @Getter 21 | @Builder 22 | @ToString 23 | @EqualsAndHashCode 24 | @FieldDefaults(level = AccessLevel.PRIVATE) 25 | public static class ObjectMove { 26 | String id; 27 | String beacon; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/graphql/query/argument/NearThermalArgument.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.query.argument; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | import java.io.File; 11 | 12 | @Getter 13 | @Builder 14 | @ToString 15 | @EqualsAndHashCode 16 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 17 | public class NearThermalArgument implements Argument { 18 | 19 | String thermal; 20 | File thermalFile; 21 | Float certainty; 22 | Float distance; 23 | String[] targetVectors; 24 | Targets targets; 25 | 26 | @Override 27 | public String build() { 28 | return NearMediaArgumentHelper.builder() 29 | .certainty(certainty) 30 | .distance(distance) 31 | .targetVectors(targetVectors) 32 | .data(thermal) 33 | .dataFile(thermalFile) 34 | .targets(targets) 35 | .mediaField("thermal") 36 | .mediaName("nearThermal") 37 | .build().build(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/graphql/query/argument/NearVideoArgument.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.query.argument; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | import java.io.File; 11 | 12 | @Getter 13 | @Builder 14 | @ToString 15 | @EqualsAndHashCode 16 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 17 | public class NearVideoArgument implements Argument { 18 | 19 | String video; 20 | File videoFile; 21 | Float certainty; 22 | Float distance; 23 | String[] targetVectors; 24 | Targets targets; 25 | 26 | @Override 27 | public String build() { 28 | return NearMediaArgumentHelper.builder() 29 | .certainty(certainty) 30 | .distance(distance) 31 | .targetVectors(targetVectors) 32 | .data(video) 33 | .dataFile(videoFile) 34 | .targets(targets) 35 | .mediaField("video") 36 | .mediaName("nearVideo") 37 | .build().build(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/graphql/query/argument/SortArgument.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.query.argument; 2 | 3 | import io.weaviate.client.v1.graphql.query.util.Serializer; 4 | import lombok.AccessLevel; 5 | import lombok.Builder; 6 | import lombok.EqualsAndHashCode; 7 | import lombok.Getter; 8 | import lombok.ToString; 9 | import lombok.experimental.FieldDefaults; 10 | import org.apache.commons.lang3.ArrayUtils; 11 | 12 | import java.util.LinkedHashSet; 13 | import java.util.Set; 14 | 15 | @Getter 16 | @Builder 17 | @ToString 18 | @EqualsAndHashCode 19 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 20 | public class SortArgument implements Argument { 21 | String[] path; 22 | SortOrder order; 23 | 24 | @Override 25 | public String build() { 26 | Set arg = new LinkedHashSet<>(); 27 | 28 | if (ArrayUtils.isNotEmpty(path)) { 29 | arg.add(String.format("path:%s", Serializer.arrayWithQuotes(path))); 30 | } 31 | if (order != null) { 32 | arg.add(String.format("order:%s", order)); 33 | } 34 | 35 | return String.format("{%s}", String.join(" ", arg)); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/graphql/query/argument/SortArguments.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.query.argument; 2 | 3 | import io.weaviate.client.v1.graphql.query.util.Serializer; 4 | import lombok.AccessLevel; 5 | import lombok.Builder; 6 | import lombok.EqualsAndHashCode; 7 | import lombok.Getter; 8 | import lombok.ToString; 9 | import lombok.experimental.FieldDefaults; 10 | import org.apache.commons.lang3.ArrayUtils; 11 | 12 | @Getter 13 | @Builder 14 | @ToString 15 | @EqualsAndHashCode 16 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 17 | public class SortArguments implements Argument { 18 | SortArgument[] sort; 19 | 20 | @Override 21 | public String build() { 22 | if (ArrayUtils.isNotEmpty(sort)) { 23 | return String.format("sort:%s", Serializer.array(sort, SortArgument::build)); 24 | } 25 | return "sort:[]"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/graphql/query/argument/SortOrder.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.query.argument; 2 | 3 | public enum SortOrder { 4 | asc("asc"), 5 | desc("desc"); 6 | 7 | private final String order; 8 | 9 | SortOrder(String order) { 10 | this.order = order; 11 | } 12 | 13 | @Override 14 | public String toString() { 15 | return order; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/graphql/query/builder/Query.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.query.builder; 2 | 3 | public interface Query { 4 | String buildQuery(); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/graphql/query/fields/Field.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.query.fields; 2 | 3 | import io.weaviate.client.v1.graphql.query.argument.Argument; 4 | import java.util.Arrays; 5 | import java.util.stream.Collectors; 6 | 7 | import lombok.AccessLevel; 8 | import lombok.Builder; 9 | import lombok.EqualsAndHashCode; 10 | import lombok.Getter; 11 | import lombok.ToString; 12 | import lombok.experimental.FieldDefaults; 13 | import org.apache.commons.lang3.ArrayUtils; 14 | import org.apache.commons.lang3.StringUtils; 15 | 16 | @Getter 17 | @Builder 18 | @ToString 19 | @EqualsAndHashCode 20 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 21 | public class Field implements Argument { 22 | String name; 23 | Field[] fields; 24 | 25 | @Override 26 | public String build() { 27 | StringBuilder s = new StringBuilder(); 28 | if (StringUtils.isNotBlank(name)) { 29 | s.append(name); 30 | } 31 | if (ArrayUtils.isNotEmpty(fields)) { 32 | s.append(String.format("{%s}", Arrays.stream(fields).map(Field::build).collect(Collectors.joining(" ")))); 33 | } 34 | return s.toString(); 35 | } 36 | 37 | 38 | // created to accept a variable number of fields 39 | public static class FieldBuilder { 40 | private Field[] fields; 41 | 42 | public FieldBuilder fields(Field... fields) { 43 | this.fields = fields; 44 | return this; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/graphql/query/fields/Fields.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.query.fields; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | import org.apache.commons.lang3.ObjectUtils; 10 | import io.weaviate.client.v1.graphql.query.argument.Argument; 11 | 12 | import java.util.Arrays; 13 | import java.util.stream.Collectors; 14 | 15 | @Getter 16 | @Builder 17 | @ToString 18 | @EqualsAndHashCode 19 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 20 | public class Fields implements Argument { 21 | Field[] fields; 22 | 23 | @Override 24 | public String build() { 25 | if (ObjectUtils.isEmpty(fields)) { 26 | return ""; 27 | } 28 | return Arrays.stream(fields) 29 | .map(Field::build) 30 | .collect(Collectors.joining(" ")); 31 | } 32 | 33 | 34 | // created to accept a variable number of fields 35 | public static class FieldsBuilder { 36 | private Field[] fields; 37 | 38 | public FieldsBuilder fields(Field... fields) { 39 | this.fields = fields; 40 | return this; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/grpc/query/Raw.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.grpc.query; 2 | 3 | import java.util.Map; 4 | 5 | import io.weaviate.client.Config; 6 | import io.weaviate.client.base.grpc.GrpcClient; 7 | import io.weaviate.client.base.http.HttpClient; 8 | import io.weaviate.client.grpc.protocol.v1.WeaviateProtoSearchGet.SearchReply; 9 | import io.weaviate.client.grpc.protocol.v1.WeaviateProtoSearchGet.SearchRequest; 10 | import io.weaviate.client.v1.auth.provider.AccessTokenProvider; 11 | import io.weaviate.client.v1.experimental.SearchClient; 12 | import io.weaviate.client.v1.experimental.SearchResult; 13 | 14 | public class Raw { 15 | private final AccessTokenProvider tokenProvider; 16 | private final Config config; 17 | private SearchRequest search; 18 | 19 | public Raw(HttpClient httpClient, Config config, AccessTokenProvider tokenProvider) { 20 | this.config = config; 21 | this.tokenProvider = tokenProvider; 22 | } 23 | 24 | public Raw withSearch(SearchRequest search) { 25 | this.search = search; 26 | return this; 27 | } 28 | 29 | public SearchResult> run() { 30 | GrpcClient grpcClient = GrpcClient.create(this.config, this.tokenProvider); 31 | try { 32 | SearchReply reply = grpcClient.search(this.search); 33 | return SearchClient.deserializeUntyped(reply); 34 | } finally { 35 | grpcClient.shutdown(); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/misc/Misc.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.misc; 2 | 3 | import io.weaviate.client.base.http.HttpClient; 4 | import io.weaviate.client.base.util.DbVersionProvider; 5 | import io.weaviate.client.v1.misc.api.LiveChecker; 6 | import io.weaviate.client.v1.misc.api.MetaGetter; 7 | import io.weaviate.client.v1.misc.api.OpenIDConfigGetter; 8 | import io.weaviate.client.v1.misc.api.ReadyChecker; 9 | import io.weaviate.client.Config; 10 | 11 | public class Misc { 12 | private final Config config; 13 | private final DbVersionProvider dbVersionProvider; 14 | private final HttpClient httpClient; 15 | 16 | public Misc(HttpClient httpClient, Config config, DbVersionProvider dbVersionProvider) { 17 | this.httpClient = httpClient; 18 | this.config = config; 19 | this.dbVersionProvider = dbVersionProvider; 20 | } 21 | 22 | public MetaGetter metaGetter() { 23 | return new MetaGetter(httpClient, config); 24 | } 25 | 26 | public OpenIDConfigGetter openIDConfigGetter() { 27 | return new OpenIDConfigGetter(httpClient, config); 28 | } 29 | 30 | public LiveChecker liveChecker() { 31 | return new LiveChecker(httpClient, config, dbVersionProvider); 32 | } 33 | 34 | public ReadyChecker readyChecker() { 35 | return new ReadyChecker(httpClient, config, dbVersionProvider); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/misc/api/LiveChecker.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.misc.api; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.base.BaseClient; 5 | import io.weaviate.client.base.ClientResult; 6 | import io.weaviate.client.base.Response; 7 | import io.weaviate.client.base.Result; 8 | import io.weaviate.client.base.http.HttpClient; 9 | import io.weaviate.client.base.util.DbVersionProvider; 10 | 11 | public class LiveChecker extends BaseClient implements ClientResult { 12 | 13 | private final DbVersionProvider dbVersionProvider; 14 | 15 | public LiveChecker(HttpClient httpClient, Config config, DbVersionProvider dbVersionProvider) { 16 | super(httpClient, config); 17 | this.dbVersionProvider = dbVersionProvider; 18 | } 19 | 20 | @Override 21 | public Result run() { 22 | Response resp = sendGetRequest("/.well-known/live", String.class); 23 | if (resp.getStatusCode() == 200) { 24 | dbVersionProvider.refresh(); 25 | } 26 | return new Result<>(resp.getStatusCode(), resp.getStatusCode() == 200, resp.getErrors()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/misc/api/MetaGetter.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.misc.api; 2 | 3 | import io.weaviate.client.v1.misc.model.Meta; 4 | import io.weaviate.client.Config; 5 | import io.weaviate.client.base.BaseClient; 6 | import io.weaviate.client.base.ClientResult; 7 | import io.weaviate.client.base.Response; 8 | import io.weaviate.client.base.Result; 9 | import io.weaviate.client.base.http.HttpClient; 10 | 11 | public class MetaGetter extends BaseClient implements ClientResult { 12 | 13 | public MetaGetter(HttpClient httpClient, Config config) { 14 | super(httpClient, config); 15 | } 16 | 17 | @Override 18 | public Result run() { 19 | Response resp = sendGetRequest("/meta", Meta.class); 20 | return new Result<>(resp); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/misc/api/OpenIDConfigGetter.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.misc.api; 2 | 3 | import io.weaviate.client.v1.misc.model.OpenIDConfiguration; 4 | import io.weaviate.client.Config; 5 | import io.weaviate.client.base.BaseClient; 6 | import io.weaviate.client.base.ClientResult; 7 | import io.weaviate.client.base.Response; 8 | import io.weaviate.client.base.Result; 9 | import io.weaviate.client.base.http.HttpClient; 10 | 11 | public class OpenIDConfigGetter extends BaseClient implements ClientResult { 12 | 13 | public OpenIDConfigGetter(HttpClient httpClient, Config config) { 14 | super(httpClient, config); 15 | } 16 | 17 | @Override 18 | public Result run() { 19 | Response resp = sendGetRequest("/.well-known/openid-configuration", OpenIDConfiguration.class); 20 | return new Result<>(resp); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/misc/api/ReadyChecker.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.misc.api; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.base.BaseClient; 5 | import io.weaviate.client.base.ClientResult; 6 | import io.weaviate.client.base.Response; 7 | import io.weaviate.client.base.Result; 8 | import io.weaviate.client.base.http.HttpClient; 9 | import io.weaviate.client.base.util.DbVersionProvider; 10 | 11 | public class ReadyChecker extends BaseClient implements ClientResult { 12 | 13 | private final DbVersionProvider dbVersionProvider; 14 | 15 | public ReadyChecker(HttpClient httpClient, Config config, DbVersionProvider dbVersionProvider) { 16 | super(httpClient, config); 17 | this.dbVersionProvider = dbVersionProvider; 18 | } 19 | 20 | @Override 21 | public Result run() { 22 | Response resp = sendGetRequest("/.well-known/ready", String.class); 23 | if (resp.getStatusCode() == 200) { 24 | dbVersionProvider.refresh(); 25 | } 26 | return new Result<>(resp.getStatusCode(), resp.getStatusCode() == 200, resp.getErrors()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/misc/model/BM25Config.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.misc.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Builder 11 | @Getter 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 15 | public class BM25Config { 16 | Float k1; 17 | Float b; 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/misc/model/BQConfig.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.misc.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @Builder 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 15 | public class BQConfig { 16 | Boolean enabled; 17 | Long rescoreLimit; 18 | Boolean cache; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/misc/model/DistanceType.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.misc.model; 2 | 3 | public interface DistanceType { 4 | 5 | String COSINE = "cosine"; 6 | String DOT = "dot"; 7 | String L2_SQUARED = "l2-squared"; 8 | String HAMMING = "hamming"; 9 | String MANHATTAN = "manhattan"; 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/misc/model/InvertedIndexConfig.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.misc.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @Builder 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 15 | public class InvertedIndexConfig { 16 | BM25Config bm25; 17 | StopwordConfig stopwords; 18 | Integer cleanupIntervalSeconds; 19 | Boolean indexTimestamps; 20 | Boolean indexNullState; 21 | Boolean indexPropertyLength; 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/misc/model/Meta.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.misc.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.Getter; 6 | import lombok.ToString; 7 | import lombok.experimental.FieldDefaults; 8 | 9 | @Getter 10 | @ToString 11 | @EqualsAndHashCode 12 | @FieldDefaults(level = AccessLevel.PRIVATE) 13 | public class Meta { 14 | String hostname; 15 | String version; 16 | Object modules; 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/misc/model/MultiTenancyConfig.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.misc.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @Builder 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 15 | public class MultiTenancyConfig { 16 | Boolean enabled; 17 | Boolean autoTenantCreation; 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/misc/model/MultiVectorConfig.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.misc.model; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import lombok.AccessLevel; 5 | import lombok.Builder; 6 | import lombok.EqualsAndHashCode; 7 | import lombok.Getter; 8 | import lombok.ToString; 9 | import lombok.experimental.FieldDefaults; 10 | 11 | @Getter 12 | @Builder 13 | @ToString 14 | @EqualsAndHashCode 15 | @FieldDefaults(level = AccessLevel.PRIVATE) 16 | public class MultiVectorConfig { 17 | @Builder.Default 18 | private boolean enabled = true; 19 | @Builder.Default 20 | private Aggregation aggregation = Aggregation.MAX_SIM; 21 | @SerializedName("muvera") 22 | private MuveraConfig muvera; 23 | 24 | public enum Aggregation { 25 | MAX_SIM; 26 | } 27 | 28 | 29 | public MuveraConfig getMuveraEncoding() { 30 | return this.muvera; 31 | } 32 | 33 | // Hide the default getter 34 | private MuveraConfig getMuvera() { 35 | return this.muvera; 36 | } 37 | 38 | public static class MultiVectorConfigBuilder { 39 | private MuveraConfig muvera; 40 | 41 | public MultiVectorConfigBuilder encoding(MuveraConfig muvera) { 42 | this.muvera = muvera; 43 | return this; 44 | } 45 | 46 | // Hide default builder setter 47 | private MultiVectorConfigBuilder muvera(MuveraConfig _muvera) { 48 | return this; 49 | } 50 | 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/misc/model/MuveraConfig.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.misc.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | 11 | @Getter 12 | @Builder 13 | @ToString 14 | @EqualsAndHashCode 15 | @FieldDefaults(level = AccessLevel.PRIVATE) 16 | public class MuveraConfig { 17 | Boolean enabled; 18 | Integer ksim; 19 | Integer dprojections; 20 | Integer repetitions; 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/misc/model/OpenIDConfiguration.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.misc.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.Getter; 6 | import lombok.ToString; 7 | import lombok.experimental.FieldDefaults; 8 | 9 | @Getter 10 | @ToString 11 | @EqualsAndHashCode 12 | @FieldDefaults(level = AccessLevel.PRIVATE) 13 | public class OpenIDConfiguration { 14 | String href; 15 | String clientID; 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/misc/model/PQConfig.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.misc.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @Builder 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 15 | public class PQConfig { 16 | Boolean enabled; 17 | // HNSW index specific settings 18 | Boolean bitCompression; 19 | Integer segments; 20 | Integer centroids; 21 | Integer trainingLimit; 22 | Encoder encoder; 23 | // Flat index specific settings 24 | Long rescoreLimit; 25 | Boolean cache; 26 | 27 | 28 | @Getter 29 | @Builder 30 | @ToString 31 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 32 | public static class Encoder { 33 | String type; 34 | String distribution; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/misc/model/ReplicationConfig.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.misc.model; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import lombok.AccessLevel; 5 | import lombok.Builder; 6 | import lombok.EqualsAndHashCode; 7 | import lombok.Getter; 8 | import lombok.ToString; 9 | import lombok.experimental.FieldDefaults; 10 | 11 | @Getter 12 | @Builder 13 | @ToString 14 | @EqualsAndHashCode 15 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 16 | public class ReplicationConfig { 17 | Boolean asyncEnabled; 18 | Integer factor; 19 | DeletionStrategy deletionStrategy; 20 | 21 | public enum DeletionStrategy { 22 | @SerializedName("DeleteOnConflict") 23 | DELETE_ON_CONFLICT, 24 | @SerializedName("NoAutomatedResolution") 25 | NO_AUTOMATED_RESOLUTION; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/misc/model/SQConfig.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.misc.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @Builder 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 15 | public class SQConfig { 16 | Boolean enabled; 17 | Long rescoreLimit; 18 | Boolean cache; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/misc/model/ShardingConfig.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.misc.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @Builder 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 15 | public class ShardingConfig { 16 | Integer actualCount; 17 | Integer actualVirtualCount; 18 | Integer desiredCount; 19 | Integer desiredVirtualCount; 20 | String function; 21 | String key; 22 | String strategy; 23 | Integer virtualPerPhysical; 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/misc/model/StopwordConfig.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.misc.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Builder 11 | @Getter 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 15 | public class StopwordConfig { 16 | String preset; 17 | String[] additions; 18 | String[] removals; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/misc/model/VectorIndexConfig.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.misc.model; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | import lombok.AccessLevel; 6 | import lombok.Builder; 7 | import lombok.EqualsAndHashCode; 8 | import lombok.Getter; 9 | import lombok.ToString; 10 | import lombok.experimental.FieldDefaults; 11 | 12 | @Getter 13 | @Builder 14 | @ToString 15 | @EqualsAndHashCode 16 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 17 | public class VectorIndexConfig { 18 | String distance; 19 | Integer ef; 20 | Integer efConstruction; 21 | Integer maxConnections; 22 | Integer dynamicEfMin; 23 | Integer dynamicEfMax; 24 | Integer dynamicEfFactor; 25 | FilterStrategy filterStrategy; 26 | Long vectorCacheMaxObjects; 27 | Integer flatSearchCutoff; 28 | Integer cleanupIntervalSeconds; 29 | Boolean skip; 30 | PQConfig pq; 31 | BQConfig bq; 32 | SQConfig sq; 33 | 34 | @SerializedName("multivector") 35 | MultiVectorConfig multiVector; 36 | 37 | public enum FilterStrategy { 38 | @SerializedName("sweeping") 39 | SWEEPING, 40 | @SerializedName("acorn") 41 | ACORN; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/rbac/api/AssignedUsersGetter.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.rbac.api; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Arrays; 5 | import java.util.List; 6 | import java.util.Optional; 7 | 8 | import io.weaviate.client.Config; 9 | import io.weaviate.client.base.BaseClient; 10 | import io.weaviate.client.base.ClientResult; 11 | import io.weaviate.client.base.Response; 12 | import io.weaviate.client.base.Result; 13 | import io.weaviate.client.base.http.HttpClient; 14 | 15 | public class AssignedUsersGetter extends BaseClient implements ClientResult> { 16 | private String role; 17 | 18 | public AssignedUsersGetter(HttpClient httpClient, Config config) { 19 | super(httpClient, config); 20 | } 21 | 22 | public AssignedUsersGetter withRole(String role) { 23 | this.role = role; 24 | return this; 25 | } 26 | 27 | @Override 28 | public Result> run() { 29 | Response resp = sendGetRequest(path(), String[].class); 30 | List roles = Optional.ofNullable(resp.getBody()) 31 | .map(Arrays::asList) 32 | .orElse(new ArrayList<>()); 33 | return new Result<>(resp.getStatusCode(), roles, resp.getErrors()); 34 | } 35 | 36 | private String path() { 37 | return String.format("/authz/roles/%s/users", this.role); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/rbac/api/PermissionChecker.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.rbac.api; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.base.BaseClient; 5 | import io.weaviate.client.base.ClientResult; 6 | import io.weaviate.client.base.Result; 7 | import io.weaviate.client.base.http.HttpClient; 8 | import io.weaviate.client.v1.rbac.model.Permission; 9 | 10 | public class PermissionChecker extends BaseClient implements ClientResult { 11 | private String role; 12 | private Permission permission; 13 | 14 | public PermissionChecker(HttpClient httpClient, Config config) { 15 | super(httpClient, config); 16 | } 17 | 18 | public PermissionChecker withRole(String role) { 19 | this.role = role; 20 | return this; 21 | } 22 | 23 | public PermissionChecker withPermission(Permission permission) { 24 | this.permission = permission; 25 | return this; 26 | } 27 | 28 | @Override 29 | public Result run() { 30 | return new Result(sendPostRequest(path(), permission.firstToWeaviate(), Boolean.class)); 31 | } 32 | 33 | private String path() { 34 | return String.format("/authz/roles/%s/has-permission", this.role); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/rbac/api/RoleAllGetter.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.rbac.api; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Arrays; 5 | import java.util.List; 6 | import java.util.Optional; 7 | import java.util.stream.Collectors; 8 | 9 | import io.weaviate.client.Config; 10 | import io.weaviate.client.base.BaseClient; 11 | import io.weaviate.client.base.ClientResult; 12 | import io.weaviate.client.base.Response; 13 | import io.weaviate.client.base.Result; 14 | import io.weaviate.client.base.http.HttpClient; 15 | import io.weaviate.client.v1.rbac.model.Role; 16 | 17 | public class RoleAllGetter extends BaseClient implements ClientResult> { 18 | 19 | public RoleAllGetter(HttpClient httpClient, Config config) { 20 | super(httpClient, config); 21 | } 22 | 23 | @Override 24 | public Result> run() { 25 | Response resp = sendGetRequest("/authz/roles", WeaviateRole[].class); 26 | List roles = Optional.ofNullable(resp.getBody()) 27 | .map(Arrays::asList) 28 | .orElse(new ArrayList<>()) 29 | .stream() 30 | .map(w -> w.toRole()) 31 | .collect(Collectors.toList()); 32 | return new Result<>(resp.getStatusCode(), roles, resp.getErrors()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/rbac/api/RoleCreator.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.rbac.api; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Arrays; 5 | import java.util.List; 6 | 7 | import io.weaviate.client.Config; 8 | import io.weaviate.client.base.BaseClient; 9 | import io.weaviate.client.base.ClientResult; 10 | import io.weaviate.client.base.Result; 11 | import io.weaviate.client.base.http.HttpClient; 12 | import io.weaviate.client.v1.rbac.model.Permission; 13 | 14 | public class RoleCreator extends BaseClient implements ClientResult { 15 | private String name; 16 | private List> permissions = new ArrayList<>(); 17 | 18 | public RoleCreator(HttpClient httpClient, Config config) { 19 | super(httpClient, config); 20 | } 21 | 22 | public RoleCreator withName(String name) { 23 | this.name = name; 24 | return this; 25 | } 26 | 27 | public RoleCreator withPermissions(Permission... permissions) { 28 | this.permissions = Arrays.asList(permissions); 29 | return this; 30 | } 31 | 32 | @Override 33 | public Result run() { 34 | WeaviateRole role = new WeaviateRole(this.name, this.permissions); 35 | return Result.voidToBoolean(sendPostRequest("/authz/roles", role, Void.class)); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/rbac/api/RoleDeleter.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.rbac.api; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.base.BaseClient; 5 | import io.weaviate.client.base.ClientResult; 6 | import io.weaviate.client.base.Result; 7 | import io.weaviate.client.base.http.HttpClient; 8 | 9 | public class RoleDeleter extends BaseClient implements ClientResult { 10 | private String name; 11 | 12 | public RoleDeleter(HttpClient httpClient, Config config) { 13 | super(httpClient, config); 14 | } 15 | 16 | public RoleDeleter withName(String name) { 17 | this.name = name; 18 | return this; 19 | } 20 | 21 | @Override 22 | public Result run() { 23 | return Result.voidToBoolean(sendDeleteRequest("/authz/roles/" + this.name, null, Void.class)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/rbac/api/RoleExists.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.rbac.api; 2 | 3 | import org.apache.hc.core5.http.HttpStatus; 4 | 5 | import io.weaviate.client.Config; 6 | import io.weaviate.client.base.BaseClient; 7 | import io.weaviate.client.base.ClientResult; 8 | import io.weaviate.client.base.Result; 9 | import io.weaviate.client.base.WeaviateError; 10 | import io.weaviate.client.base.WeaviateErrorResponse; 11 | import io.weaviate.client.base.http.HttpClient; 12 | import io.weaviate.client.v1.rbac.model.Role; 13 | 14 | public class RoleExists extends BaseClient implements ClientResult { 15 | private RoleGetter getter; 16 | 17 | public RoleExists(HttpClient httpClient, Config config) { 18 | super(httpClient, config); 19 | this.getter = new RoleGetter(httpClient, config); 20 | } 21 | 22 | public RoleExists withName(String name) { 23 | this.getter.withName(name); 24 | return this; 25 | } 26 | 27 | @Override 28 | public Result run() { 29 | Result resp = this.getter.run(); 30 | if (resp.hasErrors()) { 31 | WeaviateError error = resp.getError(); 32 | return new Result<>(error.getStatusCode(), null, 33 | WeaviateErrorResponse.builder().error(error.getMessages()).build()); 34 | 35 | } 36 | return new Result(HttpStatus.SC_OK, resp.getResult() != null, null); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/rbac/api/RoleGetter.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.rbac.api; 2 | 3 | import java.util.Optional; 4 | 5 | import io.weaviate.client.Config; 6 | import io.weaviate.client.base.BaseClient; 7 | import io.weaviate.client.base.ClientResult; 8 | import io.weaviate.client.base.Response; 9 | import io.weaviate.client.base.Result; 10 | import io.weaviate.client.base.http.HttpClient; 11 | import io.weaviate.client.v1.rbac.model.Role; 12 | 13 | public class RoleGetter extends BaseClient implements ClientResult { 14 | private String name; 15 | 16 | public RoleGetter(HttpClient httpClient, Config config) { 17 | super(httpClient, config); 18 | } 19 | 20 | public RoleGetter withName(String name) { 21 | this.name = name; 22 | return this; 23 | } 24 | 25 | @Override 26 | public Result run() { 27 | Response resp = sendGetRequest("/authz/roles/" + this.name, WeaviateRole.class); 28 | Role role = Optional.ofNullable(resp.getBody()).map(WeaviateRole::toRole).orElse(null); 29 | return new Result(resp.getStatusCode(), role, resp.getErrors()); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/rbac/api/UserAssignmentsGetter.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.rbac.api; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Arrays; 5 | import java.util.List; 6 | import java.util.Optional; 7 | 8 | import io.weaviate.client.Config; 9 | import io.weaviate.client.base.BaseClient; 10 | import io.weaviate.client.base.ClientResult; 11 | import io.weaviate.client.base.Response; 12 | import io.weaviate.client.base.Result; 13 | import io.weaviate.client.base.http.HttpClient; 14 | import io.weaviate.client.v1.rbac.model.UserAssignment; 15 | 16 | public class UserAssignmentsGetter extends BaseClient implements ClientResult> { 17 | private String role; 18 | 19 | public UserAssignmentsGetter(HttpClient httpClient, Config config) { 20 | super(httpClient, config); 21 | } 22 | 23 | public UserAssignmentsGetter withRole(String role) { 24 | this.role = role; 25 | return this; 26 | } 27 | 28 | @Override 29 | public Result> run() { 30 | Response resp = sendGetRequest(path(), UserAssignment[].class); 31 | List roles = Optional.ofNullable(resp.getBody()) 32 | .map(Arrays::asList).orElse(new ArrayList<>()); 33 | return new Result<>(resp.getStatusCode(), roles, resp.getErrors()); 34 | } 35 | 36 | private String path() { 37 | return String.format("/authz/roles/%s/user-assignments", this.role); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/rbac/api/WeaviateRole.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.rbac.api; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | import java.util.Objects; 6 | import java.util.stream.Collectors; 7 | 8 | import io.weaviate.client.v1.rbac.model.Permission; 9 | import io.weaviate.client.v1.rbac.model.Role; 10 | import lombok.Getter; 11 | 12 | /** API model for serializing/deserializing roles. */ 13 | @Getter 14 | public class WeaviateRole { 15 | String name; 16 | List permissions; 17 | 18 | public WeaviateRole(String name, List> permissions) { 19 | this.name = name; 20 | this.permissions = WeaviatePermission.mergePermissions(permissions); 21 | } 22 | 23 | /** Exposed for testing. */ 24 | WeaviateRole(String name, WeaviatePermission... permissions) { 25 | this.name = name; 26 | this.permissions = Arrays.asList(permissions); 27 | } 28 | 29 | /** Create {@link Role} from the API response object. */ 30 | public Role toRole() { 31 | List> permissions = this.permissions.stream() 32 | .>map(perm -> Permission.fromWeaviate(perm)) 33 | .filter(Objects::nonNull).collect(Collectors.toList()); 34 | return new Role(this.name, Permission.merge(permissions)); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/rbac/model/BackupsPermission.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.rbac.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.Getter; 6 | 7 | @Getter 8 | @EqualsAndHashCode(callSuper = true) 9 | public class BackupsPermission extends Permission { 10 | final String collection; 11 | 12 | public BackupsPermission(String collection, Action... actions) { 13 | super(actions); 14 | this.collection = collection; 15 | } 16 | 17 | BackupsPermission(String collection, String action) { 18 | this(collection, RbacAction.fromString(Action.class, action)); 19 | } 20 | 21 | @AllArgsConstructor 22 | public enum Action implements RbacAction { 23 | MANAGE("manage_backups"); 24 | 25 | @Getter 26 | private final String value; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/rbac/model/ClusterPermission.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.rbac.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.Getter; 6 | 7 | @Getter 8 | @EqualsAndHashCode(callSuper = true) 9 | public class ClusterPermission extends Permission { 10 | public ClusterPermission(Action... actions) { 11 | super(actions); 12 | } 13 | 14 | ClusterPermission(String action) { 15 | this(RbacAction.fromString(Action.class, action)); 16 | } 17 | 18 | @AllArgsConstructor 19 | public enum Action implements RbacAction { 20 | READ("read_cluster"); 21 | 22 | @Getter 23 | private final String value; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/rbac/model/CollectionsPermission.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.rbac.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.Getter; 6 | 7 | @Getter 8 | @EqualsAndHashCode(callSuper = true) 9 | public class CollectionsPermission extends Permission { 10 | final String collection; 11 | 12 | public CollectionsPermission(String collection, Action... actions) { 13 | super(actions); 14 | this.collection = collection; 15 | } 16 | 17 | CollectionsPermission(String collection, String action) { 18 | this(collection, RbacAction.fromString(Action.class, action)); 19 | } 20 | 21 | @AllArgsConstructor 22 | public enum Action implements RbacAction { 23 | CREATE("create_collections"), 24 | READ("read_collections"), 25 | UPDATE("update_collections"), 26 | DELETE("delete_collections"); 27 | 28 | // Not part of the public API yet. 29 | // MANAGE("manage_collections"); 30 | 31 | @Getter 32 | private final String value; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/rbac/model/DataPermission.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.rbac.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.Getter; 6 | 7 | @Getter 8 | @EqualsAndHashCode(callSuper = true) 9 | public class DataPermission extends Permission { 10 | final String collection; 11 | 12 | public DataPermission(String collection, Action... actions) { 13 | super(actions); 14 | this.collection = collection; 15 | } 16 | 17 | DataPermission(String collection, String action) { 18 | this(collection, RbacAction.fromString(Action.class, action)); 19 | } 20 | 21 | @AllArgsConstructor 22 | public enum Action implements RbacAction { 23 | CREATE("create_data"), 24 | READ("read_data"), 25 | UPDATE("update_data"), 26 | DELETE("delete_data"), 27 | MANAGE("manage_data"); 28 | 29 | @Getter 30 | private final String value; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/rbac/model/Role.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.rbac.model; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.stream.Collectors; 6 | 7 | import lombok.AllArgsConstructor; 8 | import lombok.EqualsAndHashCode; 9 | import lombok.Getter; 10 | 11 | @Getter 12 | @AllArgsConstructor 13 | @EqualsAndHashCode 14 | public class Role { 15 | public final String name; 16 | public List> permissions = new ArrayList<>(); 17 | 18 | public String toString() { 19 | return String.format( 20 | "Role", 21 | this.name, permissions.isEmpty() 22 | ? "none" 23 | : String.join(",\n", permissions.stream().map(Permission::toString) 24 | .collect(Collectors.toList()))); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/rbac/model/TenantsPermission.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.rbac.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.Getter; 6 | 7 | @Getter 8 | @EqualsAndHashCode(callSuper = true) 9 | public class TenantsPermission extends Permission { 10 | 11 | public TenantsPermission(Action... actions) { 12 | super(actions); 13 | } 14 | 15 | TenantsPermission(String action) { 16 | this(RbacAction.fromString(Action.class, action)); 17 | } 18 | 19 | @AllArgsConstructor 20 | public enum Action implements RbacAction { 21 | CREATE("create_tenants"), 22 | READ("read_tenants"), 23 | UPDATE("update_tenants"), 24 | DELETE("delete_tenants"); 25 | 26 | @Getter 27 | private final String value; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/rbac/model/UserAssignment.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.rbac.model; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | import lombok.AllArgsConstructor; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | 9 | @Getter 10 | @ToString 11 | @AllArgsConstructor 12 | public class UserAssignment { 13 | @SerializedName("userId") 14 | String userId; 15 | 16 | @SerializedName("userType") 17 | String userType; 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/rbac/model/UsersPermission.java: -------------------------------------------------------------------------------- 1 | 2 | package io.weaviate.client.v1.rbac.model; 3 | 4 | import lombok.AllArgsConstructor; 5 | import lombok.Getter; 6 | 7 | public class UsersPermission extends Permission { 8 | public UsersPermission(Action... actions) { 9 | super(actions); 10 | } 11 | 12 | UsersPermission(String action) { 13 | this(RbacAction.fromString(Action.class, action)); 14 | } 15 | 16 | @AllArgsConstructor 17 | public enum Action implements RbacAction { 18 | CREATE("create_users"), 19 | UPDATE("update_users"), 20 | READ("read_users"), 21 | DELETE("delete_users"), 22 | ASSIGN_AND_REVOKE("assign_and_revoke_users"); 23 | 24 | @Getter 25 | private final String value; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/schema/api/ClassCreator.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.schema.api; 2 | 3 | import io.weaviate.client.v1.schema.model.WeaviateClass; 4 | import io.weaviate.client.Config; 5 | import io.weaviate.client.base.BaseClient; 6 | import io.weaviate.client.base.ClientResult; 7 | import io.weaviate.client.base.Response; 8 | import io.weaviate.client.base.Result; 9 | import io.weaviate.client.base.http.HttpClient; 10 | 11 | public class ClassCreator extends BaseClient implements ClientResult { 12 | 13 | private WeaviateClass clazz; 14 | 15 | public ClassCreator(HttpClient httpClient, Config config) { 16 | super(httpClient, config); 17 | } 18 | 19 | public ClassCreator withClass(WeaviateClass clazz) { 20 | this.clazz = clazz; 21 | return this; 22 | } 23 | 24 | @Override 25 | public Result run() { 26 | Response resp = sendPostRequest("/schema", clazz, WeaviateClass.class); 27 | return new Result<>(resp.getStatusCode(), resp.getStatusCode() == 200, resp.getErrors()); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/schema/api/ClassUpdater.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.schema.api; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.base.BaseClient; 5 | import io.weaviate.client.base.ClientResult; 6 | import io.weaviate.client.base.Response; 7 | import io.weaviate.client.base.Result; 8 | import io.weaviate.client.base.http.HttpClient; 9 | import io.weaviate.client.base.util.UrlEncoder; 10 | import io.weaviate.client.v1.schema.model.WeaviateClass; 11 | 12 | public class ClassUpdater extends BaseClient implements ClientResult { 13 | 14 | private WeaviateClass clazz; 15 | 16 | public ClassUpdater(HttpClient httpClient, Config config) { 17 | super(httpClient, config); 18 | } 19 | 20 | public ClassUpdater withClass(WeaviateClass clazz) { 21 | this.clazz = clazz; 22 | return this; 23 | } 24 | 25 | @Override 26 | public Result run() { 27 | String path = String.format("/schema/%s", UrlEncoder.encodePathParam(clazz.getClassName())); 28 | Response resp = sendPutRequest(path, clazz, WeaviateClass.class); 29 | return new Result<>(resp.getStatusCode(), resp.getStatusCode() == 200, resp.getErrors()); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/schema/api/SchemaGetter.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.schema.api; 2 | 3 | import io.weaviate.client.v1.schema.model.Schema; 4 | import io.weaviate.client.Config; 5 | import io.weaviate.client.base.BaseClient; 6 | import io.weaviate.client.base.ClientResult; 7 | import io.weaviate.client.base.Response; 8 | import io.weaviate.client.base.Result; 9 | import io.weaviate.client.base.http.HttpClient; 10 | 11 | public class SchemaGetter extends BaseClient implements ClientResult { 12 | 13 | public SchemaGetter(HttpClient httpClient, Config config) { 14 | super(httpClient, config); 15 | } 16 | 17 | @Override 18 | public Result run() { 19 | Response resp = sendGetRequest("/schema", Schema.class); 20 | return new Result<>(resp); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/schema/api/TenantsCreator.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.schema.api; 2 | 3 | import org.apache.hc.core5.http.HttpStatus; 4 | 5 | import io.weaviate.client.Config; 6 | import io.weaviate.client.base.BaseClient; 7 | import io.weaviate.client.base.ClientResult; 8 | import io.weaviate.client.base.Response; 9 | import io.weaviate.client.base.Result; 10 | import io.weaviate.client.base.http.HttpClient; 11 | import io.weaviate.client.base.util.UrlEncoder; 12 | import io.weaviate.client.v1.schema.model.Tenant; 13 | 14 | public class TenantsCreator extends BaseClient implements ClientResult { 15 | 16 | private String className; 17 | private Tenant[] tenants; 18 | 19 | public TenantsCreator(HttpClient httpClient, Config config) { 20 | super(httpClient, config); 21 | } 22 | 23 | public TenantsCreator withClassName(String className) { 24 | this.className = className; 25 | return this; 26 | } 27 | 28 | public TenantsCreator withTenants(Tenant... tenants) { 29 | this.tenants = tenants; 30 | return this; 31 | } 32 | 33 | @Override 34 | public Result run() { 35 | return createTenants(tenants); 36 | } 37 | 38 | private Result createTenants(Tenant[] tenants) { 39 | String path = String.format("/schema/%s/tenants", UrlEncoder.encodePathParam(className)); 40 | Response resp = sendPostRequest(path, tenants, Tenant[].class); 41 | return new Result<>(resp.getStatusCode(), resp.getStatusCode() == HttpStatus.SC_OK, resp.getErrors()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/schema/api/TenantsDeleter.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.schema.api; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.base.BaseClient; 5 | import io.weaviate.client.base.ClientResult; 6 | import io.weaviate.client.base.Response; 7 | import io.weaviate.client.base.Result; 8 | import io.weaviate.client.base.http.HttpClient; 9 | import io.weaviate.client.base.util.UrlEncoder; 10 | import org.apache.hc.core5.http.HttpStatus; 11 | 12 | public class TenantsDeleter extends BaseClient implements ClientResult { 13 | 14 | private String className; 15 | private String[] tenants; 16 | 17 | public TenantsDeleter(HttpClient httpClient, Config config) { 18 | super(httpClient, config); 19 | } 20 | 21 | public TenantsDeleter withClassName(String className) { 22 | this.className = className; 23 | return this; 24 | } 25 | 26 | public TenantsDeleter withTenants(String... tenants) { 27 | this.tenants = tenants; 28 | return this; 29 | } 30 | 31 | @Override 32 | public Result run() { 33 | String path = String.format("/schema/%s/tenants", UrlEncoder.encodePathParam(className)); 34 | Response resp = sendDeleteRequest(path, tenants, Object.class); 35 | return new Result<>(resp.getStatusCode(), resp.getStatusCode() == HttpStatus.SC_OK, resp.getErrors()); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/schema/api/TenantsExists.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.schema.api; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.base.BaseClient; 5 | import io.weaviate.client.base.ClientResult; 6 | import io.weaviate.client.base.Response; 7 | import io.weaviate.client.base.Result; 8 | import io.weaviate.client.base.http.HttpClient; 9 | import io.weaviate.client.base.util.UrlEncoder; 10 | import org.apache.hc.core5.http.HttpStatus; 11 | 12 | public class TenantsExists extends BaseClient implements ClientResult { 13 | 14 | private String className; 15 | private String tenant; 16 | 17 | public TenantsExists(HttpClient httpClient, Config config) { 18 | super(httpClient, config); 19 | } 20 | 21 | public TenantsExists withClassName(String className) { 22 | this.className = className; 23 | return this; 24 | } 25 | 26 | public TenantsExists withTenant(String tenant) { 27 | this.tenant = tenant; 28 | return this; 29 | } 30 | 31 | @Override 32 | public Result run() { 33 | String path = String.format("/schema/%s/tenants/%s", UrlEncoder.encodePathParam(className), UrlEncoder.encodePathParam(tenant)); 34 | Response resp = sendHeadRequest(path, Object.class); 35 | return new Result<>(resp.getStatusCode(), resp.getStatusCode() == HttpStatus.SC_OK, resp.getErrors()); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/schema/api/TenantsGetter.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.schema.api; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.base.BaseClient; 5 | import io.weaviate.client.base.ClientResult; 6 | import io.weaviate.client.base.Response; 7 | import io.weaviate.client.base.Result; 8 | import io.weaviate.client.base.http.HttpClient; 9 | import io.weaviate.client.base.util.UrlEncoder; 10 | import io.weaviate.client.v1.schema.model.Tenant; 11 | 12 | import java.util.Arrays; 13 | import java.util.List; 14 | import java.util.Optional; 15 | 16 | public class TenantsGetter extends BaseClient implements ClientResult> { 17 | 18 | private String className; 19 | 20 | public TenantsGetter(HttpClient httpClient, Config config) { 21 | super(httpClient, config); 22 | } 23 | 24 | public TenantsGetter withClassName(String className) { 25 | this.className = className; 26 | return this; 27 | } 28 | 29 | @Override 30 | public Result> run() { 31 | String path = String.format("/schema/%s/tenants", UrlEncoder.encodePathParam(className)); 32 | Response resp = sendGetRequest(path, Tenant[].class); 33 | 34 | List tenants = Optional.ofNullable(resp.getBody()) 35 | .map(Arrays::asList) 36 | .orElse(null); 37 | return new Result<>(resp.getStatusCode(), tenants, resp.getErrors()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/schema/model/ActivityStatus.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.schema.model; 2 | 3 | public interface ActivityStatus { 4 | @Deprecated 5 | String WARM = "WARM"; 6 | String HOT = "HOT"; 7 | String COLD = "COLD"; 8 | String FROZEN = "FROZEN"; 9 | String FREEZING = "FREEZING"; 10 | String UNFREEZING = "UNFREEZING"; 11 | String ACTIVE = "ACTIVE"; 12 | String INACTIVE = "INACTIVE"; 13 | String OFFLOADED = "OFFLOADED"; 14 | String OFFLOADING = "OFFLOADING"; 15 | String ONLOADING = "ONLOADING"; 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/schema/model/DataType.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.schema.model; 2 | 3 | public interface DataType { 4 | String CREF = "cref"; 5 | /** 6 | * As of Weaviate v1.19 'string' is deprecated and replaced by 'text'.
7 | * See data types 8 | */ 9 | @Deprecated 10 | String STRING = "string"; 11 | String TEXT = "text"; 12 | String INT = "int"; 13 | String NUMBER = "number"; 14 | String BOOLEAN = "boolean"; 15 | String DATE = "date"; 16 | String GEO_COORDINATES = "geoCoordinates"; 17 | String PHONE_NUMBER = "phoneNumber"; 18 | String UUID = "uuid"; 19 | String OBJECT = "object"; 20 | String BLOB = "blob"; 21 | 22 | /** 23 | * As of Weaviate v1.19 'string[]' is deprecated and replaced by 'text[]'.
24 | * See data types 25 | */ 26 | @Deprecated 27 | String STRING_ARRAY = "string[]"; 28 | String TEXT_ARRAY = "text[]"; 29 | String INT_ARRAY = "int[]"; 30 | String NUMBER_ARRAY = "number[]"; 31 | String BOOLEAN_ARRAY = "boolean[]"; 32 | String DATE_ARRAY = "date[]"; 33 | String UUID_ARRAY = "uuid[]"; 34 | String OBJECT_ARRAY = "object[]"; 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/schema/model/Property.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.schema.model; 2 | 3 | import java.util.List; 4 | import lombok.AccessLevel; 5 | import lombok.Builder; 6 | import lombok.EqualsAndHashCode; 7 | import lombok.Getter; 8 | import lombok.ToString; 9 | import lombok.experimental.FieldDefaults; 10 | 11 | @Getter 12 | @Builder 13 | @ToString 14 | @EqualsAndHashCode 15 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 16 | public class Property { 17 | String name; 18 | List dataType; 19 | String description; 20 | String tokenization; 21 | /** 22 | * As of Weaviate v1.19 'indexInverted' is deprecated and replaced by 'indexFilterable' 23 | * and 'indexSearchable'.
24 | * See inverted index 25 | */ 26 | @Deprecated 27 | Boolean indexInverted; 28 | Boolean indexFilterable; 29 | Boolean indexSearchable; 30 | Boolean indexRangeFilters; 31 | Object moduleConfig; 32 | List nestedProperties; 33 | 34 | 35 | @Getter 36 | @Builder 37 | @ToString 38 | @EqualsAndHashCode 39 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 40 | public static class NestedProperty { 41 | String name; 42 | List dataType; 43 | String description; 44 | String tokenization; 45 | Boolean indexFilterable; 46 | Boolean indexSearchable; 47 | Boolean indexRangeFilters; 48 | List nestedProperties; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/schema/model/Schema.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.schema.model; 2 | 3 | import java.util.List; 4 | import lombok.AccessLevel; 5 | import lombok.Builder; 6 | import lombok.EqualsAndHashCode; 7 | import lombok.Getter; 8 | import lombok.ToString; 9 | import lombok.experimental.FieldDefaults; 10 | 11 | @Getter 12 | @Builder 13 | @ToString 14 | @EqualsAndHashCode 15 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 16 | public class Schema { 17 | String name; 18 | String maintainer; 19 | List classes; 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/schema/model/Shard.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.schema.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @Builder 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 15 | public class Shard { 16 | String name; 17 | String status; 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/schema/model/ShardStatus.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.schema.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Builder 11 | @Getter 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 15 | public class ShardStatus { 16 | String status; 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/schema/model/ShardStatuses.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.schema.model; 2 | 3 | public interface ShardStatuses { 4 | String READONLY = "READONLY"; 5 | String READY = "READY"; 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/schema/model/Tenant.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.schema.model; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import lombok.experimental.FieldDefaults; 9 | 10 | @Getter 11 | @Builder 12 | @ToString 13 | @EqualsAndHashCode 14 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 15 | public class Tenant { 16 | String name; 17 | String activityStatus; 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/schema/model/Tokenization.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.schema.model; 2 | 3 | public interface Tokenization { 4 | String WORD = "word"; 5 | String FIELD = "field"; 6 | String WHITESPACE = "whitespace"; 7 | String LOWERCASE = "lowercase"; 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/users/OidcUsers.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.users; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.base.http.HttpClient; 5 | import io.weaviate.client.v1.users.api.RoleAssigner; 6 | import io.weaviate.client.v1.users.api.RoleRevoker; 7 | import io.weaviate.client.v1.users.api.common.AssignedRolesGetter; 8 | import lombok.RequiredArgsConstructor; 9 | 10 | @RequiredArgsConstructor 11 | public class OidcUsers { 12 | private static final String USER_TYPE = "oidc"; 13 | 14 | private final HttpClient httpClient; 15 | private final Config config; 16 | 17 | /** Assign a role to a user. Note that 'root' cannot be assigned. */ 18 | public RoleAssigner assigner() { 19 | return new RoleAssigner(httpClient, config, USER_TYPE); 20 | } 21 | 22 | /** Revoke a role from a user. Note that 'root' cannot be revoked. */ 23 | public RoleRevoker revoker() { 24 | return new RoleRevoker(httpClient, config, USER_TYPE); 25 | } 26 | 27 | /** Get roles assigned to a user. */ 28 | public AssignedRolesGetter userRolesGetter() { 29 | return new AssignedRolesGetter(httpClient, config, USER_TYPE); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/users/api/MyUserGetter.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.users.api; 2 | 3 | import java.util.Optional; 4 | 5 | import io.weaviate.client.Config; 6 | import io.weaviate.client.base.BaseClient; 7 | import io.weaviate.client.base.ClientResult; 8 | import io.weaviate.client.base.Response; 9 | import io.weaviate.client.base.Result; 10 | import io.weaviate.client.base.http.HttpClient; 11 | import io.weaviate.client.v1.users.model.User; 12 | 13 | public class MyUserGetter extends BaseClient implements ClientResult { 14 | public MyUserGetter(HttpClient httpClient, Config config) { 15 | super(httpClient, config); 16 | } 17 | 18 | @Override 19 | public Result run() { 20 | Response resp = sendGetRequest("/users/own-info", WeaviateUser.class); 21 | User user = Optional.ofNullable(resp.getBody()).map(WeaviateUser::toUser).orElse(null); 22 | return new Result<>(resp.getStatusCode(), user, resp.getErrors()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/users/api/WeaviateUser.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.users.api; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.stream.Collectors; 6 | 7 | import com.google.gson.annotations.SerializedName; 8 | 9 | import io.weaviate.client.v1.rbac.api.WeaviateRole; 10 | import io.weaviate.client.v1.users.model.User; 11 | 12 | public class WeaviateUser { 13 | @SerializedName("username") 14 | String username; 15 | 16 | @SerializedName("user_id") 17 | String id; 18 | 19 | @SerializedName("roles") 20 | List roles = new ArrayList<>(); 21 | 22 | public User toUser() { 23 | return new User( 24 | id != null ? id : username, 25 | roles != null 26 | ? roles.stream().map(WeaviateRole::toRole).collect(Collectors.toList()) 27 | : new ArrayList<>()); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/users/api/db/Activator.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.users.api.db; 2 | 3 | import org.apache.hc.core5.http.HttpStatus; 4 | 5 | import io.weaviate.client.Config; 6 | import io.weaviate.client.base.BaseClient; 7 | import io.weaviate.client.base.ClientResult; 8 | import io.weaviate.client.base.Result; 9 | import io.weaviate.client.base.http.HttpClient; 10 | 11 | public class Activator extends BaseClient implements ClientResult { 12 | private String userId; 13 | 14 | public Activator(HttpClient httpClient, Config config) { 15 | super(httpClient, config); 16 | } 17 | 18 | public Activator withUserId(String userId) { 19 | this.userId = userId; 20 | return this; 21 | } 22 | 23 | @Override 24 | public Result run() { 25 | return Result.voidToBoolean(sendPostRequest("/users/db/" + userId + "/activate", null, Void.class), 26 | HttpStatus.SC_CONFLICT); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/users/api/db/AllGetter.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.users.api.db; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | import io.weaviate.client.Config; 7 | import io.weaviate.client.base.BaseClient; 8 | import io.weaviate.client.base.ClientResult; 9 | import io.weaviate.client.base.Response; 10 | import io.weaviate.client.base.Result; 11 | import io.weaviate.client.base.http.HttpClient; 12 | import io.weaviate.client.v1.users.model.UserDb; 13 | 14 | public class AllGetter extends BaseClient implements ClientResult> { 15 | 16 | public AllGetter(HttpClient httpClient, Config config) { 17 | super(httpClient, config); 18 | } 19 | 20 | @Override 21 | public Result> run() { 22 | Response resp = sendGetRequest("/users/db", UserDb[].class); 23 | return new Result<>(resp.getStatusCode(), Arrays.asList(resp.getBody()), resp.getErrors()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/users/api/db/ByNameGetter.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.users.api.db; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.base.BaseClient; 5 | import io.weaviate.client.base.ClientResult; 6 | import io.weaviate.client.base.Result; 7 | import io.weaviate.client.base.http.HttpClient; 8 | import io.weaviate.client.v1.users.model.UserDb; 9 | 10 | public class ByNameGetter extends BaseClient implements ClientResult { 11 | private String userId; 12 | 13 | public ByNameGetter(HttpClient httpClient, Config config) { 14 | super(httpClient, config); 15 | } 16 | 17 | public ByNameGetter withUserId(String userId) { 18 | this.userId = userId; 19 | return this; 20 | } 21 | 22 | @Override 23 | public Result run() { 24 | return new Result<>(sendGetRequest("/users/db/" + userId, UserDb.class)); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/users/api/db/Creator.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.users.api.db; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | import io.weaviate.client.Config; 6 | import io.weaviate.client.base.BaseClient; 7 | import io.weaviate.client.base.ClientResult; 8 | import io.weaviate.client.base.Response; 9 | import io.weaviate.client.base.Result; 10 | import io.weaviate.client.base.http.HttpClient; 11 | import io.weaviate.client.v1.users.api.db.Creator.ApiKey; 12 | 13 | /** Creates a new 'db' user and returns its API key. */ 14 | public class Creator extends BaseClient implements ClientResult { 15 | private String userId; 16 | 17 | public Creator(HttpClient httpClient, Config config) { 18 | super(httpClient, config); 19 | } 20 | 21 | public Creator withUserId(String userId) { 22 | this.userId = userId; 23 | return this; 24 | } 25 | 26 | static class ApiKey { 27 | @SerializedName("apikey") 28 | String apiKey; 29 | } 30 | 31 | @Override 32 | public Result run() { 33 | Response resp = sendPostRequest("/users/db/" + userId, null, ApiKey.class); 34 | return new Result<>(resp, resp.getBody() != null ? resp.getBody().apiKey : null); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/users/api/db/Deactivator.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.users.api.db; 2 | 3 | import org.apache.hc.core5.http.HttpStatus; 4 | 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | import io.weaviate.client.Config; 8 | import io.weaviate.client.base.BaseClient; 9 | import io.weaviate.client.base.ClientResult; 10 | import io.weaviate.client.base.Result; 11 | import io.weaviate.client.base.http.HttpClient; 12 | import lombok.AllArgsConstructor; 13 | 14 | public class Deactivator extends BaseClient implements ClientResult { 15 | private String userId; 16 | private boolean revokeKey = false; 17 | 18 | public Deactivator(HttpClient httpClient, Config config) { 19 | super(httpClient, config); 20 | } 21 | 22 | public Deactivator withUserId(String userId) { 23 | this.userId = userId; 24 | return this; 25 | } 26 | 27 | public Deactivator revokeKey() { 28 | return revokeKey(true); 29 | } 30 | 31 | public Deactivator revokeKey(boolean revoke) { 32 | this.revokeKey = revoke; 33 | return this; 34 | } 35 | 36 | @AllArgsConstructor 37 | private class Body { 38 | @SerializedName("revoke_key") 39 | private boolean revokeKey; 40 | } 41 | 42 | @Override 43 | public Result run() { 44 | return Result.voidToBoolean(sendPostRequest("/users/db/" + userId + "/deactivate", new Body(revokeKey), Void.class), 45 | HttpStatus.SC_CONFLICT); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/users/api/db/Deleter.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.users.api.db; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.base.BaseClient; 5 | import io.weaviate.client.base.ClientResult; 6 | import io.weaviate.client.base.Result; 7 | import io.weaviate.client.base.http.HttpClient; 8 | 9 | public class Deleter extends BaseClient implements ClientResult { 10 | private String userId; 11 | 12 | public Deleter(HttpClient httpClient, Config config) { 13 | super(httpClient, config); 14 | } 15 | 16 | public Deleter withUserId(String userId) { 17 | this.userId = userId; 18 | return this; 19 | } 20 | 21 | @Override 22 | public Result run() { 23 | return Result.voidToBoolean(sendDeleteRequest("/users/db/" + userId, null, Void.class)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/users/api/db/KeyRotator.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.users.api.db; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | import io.weaviate.client.Config; 6 | import io.weaviate.client.base.BaseClient; 7 | import io.weaviate.client.base.ClientResult; 8 | import io.weaviate.client.base.Response; 9 | import io.weaviate.client.base.Result; 10 | import io.weaviate.client.base.http.HttpClient; 11 | import io.weaviate.client.v1.users.api.db.KeyRotator.ApiKey; 12 | 13 | public class KeyRotator extends BaseClient implements ClientResult { 14 | private String userId; 15 | 16 | public KeyRotator(HttpClient httpClient, Config config) { 17 | super(httpClient, config); 18 | } 19 | 20 | public KeyRotator withUserId(String userId) { 21 | this.userId = userId; 22 | return this; 23 | } 24 | 25 | static class ApiKey { 26 | @SerializedName("apikey") 27 | String apiKey; 28 | } 29 | 30 | @Override 31 | public Result run() { 32 | Response resp = sendPostRequest("/users/db/" + userId + "/rotate-key", null, ApiKey.class); 33 | return new Result<>(resp, resp.getBody().apiKey); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/users/model/User.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.users.model; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | import java.util.stream.Collectors; 7 | 8 | import io.weaviate.client.v1.rbac.model.Role; 9 | import lombok.Getter; 10 | 11 | @Getter 12 | public class User { 13 | String userId; 14 | Map roles = new HashMap<>(); 15 | 16 | public User(String id, List roles) { 17 | this.userId = id; 18 | this.roles = roles.stream().collect(Collectors.toMap(Role::getName, r -> r)); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/io/weaviate/client/v1/users/model/UserDb.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.users.model; 2 | 3 | import java.util.List; 4 | 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | import lombok.EqualsAndHashCode; 8 | import lombok.Getter; 9 | 10 | @Getter 11 | @EqualsAndHashCode 12 | public class UserDb { 13 | @SerializedName("roles") 14 | List roleNames; 15 | 16 | @SerializedName("userId") 17 | String userId; 18 | 19 | @SerializedName("dbUserType") 20 | String userType; 21 | 22 | @SerializedName("active") 23 | boolean active; 24 | } 25 | -------------------------------------------------------------------------------- /src/main/proto/v0/batch.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package weaviategrpc; 4 | 5 | option go_package = "github.com/weaviate/weaviate/grpc/generated;protocol"; 6 | option java_package = "io.weaviate.client.grpc.protocol.v0"; 7 | option java_outer_classname = "WeaviateProtoBatch"; 8 | 9 | message BatchObjectsRequest { 10 | } 11 | message BatchObjectsReply { 12 | } 13 | -------------------------------------------------------------------------------- /src/main/proto/v0/search_get.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package weaviategrpc; 4 | 5 | option go_package = "github.com/weaviate/weaviate/grpc/generated;protocol"; 6 | option java_package = "io.weaviate.client.grpc.protocol.v0"; 7 | option java_outer_classname = "WeaviateProtoSearchGet"; 8 | 9 | message SearchRequest { 10 | } 11 | message SearchReply { 12 | } 13 | -------------------------------------------------------------------------------- /src/main/proto/v0/weaviate.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package weaviategrpc; 4 | 5 | import "v0/batch.proto"; 6 | import "v0/search_get.proto"; 7 | 8 | option go_package = "github.com/weaviate/weaviate/grpc/generated;protocol"; 9 | option java_package = "io.weaviate.client.grpc.protocol.v0"; 10 | option java_outer_classname = "WeaviateProto"; 11 | 12 | service Weaviate { 13 | rpc Search(SearchRequest) returns (SearchReply) {}; 14 | rpc BatchObjects(BatchObjectsRequest) returns (BatchObjectsReply) {}; 15 | } 16 | -------------------------------------------------------------------------------- /src/main/proto/v1/batch_delete.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package weaviate.v1; 4 | 5 | import "v1/base.proto"; 6 | 7 | option go_package = "github.com/weaviate/weaviate/grpc/generated;protocol"; 8 | option java_package = "io.weaviate.client.grpc.protocol.v1"; 9 | option java_outer_classname = "WeaviateProtoBatchDelete"; 10 | 11 | message BatchDeleteRequest { 12 | string collection = 1; 13 | Filters filters = 2; 14 | bool verbose = 3; 15 | bool dry_run = 4; 16 | optional ConsistencyLevel consistency_level = 5; 17 | optional string tenant = 6; 18 | } 19 | 20 | message BatchDeleteReply { 21 | float took = 1; 22 | int64 failed = 2; 23 | int64 matches = 3; 24 | int64 successful = 4; 25 | repeated BatchDeleteObject objects = 5; 26 | } 27 | 28 | message BatchDeleteObject { 29 | bytes uuid = 1; 30 | bool successful = 2; 31 | optional string error = 3; // empty string means no error 32 | } 33 | -------------------------------------------------------------------------------- /src/main/proto/v1/tenants.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package weaviate.v1; 4 | 5 | option go_package = "github.com/weaviate/weaviate/grpc/generated;protocol"; 6 | option java_package = "io.weaviate.client.grpc.protocol.v1"; 7 | option java_outer_classname = "WeaviateProtoTenants"; 8 | 9 | enum TenantActivityStatus { 10 | TENANT_ACTIVITY_STATUS_UNSPECIFIED = 0; 11 | TENANT_ACTIVITY_STATUS_HOT = 1; 12 | TENANT_ACTIVITY_STATUS_COLD = 2; 13 | // Originally TENANT_ACTIVITY_STATUS_WARM = 3; 14 | reserved 3; 15 | TENANT_ACTIVITY_STATUS_FROZEN = 4; 16 | TENANT_ACTIVITY_STATUS_UNFREEZING = 5; 17 | TENANT_ACTIVITY_STATUS_FREEZING = 6; 18 | // not used yet - added to let the clients already add code to handle this in the future 19 | TENANT_ACTIVITY_STATUS_ACTIVE = 7; 20 | TENANT_ACTIVITY_STATUS_INACTIVE = 8; 21 | TENANT_ACTIVITY_STATUS_OFFLOADED = 9; 22 | TENANT_ACTIVITY_STATUS_OFFLOADING = 10; 23 | TENANT_ACTIVITY_STATUS_ONLOADING = 11; 24 | } 25 | 26 | message TenantsGetRequest { 27 | string collection = 1; 28 | // we might need to add a tenant-cursor api at some point, make this easily extendable 29 | oneof params { 30 | TenantNames names = 2; 31 | }; 32 | } 33 | 34 | message TenantNames { 35 | repeated string values = 1; 36 | 37 | } 38 | 39 | message TenantsGetReply { 40 | float took = 1; 41 | repeated Tenant tenants = 2; 42 | } 43 | 44 | message Tenant { 45 | string name = 1; 46 | TenantActivityStatus activity_status = 2; 47 | } 48 | -------------------------------------------------------------------------------- /src/main/proto/v1/weaviate.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package weaviate.v1; 4 | 5 | import "v1/aggregate.proto"; 6 | import "v1/batch.proto"; 7 | import "v1/batch_delete.proto"; 8 | import "v1/search_get.proto"; 9 | import "v1/tenants.proto"; 10 | 11 | option go_package = "github.com/weaviate/weaviate/grpc/generated;protocol"; 12 | option java_package = "io.weaviate.client.grpc.protocol.v1"; 13 | option java_outer_classname = "WeaviateProto"; 14 | 15 | service Weaviate { 16 | rpc Search(SearchRequest) returns (SearchReply) {}; 17 | rpc BatchObjects(BatchObjectsRequest) returns (BatchObjectsReply) {}; 18 | rpc BatchDelete(BatchDeleteRequest) returns (BatchDeleteReply) {}; 19 | rpc TenantsGet(TenantsGetRequest) returns (TenantsGetReply) {}; 20 | rpc Aggregate(AggregateRequest) returns (AggregateReply) {}; 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/io/weaviate/client/v1/batch/model/BatchReferenceResponseTest.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.batch.model; 2 | 3 | import com.google.gson.Gson; 4 | import java.io.BufferedReader; 5 | import java.io.File; 6 | import java.io.FileInputStream; 7 | import java.io.FileNotFoundException; 8 | import java.io.InputStreamReader; 9 | import junit.framework.TestCase; 10 | import org.junit.Assert; 11 | import org.junit.Test; 12 | 13 | public class BatchReferenceResponseTest extends TestCase { 14 | @Test 15 | public void testDeserialization() throws FileNotFoundException { 16 | // given 17 | File jsonFile = new File("src/test/resources/json/batch-reference-response.json"); 18 | InputStreamReader reader = new InputStreamReader(new FileInputStream(jsonFile)); 19 | // when 20 | BatchReferenceResponse[] resp = new Gson().fromJson(new BufferedReader(reader), BatchReferenceResponse[].class); 21 | // then 22 | Assert.assertNotNull(resp); 23 | Assert.assertEquals(4, resp.length); 24 | Assert.assertEquals("weaviate://localhost/Pizza/97fa5147-bdad-4d74-9a81-f8babc811b09/otherFoods", resp[0].getFrom()); 25 | Assert.assertEquals("weaviate://localhost/07473b34-0ab2-4120-882d-303d9e13f7af", resp[0].getTo()); 26 | Assert.assertEquals(BatchReferenceResponseStatus.SUCCESS, resp[0].getResult().getStatus()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/io/weaviate/client/v1/batch/util/ReferencesPathTest.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.batch.util; 2 | 3 | import com.jparams.junit4.JParamsTestRunner; 4 | import com.jparams.junit4.data.DataMethod; 5 | import org.junit.Test; 6 | import org.junit.runner.RunWith; 7 | import io.weaviate.client.v1.data.replication.model.ConsistencyLevel; 8 | 9 | import static org.assertj.core.api.Assertions.assertThat; 10 | 11 | @RunWith(JParamsTestRunner.class) 12 | public class ReferencesPathTest { 13 | 14 | private final ReferencesPath referencesPath = new ReferencesPath(); 15 | 16 | private static final ReferencesPath.Params EMPTY_PARAMS = ReferencesPath.Params.builder() 17 | .build(); 18 | private static final ReferencesPath.Params ALL_PARAMS = ReferencesPath.Params.builder() 19 | .consistencyLevel(ConsistencyLevel.QUORUM) 20 | .build(); 21 | 22 | 23 | @Test 24 | @DataMethod(source = ReferencesPathTest.class, method = "provideCreate") 25 | public void shouldBuildCreatePaths(ReferencesPath.Params params, String expectedPath) { 26 | assertThat(referencesPath.buildCreate(params)).isEqualTo(expectedPath); 27 | } 28 | 29 | public static Object[][] provideCreate() { 30 | return new Object[][]{ 31 | { 32 | EMPTY_PARAMS, 33 | "/batch/references" 34 | }, 35 | { 36 | ALL_PARAMS, 37 | "/batch/references?consistency_level=QUORUM" 38 | }, 39 | }; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/test/java/io/weaviate/client/v1/contextionary/model/C11yWordsResponseTest.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.contextionary.model; 2 | 3 | import com.google.gson.Gson; 4 | import java.io.BufferedReader; 5 | import java.io.File; 6 | import java.io.FileInputStream; 7 | import java.io.FileNotFoundException; 8 | import java.io.InputStreamReader; 9 | import junit.framework.TestCase; 10 | import org.junit.Assert; 11 | import org.junit.Test; 12 | 13 | public class C11yWordsResponseTest extends TestCase { 14 | @Test 15 | public void testDeserialization() throws FileNotFoundException { 16 | // given 17 | File jsonFile = new File("src/test/resources/json/c11y-concepts.json"); 18 | InputStreamReader reader = new InputStreamReader(new FileInputStream(jsonFile)); 19 | // when 20 | C11yWordsResponse resp = new Gson().fromJson(new BufferedReader(reader), C11yWordsResponse.class); 21 | // then 22 | Assert.assertNotNull(resp); 23 | Assert.assertEquals("pizzaHawaii", resp.getConcatenatedWord().getConcatenatedWord()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/test/java/io/weaviate/client/v1/data/model/ObjectsListResponseTest.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.data.model; 2 | 3 | import com.google.gson.Gson; 4 | import java.io.File; 5 | import java.io.FileInputStream; 6 | import java.io.FileNotFoundException; 7 | import java.io.InputStreamReader; 8 | import junit.framework.TestCase; 9 | import org.junit.Assert; 10 | import org.junit.Test; 11 | 12 | public class ObjectsListResponseTest extends TestCase { 13 | @Test 14 | public void testDeserialization() throws FileNotFoundException { 15 | // given 16 | File jsonFile = new File("src/test/resources/json/objects-list-response.json"); 17 | InputStreamReader reader = new InputStreamReader(new FileInputStream(jsonFile)); 18 | // when 19 | ObjectsListResponse resp = new Gson().fromJson(reader, ObjectsListResponse.class); 20 | // then 21 | Assert.assertNotNull(resp); 22 | Assert.assertNotNull(resp.getObjects()); 23 | Assert.assertEquals(4, resp.getObjects().length); 24 | Assert.assertEquals(4, resp.getTotalResults()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/java/io/weaviate/client/v1/graphql/query/argument/Bm25ArgumentTest.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.query.argument; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.assertj.core.api.Assertions.assertThat; 6 | 7 | public class Bm25ArgumentTest { 8 | 9 | @Test 10 | public void shouldCreateArgument() { 11 | Bm25Argument bm25 = Bm25Argument.builder() 12 | .query("I'm a simple string") 13 | .build(); 14 | 15 | String str = bm25.build(); 16 | 17 | assertThat(str).isEqualTo("bm25:{query:\"I'm a simple string\"}"); 18 | } 19 | 20 | @Test 21 | public void shouldCreateArgumentWithProperties() { 22 | Bm25Argument bm25 = Bm25Argument.builder() 23 | .query("I'm a simple string") 24 | .properties(new String[]{"prop1", "prop2"}) 25 | .build(); 26 | 27 | String str = bm25.build(); 28 | 29 | assertThat(str).isEqualTo("bm25:{query:\"I'm a simple string\" " + 30 | "properties:[\"prop1\",\"prop2\"]}"); 31 | } 32 | 33 | @Test 34 | public void shouldCreateArgumentWithChars() { 35 | Bm25Argument bm25 = Bm25Argument.builder() 36 | .query("\"I'm a complex string\" says the {'`:string:`'}") 37 | .properties(new String[]{"prop:\"'`{0}`'\""}) 38 | .build(); 39 | 40 | String str = bm25.build(); 41 | 42 | assertThat(str).isEqualTo("bm25:{query:\"\\\"I'm a complex string\\\" says the {'`:string:`'}\" " + 43 | "properties:[\"prop:\\\"'`{0}`'\\\"\"]}"); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/test/java/io/weaviate/client/v1/graphql/query/argument/GroupByArgumentTest.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.query.argument; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | import static org.junit.Assert.assertNotNull; 5 | import org.junit.Test; 6 | 7 | public class GroupByArgumentTest { 8 | 9 | @Test 10 | public void testBuild() { 11 | // given 12 | // when 13 | String arg = GroupByArgument.builder() 14 | .path(new String[]{ "path" }) 15 | .groups(1) 16 | .objectsPerGroup(2).build().build(); 17 | // then 18 | assertNotNull(arg); 19 | assertEquals("groupBy:{path:[\"path\"] groups:1 objectsPerGroup:2}", arg); 20 | } 21 | 22 | @Test 23 | public void testBuildOnlyPath() { 24 | // given 25 | // when 26 | String arg = GroupByArgument.builder() 27 | .path(new String[]{ "path" }) 28 | .build().build(); 29 | // then 30 | assertNotNull(arg); 31 | assertEquals("groupBy:{path:[\"path\"]}", arg); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/io/weaviate/client/v1/graphql/query/argument/NearMediaTargetsArgument.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.query.argument; 2 | 3 | class NearMediaTargetsArgument { 4 | } 5 | -------------------------------------------------------------------------------- /src/test/java/io/weaviate/client/v1/graphql/query/argument/SortArgumentTest.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.query.argument; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertEquals; 6 | import static org.junit.Assert.assertNotNull; 7 | 8 | public class SortArgumentTest { 9 | 10 | @Test 11 | public void testBuild() { 12 | // given 13 | // when 14 | String arg = SortArgument.builder().path(new String[]{ "property" }).order(SortOrder.asc).build().build(); 15 | // then 16 | assertNotNull(arg); 17 | assertEquals("{path:[\"property\"] order:asc}", arg); 18 | } 19 | 20 | @Test 21 | public void testBuildWithoutOrder() { 22 | // given 23 | // when 24 | String arg = SortArgument.builder().path(new String[]{ "property" }).build().build(); 25 | // then 26 | assertNotNull(arg); 27 | assertEquals("{path:[\"property\"]}", arg); 28 | } 29 | 30 | @Test 31 | public void testBuildWithoutAll() { 32 | // given 33 | // when 34 | String arg = SortArgument.builder().build().build(); 35 | // then 36 | assertNotNull(arg); 37 | // builder will return a faulty nearObject arg in order for Weaviate to error 38 | // so that user will know that something was wrong 39 | assertEquals("{}", arg); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/test/java/io/weaviate/client/v1/graphql/query/fields/FieldsTest.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.graphql.query.fields; 2 | 3 | import junit.framework.TestCase; 4 | import org.junit.Assert; 5 | import org.junit.Test; 6 | 7 | public class FieldsTest extends TestCase { 8 | 9 | @Test 10 | public void testBuild() { 11 | // given 12 | String expected = "a b c"; 13 | Field a = Field.builder().name("a").build(); 14 | Field b = Field.builder().name("b").build(); 15 | Field c = Field.builder().name("c").build(); 16 | Fields fields = Fields.builder().fields(new Field[]{ a, b, c }).build(); 17 | // when 18 | String fieldsParameter = fields.build(); 19 | // then 20 | Assert.assertEquals(expected, fieldsParameter); 21 | } 22 | 23 | @Test 24 | public void testBuildNested() { 25 | // given 26 | String expected = "a{b} c{d{e}}"; 27 | Field b = Field.builder().name("b").build(); 28 | Field a = Field.builder() 29 | .name("a") 30 | .fields(new Field[]{b}) 31 | .build(); 32 | Field c = Field.builder() 33 | .name("c") 34 | .fields(new Field[]{Field.builder() 35 | .name("d") 36 | .fields(new Field[]{Field.builder().name("e").build()}) 37 | .build()}).build(); 38 | Fields fields = Fields.builder().fields(new Field[]{ a, c }).build(); 39 | // when 40 | String fieldsParameter = fields.build(); 41 | // then 42 | Assert.assertEquals(expected, fieldsParameter); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/test/java/io/weaviate/client/v1/schema/model/PropertyTest.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.client.v1.schema.model; 2 | 3 | import com.google.gson.GsonBuilder; 4 | import java.util.Arrays; 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | import junit.framework.TestCase; 8 | import org.junit.Test; 9 | 10 | public class PropertyTest extends TestCase { 11 | 12 | @Test 13 | public void testSerialize() { 14 | // given 15 | Map text2vecContextionary = new HashMap<>(); 16 | text2vecContextionary.put("vectorizePropertyName", false); 17 | Map moduleConfig = new HashMap<>(); 18 | moduleConfig.put("text2vec-contextionary", text2vecContextionary); 19 | Property priceProperty = Property.builder() 20 | .dataType(Arrays.asList(DataType.NUMBER)) 21 | .description("price") 22 | .name("price") 23 | .moduleConfig(moduleConfig) 24 | .build(); 25 | String expected = "{\"name\":\"price\",\"dataType\":[\"number\"],\"description\":\"price\"," + 26 | "\"moduleConfig\":{\"text2vec-contextionary\":{\"vectorizePropertyName\":false}}}"; 27 | // when 28 | String result = new GsonBuilder().create().toJson(priceProperty); 29 | // then 30 | assertNotNull(result); 31 | assertEquals(expected, result); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/io/weaviate/integration/client/WeaviateDockerImage.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.integration.client; 2 | 3 | public class WeaviateDockerImage { 4 | 5 | public static final String WEAVIATE_DOCKER_IMAGE = String.format("semitechnologies/weaviate:%s", WeaviateVersion.WEAVIATE_IMAGE); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/test/java/io/weaviate/integration/client/WeaviateVersion.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.integration.client; 2 | 3 | public class WeaviateVersion { 4 | 5 | // docker image version 6 | public static final String WEAVIATE_IMAGE = "1.31.0-rc.0-5ff7495"; 7 | 8 | // to be set according to weaviate docker image 9 | public static final String EXPECTED_WEAVIATE_VERSION = "1.31.0-rc.0"; 10 | // to be set according to weaviate docker image 11 | public static final String EXPECTED_WEAVIATE_GIT_HASH = "5ff7495"; 12 | 13 | private WeaviateVersion() {} 14 | } 15 | -------------------------------------------------------------------------------- /src/test/java/io/weaviate/integration/client/WeaviateWithAzureContainer.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.integration.client; 2 | 3 | import org.testcontainers.containers.wait.strategy.Wait; 4 | import org.testcontainers.weaviate.WeaviateContainer; 5 | 6 | public class WeaviateWithAzureContainer extends WeaviateContainer { 7 | 8 | public WeaviateWithAzureContainer(String dockerImageName) { 9 | super(dockerImageName); 10 | 11 | waitingFor(Wait.forHttp("/v1/.well-known/openid-configuration").forPort(8080).forStatusCode(200)); 12 | withEnv("AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED", "false"); 13 | withEnv("AUTHENTICATION_OIDC_ENABLED", "true"); 14 | withEnv("AUTHENTICATION_OIDC_CLIENT_ID", "4706508f-30c2-469b-8b12-ad272b3de864"); 15 | withEnv("AUTHENTICATION_OIDC_ISSUER", "https://login.microsoftonline.com/36c47fb4-f57c-4e1c-8760-d42293932cc2/v2.0"); 16 | withEnv("AUTHENTICATION_OIDC_USERNAME_CLAIM", "oid"); 17 | withEnv("AUTHENTICATION_OIDC_GROUPS_CLAIM", "groups"); 18 | withEnv("AUTHORIZATION_ADMINLIST_ENABLED", "true"); 19 | withEnv("AUTHORIZATION_ADMINLIST_USERS", "b6bf8e1d-d398-4e5d-8f1b-50fda9146a64"); 20 | withEnv("AUTHENTICATION_OIDC_SCOPES", ""); 21 | withEnv("DISABLE_TELEMETRY", "true"); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/io/weaviate/integration/client/WeaviateWithOidcContainer.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.integration.client; 2 | 3 | import org.testcontainers.containers.wait.strategy.Wait; 4 | import org.testcontainers.weaviate.WeaviateContainer; 5 | 6 | public class WeaviateWithOidcContainer extends WeaviateContainer { 7 | 8 | public WeaviateWithOidcContainer(String dockerImageName) { 9 | super(dockerImageName); 10 | 11 | waitingFor(Wait.forHttp("/v1/.well-known/openid-configuration").forPort(8080).forStatusCode(200)); 12 | withEnv("AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED", "false"); 13 | withEnv("AUTHENTICATION_OIDC_ENABLED", "true"); 14 | withEnv("AUTHENTICATION_OIDC_CLIENT_ID", "wcs"); 15 | withEnv("AUTHENTICATION_OIDC_ISSUER", "https://auth.wcs.api.weaviate.io/auth/realms/SeMI"); 16 | withEnv("AUTHENTICATION_OIDC_USERNAME_CLAIM", "email"); 17 | withEnv("AUTHENTICATION_OIDC_GROUPS_CLAIM", "groups"); 18 | withEnv("AUTHORIZATION_ADMINLIST_ENABLED", "true"); 19 | withEnv("AUTHORIZATION_ADMINLIST_USERS", "oidc-test-user@weaviate.io"); 20 | withEnv("AUTHENTICATION_OIDC_SCOPES", "openid,email"); 21 | withEnv("AUTHENTICATION_APIKEY_ENABLED", "true"); 22 | withEnv("AUTHENTICATION_APIKEY_ALLOWED_KEYS", "my-secret-key"); 23 | withEnv("AUTHENTICATION_APIKEY_USERS", "oidc-test-user@weaviate.io"); 24 | withEnv("DISABLE_TELEMETRY", "true"); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/java/io/weaviate/integration/client/WeaviateWithOktaCcContainer.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.integration.client; 2 | 3 | import org.testcontainers.containers.wait.strategy.Wait; 4 | import org.testcontainers.weaviate.WeaviateContainer; 5 | 6 | public class WeaviateWithOktaCcContainer extends WeaviateContainer { 7 | 8 | public WeaviateWithOktaCcContainer(String dockerImageName) { 9 | super(dockerImageName); 10 | 11 | waitingFor(Wait.forHttp("/v1/.well-known/openid-configuration").forPort(8080).forStatusCode(200)); 12 | withEnv("AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED", "false"); 13 | withEnv("AUTHENTICATION_OIDC_ENABLED", "true"); 14 | withEnv("AUTHENTICATION_OIDC_CLIENT_ID", "0oa7e9ipdkVZRUcxo5d7"); 15 | withEnv("AUTHENTICATION_OIDC_ISSUER", "https://dev-32300990.okta.com/oauth2/aus7e9kxbwYQB0eht5d7"); 16 | withEnv("AUTHENTICATION_OIDC_USERNAME_CLAIM", "cid"); 17 | withEnv("AUTHENTICATION_OIDC_GROUPS_CLAIM", "groups"); 18 | withEnv("AUTHORIZATION_ADMINLIST_ENABLED", "true"); 19 | withEnv("AUTHORIZATION_ADMINLIST_USERS", "0oa7e9ipdkVZRUcxo5d7"); 20 | withEnv("AUTHENTICATION_OIDC_SCOPES", ""); 21 | withEnv("DISABLE_TELEMETRY", "true"); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/io/weaviate/integration/client/WeaviateWithOktaUsersContainer.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.integration.client; 2 | 3 | import org.testcontainers.containers.wait.strategy.Wait; 4 | import org.testcontainers.weaviate.WeaviateContainer; 5 | 6 | public class WeaviateWithOktaUsersContainer extends WeaviateContainer { 7 | 8 | public WeaviateWithOktaUsersContainer(String dockerImageName) { 9 | super(dockerImageName); 10 | 11 | waitingFor(Wait.forHttp("/v1/.well-known/openid-configuration").forPort(8080).forStatusCode(200)); 12 | withEnv("AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED", "false"); 13 | withEnv("AUTHENTICATION_OIDC_ENABLED", "true"); 14 | withEnv("AUTHENTICATION_OIDC_CLIENT_ID", "0oa7iz2g41rNxv95B5d7"); 15 | withEnv("AUTHENTICATION_OIDC_ISSUER", "https://dev-32300990.okta.com/oauth2/aus7iz3tna3kckRWS5d7"); 16 | withEnv("AUTHENTICATION_OIDC_USERNAME_CLAIM", "sub"); 17 | withEnv("AUTHENTICATION_OIDC_GROUPS_CLAIM", "groups"); 18 | withEnv("AUTHORIZATION_ADMINLIST_ENABLED", "true"); 19 | withEnv("AUTHORIZATION_ADMINLIST_USERS", "test@test.de"); 20 | withEnv("AUTHENTICATION_OIDC_SCOPES", "openid,email"); 21 | withEnv("DISABLE_TELEMETRY", "true"); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/io/weaviate/integration/client/misc/ClientMiscTest.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.integration.client.misc; 2 | 3 | import io.weaviate.client.Config; 4 | import io.weaviate.client.WeaviateClient; 5 | import io.weaviate.client.base.Result; 6 | import io.weaviate.client.v1.misc.model.Meta; 7 | import io.weaviate.integration.client.WeaviateDockerCompose; 8 | import io.weaviate.integration.tests.misc.MiscTestSuite; 9 | import org.junit.Before; 10 | import org.junit.ClassRule; 11 | import org.junit.Test; 12 | 13 | public class ClientMiscTest { 14 | 15 | private WeaviateClient client; 16 | 17 | @ClassRule 18 | public static WeaviateDockerCompose compose = new WeaviateDockerCompose(); 19 | 20 | @Before 21 | public void before() { 22 | Config config = new Config("http", compose.getHttpHostAddress()); 23 | client = new WeaviateClient(config); 24 | } 25 | 26 | @Test 27 | public void testMiscLivenessEndpoint() { 28 | // when 29 | Result livenessCheck = client.misc().liveChecker().run(); 30 | // then 31 | MiscTestSuite.assertLivenessOrReadiness(livenessCheck); 32 | } 33 | 34 | @Test 35 | public void testMiscReadinessEndpoint() { 36 | // when 37 | Result readinessCheck = client.misc().readyChecker().run(); 38 | // then 39 | MiscTestSuite.assertLivenessOrReadiness(readinessCheck); 40 | } 41 | 42 | @Test 43 | public void testMiscMetaEndpoint() { 44 | // when 45 | Result meta = client.misc().metaGetter().run(); 46 | // then 47 | MiscTestSuite.assertMeta(meta); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/test/java/io/weaviate/integration/tests/misc/MiscTestSuite.java: -------------------------------------------------------------------------------- 1 | package io.weaviate.integration.tests.misc; 2 | 3 | import io.weaviate.client.base.Result; 4 | import io.weaviate.client.v1.misc.model.Meta; 5 | import static io.weaviate.integration.client.WeaviateVersion.EXPECTED_WEAVIATE_VERSION; 6 | import static org.junit.Assert.assertEquals; 7 | import static org.junit.Assert.assertNotNull; 8 | import static org.junit.Assert.assertNull; 9 | import static org.junit.Assert.assertTrue; 10 | 11 | public class MiscTestSuite { 12 | public static void assertLivenessOrReadiness(Result result) { 13 | assertNotNull(result); 14 | assertTrue(result.getResult()); 15 | } 16 | 17 | public static void assertMeta(Result meta) { 18 | assertNotNull(meta); 19 | assertNull(meta.getError()); 20 | assertEquals("http://[::]:8080", meta.getResult().getHostname()); 21 | assertEquals(EXPECTED_WEAVIATE_VERSION, meta.getResult().getVersion()); 22 | assertEquals("{backup-filesystem={backupsPath=/tmp/backups}, " + 23 | "generative-openai={documentationHref=https://platform.openai.com/docs/api-reference/completions, name=Generative Search - OpenAI}, " + 24 | "text2vec-contextionary={version=en0.16.0-v1.2.1, wordCount=818072.0}}", meta.getResult().getModules().toString()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/resources/docker-compose-proxy.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | version: '3.4' 3 | services: 4 | weaviate: 5 | command: 6 | - --host 7 | - 0.0.0.0 8 | - --port 9 | - '8080' 10 | - --scheme 11 | - http 12 | image: semitechnologies/weaviate:1.25.0 13 | restart: on-failure:0 14 | environment: 15 | LOG_LEVEL: "debug" 16 | QUERY_DEFAULTS_LIMIT: 25 17 | AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true' 18 | PERSISTENCE_DATA_PATH: "./data" 19 | VIRTUAL_HOST: weaviate.local 20 | VIRTUAL_PORT: 8080 21 | DISABLE_TELEMETRY: 'true' 22 | proxy: 23 | image: nginxproxy/nginx-proxy:alpine 24 | volumes: 25 | - /var/run/docker.sock:/tmp/docker.sock:ro 26 | ... 27 | -------------------------------------------------------------------------------- /src/test/resources/image/base64.txt: -------------------------------------------------------------------------------- 1 | iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAABhGlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV/TSou0ONhBxCFD62RBVMRRq1CECqFWaNXB5NIvaNKSpLg4Cq4FBz8Wqw4uzro6uAqC4AeIm5uToouU+L+k0CLGg+N+vLv3uHsHCK0q08zAOKDplpFJJcVcflUMviKACEKIwy8zsz4nSWl4jq97+Ph6l+BZ3uf+HBG1YDLAJxLPsrphEW8QT29adc77xFFWllXic+Ixgy5I/Mh1xeU3ziWHBZ4ZNbKZeeIosVjqYaWHWdnQiKeIY6qmU76Qc1nlvMVZqzZY5578heGCvrLMdZojSGERS5AgQkEDFVRhIUGrToqJDO0nPfzDjl8il0KuChg5FlCDBtnxg//B727N4uSEmxROAn0vtv0RB4K7QLtp29/Htt0+AfzPwJXe9ddawMwn6c2uFjsCBraBi+uupuwBlzvA0FNdNmRH8tMUikXg/Yy+KQ8M3gL9a25vnX2cPgBZ6ip9AxwcAqMlyl73eHeot7d/z3T6+wEPO3J/B8olWgAAAAlwSFlzAAAuIwAALiMBeKU/dgAAAAd0SU1FB+UEDQgmFS2naPsAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAADElEQVQI12NgYGAAAAAEAAEnNCcKAAAAAElFTkSuQmCC -------------------------------------------------------------------------------- /src/test/resources/image/pixel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/java-client/03cf63d6f0ebf486387166cbc3b3b6473a29dd71/src/test/resources/image/pixel.png -------------------------------------------------------------------------------- /src/test/resources/json/batch-reference-response.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "from": "weaviate://localhost/Pizza/97fa5147-bdad-4d74-9a81-f8babc811b09/otherFoods", 4 | "to": "weaviate://localhost/07473b34-0ab2-4120-882d-303d9e13f7af", 5 | "result": { 6 | "status": "SUCCESS" 7 | } 8 | }, 9 | { 10 | "from": "weaviate://localhost/Pizza/97fa5147-bdad-4d74-9a81-f8babc811b09/otherFoods", 11 | "to": "weaviate://localhost/97fa5147-bdad-4d74-9a81-f8babc811b09", 12 | "result": { 13 | "status": "SUCCESS" 14 | } 15 | }, 16 | { 17 | "from": "weaviate://localhost/Soup/07473b34-0ab2-4120-882d-303d9e13f7af/otherFoods", 18 | "to": "weaviate://localhost/97fa5147-bdad-4d74-9a81-f8babc811b09", 19 | "result": { 20 | "status": "SUCCESS" 21 | } 22 | }, 23 | { 24 | "from": "weaviate://localhost/Soup/07473b34-0ab2-4120-882d-303d9e13f7af/otherFoods", 25 | "to": "weaviate://localhost/07473b34-0ab2-4120-882d-303d9e13f7af", 26 | "result": { 27 | "status": "SUCCESS" 28 | } 29 | } 30 | ] -------------------------------------------------------------------------------- /src/test/resources/json/graphql-response.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": { 3 | "Get": { 4 | "Soup": [ 5 | { 6 | "_additional": { 7 | "certainty": 0.9999998211860657 8 | }, 9 | "name": "JustSoup" 10 | } 11 | ] 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/json/nested-one-object.json: -------------------------------------------------------------------------------- 1 | { 2 | "firstName": "John", 3 | "lastName": "Smith", 4 | "profession": "Software Engineer", 5 | "description": "Experienced software engineer with a passion for coding and problem-solving.", 6 | "phoneAsObject": { 7 | "input": "020 1234567", 8 | "defaultCountry": "us" 9 | }, 10 | "locationAsObject": { 11 | "latitude": 52.366667, 12 | "longitude": 4.9 13 | }, 14 | "city": "New York" 15 | } 16 | -------------------------------------------------------------------------------- /src/test/resources/json/object2.json: -------------------------------------------------------------------------------- 1 | { 2 | "class": "Soup", 3 | "creationTimeUnix": 1617889812387, 4 | "id": "07473b34-0ab2-4120-882d-303d9e13f7af", 5 | "properties": { 6 | "description": "Putting the game of letter soups to a whole new level.", 7 | "name": "Beautiful", 8 | "otherFoods": [ 9 | { 10 | "beacon": "weaviate://localhost/97fa5147-bdad-4d74-9a81-f8babc811b09", 11 | "href": "/v1/objects/97fa5147-bdad-4d74-9a81-f8babc811b09" 12 | }, 13 | { 14 | "beacon": "weaviate://localhost/07473b34-0ab2-4120-882d-303d9e13f7af", 15 | "href": "/v1/objects/07473b34-0ab2-4120-882d-303d9e13f7af" 16 | } 17 | ] 18 | }, 19 | "vectorWeights": null 20 | } -------------------------------------------------------------------------------- /src/test/resources/json/objects-list-response.json: -------------------------------------------------------------------------------- 1 | { 2 | "deprecations": null, 3 | "objects": [ 4 | { 5 | "class": "Pizza", 6 | "creationTimeUnix": 1617828214945, 7 | "id": "302ae446-435c-471e-a434-f84bfb10b2b0", 8 | "lastUpdateTimeUnix": 1617828214945, 9 | "properties": { 10 | "description": "meat", 11 | "name": "Pepperoni" 12 | }, 13 | "vectorWeights": null 14 | }, 15 | { 16 | "class": "Pizza", 17 | "creationTimeUnix": 1617828214916, 18 | "id": "5314ade4-61b6-48a8-b4b9-a89310693a63", 19 | "lastUpdateTimeUnix": 1617828214916, 20 | "properties": { 21 | "description": "plain", 22 | "name": "Margherita" 23 | }, 24 | "vectorWeights": null 25 | }, 26 | { 27 | "class": "Soup", 28 | "creationTimeUnix": 1617828215003, 29 | "id": "2b6de69f-4eb7-45df-8a0a-2bb951bb0d0e", 30 | "lastUpdateTimeUnix": 1617828215003, 31 | "properties": { 32 | "description": "vegetarian", 33 | "name": "Tofu" 34 | }, 35 | "vectorWeights": null 36 | }, 37 | { 38 | "class": "Soup", 39 | "creationTimeUnix": 1617828214974, 40 | "id": "7f2d3d76-1a74-4563-bd4e-18f5f50facdf", 41 | "lastUpdateTimeUnix": 1617828214974, 42 | "properties": { 43 | "description": "plain", 44 | "name": "Chicken" 45 | }, 46 | "vectorWeights": null 47 | } 48 | ], 49 | "totalResults": 4 50 | } -------------------------------------------------------------------------------- /src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /tools/prepare_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | VERSION=${1-} 6 | REQUIRED_TOOLS="sed git mvn" 7 | 8 | if test -z "$VERSION"; then 9 | echo "Missing version parameter. Usage: $0 VERSION" 10 | exit 1 11 | fi 12 | 13 | for tool in $REQUIRED_TOOLS; do 14 | if ! hash "$tool" 2>/dev/null; then 15 | echo "This script requires '$tool', but it is not installed." 16 | exit 1 17 | fi 18 | done 19 | 20 | if git rev-parse "$VERSION" >/dev/null 2>&1; then 21 | echo "Cannot prepare release, a release for $VERSION already exists" 22 | exit 1 23 | fi 24 | 25 | next_version="" 26 | if [[ "$VERSION" =~ "alpha" ]]; then 27 | next_version=$(echo "$VERSION" | sed 's/-.*//') 28 | fi 29 | 30 | mvn versions:set -DnewVersion=$VERSION versions:commit 31 | sed -i '' "s/^\([[:blank:]]*\).*/\1$VERSION<\/tag>/" pom.xml 32 | sed -i '' "s/^\([[:blank:]]*\).*/\1$VERSION<\/version>/" README.md 33 | 34 | git commit -a -m "Release $VERSION version" 35 | git tag -a "$VERSION" -m "$VERSION" 36 | 37 | if [[ "$next_version" != "" ]]; then 38 | mvn versions:set -DnewVersion="$next_version-SNAPSHOT" versions:commit 39 | else 40 | mvn versions:set -DnextSnapshot=true versions:commit 41 | fi 42 | 43 | git commit -a -m "Update version to next snapshot version" 44 | --------------------------------------------------------------------------------