/// <summary>Snippet for StreamingReadFeatureValues</summary> public async Task StreamingReadFeatureValuesRequestObject() { // Snippet: StreamingReadFeatureValues(StreamingReadFeatureValuesRequest, CallSettings) // Create client FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = FeaturestoreOnlineServingServiceClient.Create(); // Initialize request argument(s) StreamingReadFeatureValuesRequest request = new StreamingReadFeatureValuesRequest { EntityTypeAsEntityTypeName = EntityTypeName.FromProjectLocationFeaturestoreEntityType("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"), EntityIds = { "", }, FeatureSelector = new FeatureSelector(), }; // Make the request, returning a streaming response FeaturestoreOnlineServingServiceClient.StreamingReadFeatureValuesStream response = featurestoreOnlineServingServiceClient.StreamingReadFeatureValues(request); // Read streaming responses from server until complete // Note that C# 8 code can use await foreach AsyncResponseStream <ReadFeatureValuesResponse> responseStream = response.GetResponseStream(); while (await responseStream.MoveNextAsync()) { ReadFeatureValuesResponse responseItem = responseStream.Current; // Do something with streamed response } // The response stream has completed // End snippet }
public async stt::Task ReadFeatureValuesRequestObjectAsync() { moq::Mock <FeaturestoreOnlineServingService.FeaturestoreOnlineServingServiceClient> mockGrpcClient = new moq::Mock <FeaturestoreOnlineServingService.FeaturestoreOnlineServingServiceClient>(moq::MockBehavior.Strict); ReadFeatureValuesRequest request = new ReadFeatureValuesRequest { EntityTypeAsEntityTypeName = EntityTypeName.FromProjectLocationFeaturestoreEntityType("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"), EntityId = "entity_id1347fcdf", FeatureSelector = new FeatureSelector(), }; ReadFeatureValuesResponse expectedResponse = new ReadFeatureValuesResponse { Header = new ReadFeatureValuesResponse.Types.Header(), EntityView = new ReadFeatureValuesResponse.Types.EntityView(), }; mockGrpcClient.Setup(x => x.ReadFeatureValuesAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <ReadFeatureValuesResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); FeaturestoreOnlineServingServiceClient client = new FeaturestoreOnlineServingServiceClientImpl(mockGrpcClient.Object, null); ReadFeatureValuesResponse responseCallSettings = await client.ReadFeatureValuesAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); ReadFeatureValuesResponse responseCancellationToken = await client.ReadFeatureValuesAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for ReadFeatureValues</summary> public void ReadFeatureValuesResourceNames() { // Snippet: ReadFeatureValues(EntityTypeName, CallSettings) // Create client FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = FeaturestoreOnlineServingServiceClient.Create(); // Initialize request argument(s) EntityTypeName entityType = EntityTypeName.FromProjectLocationFeaturestoreEntityType("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"); // Make the request ReadFeatureValuesResponse response = featurestoreOnlineServingServiceClient.ReadFeatureValues(entityType); // End snippet }
/// <summary>Snippet for ReadFeatureValuesAsync</summary> public async Task ReadFeatureValuesResourceNamesAsync() { // Snippet: ReadFeatureValuesAsync(EntityTypeName, CallSettings) // Additional: ReadFeatureValuesAsync(EntityTypeName, CancellationToken) // Create client FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = await FeaturestoreOnlineServingServiceClient.CreateAsync(); // Initialize request argument(s) EntityTypeName entityType = EntityTypeName.FromProjectLocationFeaturestoreEntityType("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"); // Make the request ReadFeatureValuesResponse response = await featurestoreOnlineServingServiceClient.ReadFeatureValuesAsync(entityType); // End snippet }
/// <summary>Snippet for ReadFeatureValues</summary> public void ReadFeatureValuesRequestObject() { // Snippet: ReadFeatureValues(ReadFeatureValuesRequest, CallSettings) // Create client FeaturestoreOnlineServingServiceClient featurestoreOnlineServingServiceClient = FeaturestoreOnlineServingServiceClient.Create(); // Initialize request argument(s) ReadFeatureValuesRequest request = new ReadFeatureValuesRequest { EntityTypeAsEntityTypeName = EntityTypeName.FromProjectLocationFeaturestoreEntityType("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"), EntityId = "", FeatureSelector = new FeatureSelector(), }; // Make the request ReadFeatureValuesResponse response = featurestoreOnlineServingServiceClient.ReadFeatureValues(request); // End snippet }
public void ReadFeatureValues() { moq::Mock <FeaturestoreOnlineServingService.FeaturestoreOnlineServingServiceClient> mockGrpcClient = new moq::Mock <FeaturestoreOnlineServingService.FeaturestoreOnlineServingServiceClient>(moq::MockBehavior.Strict); ReadFeatureValuesRequest request = new ReadFeatureValuesRequest { EntityTypeAsEntityTypeName = EntityTypeName.FromProjectLocationFeaturestoreEntityType("[PROJECT]", "[LOCATION]", "[FEATURESTORE]", "[ENTITY_TYPE]"), }; ReadFeatureValuesResponse expectedResponse = new ReadFeatureValuesResponse { Header = new ReadFeatureValuesResponse.Types.Header(), EntityView = new ReadFeatureValuesResponse.Types.EntityView(), }; mockGrpcClient.Setup(x => x.ReadFeatureValues(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); FeaturestoreOnlineServingServiceClient client = new FeaturestoreOnlineServingServiceClientImpl(mockGrpcClient.Object, null); ReadFeatureValuesResponse response = client.ReadFeatureValues(request.EntityType); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }