1.0.0 (latest) 1.0.0-beta01

    public abstract class StreamingServiceClient

Reference documentation and code samples for the Vision AI v1 API class StreamingServiceClient.

StreamingService client wrapper, for convenient use.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> StreamingServiceClient

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Derived Types

[StreamingServiceClientImpl](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.StreamingServiceClientImpl)

## Namespace

[Google.Cloud.VisionAI.V1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1)

## Assembly

Google.Cloud.VisionAI.V1.dll

## Remarks

Streaming service for receiving and sending packets.

## Properties

### DefaultEndpoint

    public static string DefaultEndpoint { get; }

The default endpoint for the StreamingService service, which is a host of "visionai.googleapis.com" and a port of 443.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### DefaultScopes

    public static IReadOnlyList<string> DefaultScopes { get; }

The default StreamingService scopes.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlylist-1https://learn.microsoft.com/dotnet/api/system.string` |   |

**Remarks** The default StreamingService scopes are:

- <https://www.googleapis.com/auth/cloud-platform>

### GrpcClient

    public virtual StreamingService.StreamingServiceClient GrpcClient { get; }

The underlying gRPC StreamingService client

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.StreamingServicehttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.StreamingService.StreamingServiceClient` |   |

### IAMPolicyClient

    public virtual IAMPolicyClient IAMPolicyClient { get; }

The [IAMPolicyClient](https://cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V1/latest/Google.Cloud.Iam.V1.IAMPolicyClient.html) associated with this client.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V1/latest/Google.Cloud.Iam.V1.IAMPolicyClient.html` |   |

### LocationsClient

    public virtual LocationsClient LocationsClient { get; }

The [LocationsClient](https://cloud.google.com/dotnet/docs/reference/Google.Cloud.Location/latest/Google.Cloud.Location.LocationsClient.html) associated with this client.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Cloud.Location/latest/Google.Cloud.Location.LocationsClient.html` |   |

### ServiceMetadata

    public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.ServiceMetadata.html` |   |

## Methods

### AcquireLease(AcquireLeaseRequest, CallSettings)

    public virtual Lease AcquireLease(AcquireLeaseRequest request, CallSettings callSettings = null)

AcquireLease acquires a lease.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.AcquireLeaseRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.Lease` | The RPC response. |

**Example**

    // Create client
    StreamingServiceClient streamingServiceClient = StreamingServiceClient.Create();
    // Initialize request argument(s)
    AcquireLeaseRequest request = new AcquireLeaseRequest
    {
        Series = "",
        Owner = "",
        Term = new Duration(),
        LeaseType = LeaseType.Unspecified,
    };
    // Make the request
    Lease response = streamingServiceClient.AcquireLease(request);

### AcquireLeaseAsync(AcquireLeaseRequest, CallSettings)

    public virtual Task<Lease> AcquireLeaseAsync(AcquireLeaseRequest request, CallSettings callSettings = null)

AcquireLease acquires a lease.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.AcquireLeaseRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.Lease` | A Task containing the RPC response. |

**Example**

    // Create client
    StreamingServiceClient streamingServiceClient = await StreamingServiceClient.CreateAsync();
    // Initialize request argument(s)
    AcquireLeaseRequest request = new AcquireLeaseRequest
    {
        Series = "",
        Owner = "",
        Term = new Duration(),
        LeaseType = LeaseType.Unspecified,
    };
    // Make the request
    Lease response = await streamingServiceClient.AcquireLeaseAsync(request);

### AcquireLeaseAsync(AcquireLeaseRequest, CancellationToken)

    public virtual Task<Lease> AcquireLeaseAsync(AcquireLeaseRequest request, CancellationToken cancellationToken)

AcquireLease acquires a lease.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.AcquireLeaseRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.Lease` | A Task containing the RPC response. |

**Example**

    // Create client
    StreamingServiceClient streamingServiceClient = await StreamingServiceClient.CreateAsync();
    // Initialize request argument(s)
    AcquireLeaseRequest request = new AcquireLeaseRequest
    {
        Series = "",
        Owner = "",
        Term = new Duration(),
        LeaseType = LeaseType.Unspecified,
    };
    // Make the request
    Lease response = await streamingServiceClient.AcquireLeaseAsync(request);

### Create()

    public static StreamingServiceClient Create()

Synchronously creates a [StreamingServiceClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.StreamingServiceClient) using the default credentials, endpoint and settings. To specify custom credentials or other settings, use [StreamingServiceClientBuilder](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.StreamingServiceClientBuilder).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.StreamingServiceClient` | The created [StreamingServiceClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.StreamingServiceClient). |

### CreateAsync(CancellationToken)

    public static Task<StreamingServiceClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a [StreamingServiceClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.StreamingServiceClient) using the default credentials, endpoint and settings. To specify custom credentials or other settings, use [StreamingServiceClientBuilder](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.StreamingServiceClientBuilder).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` The [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use while creating the client. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.StreamingServiceClient` | The task representing the created [StreamingServiceClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.StreamingServiceClient). |

### ReceiveEvents(CallSettings, BidirectionalStreamingSettings)

    public virtual StreamingServiceClient.ReceiveEventsStream ReceiveEvents(CallSettings callSettings = null, BidirectionalStreamingSettings streamingSettings = null)

Receive events given the stream name.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |
| `streamingSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.BidirectionalStreamingSettings.html` If not null, applies streaming overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.StreamingServiceClienthttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.StreamingServiceClient.ReceiveEventsStream` | The client-server stream. |

**Example**

    // Create client
    StreamingServiceClient streamingServiceClient = StreamingServiceClient.Create();
    // Initialize streaming call, retrieving the stream object
    using StreamingServiceClient.ReceiveEventsStream response = streamingServiceClient.ReceiveEvents();

    // Sending requests and retrieving responses can be arbitrarily interleaved
    // Exact sequence will depend on client/server behavior

    // Create task to do something with responses from server
    Task responseHandlerTask = Task.Run(async () =>
    {
        // Note that C# 8 code can use await foreach
        AsyncResponseStream<ReceiveEventsResponse> responseStream = response.GetResponseStream();
        while (await responseStream.MoveNextAsync())
        {
            ReceiveEventsResponse responseItem = responseStream.Current;
            // Do something with streamed response
        }
        // The response stream has completed
    });

    // Send requests to the server
    bool done = false;
    while (!done)
    {
        // Initialize a request
        ReceiveEventsRequest request = new ReceiveEventsRequest
        {
            SetupRequest = new ReceiveEventsRequest.Types.SetupRequest(),
        };
        // Stream a request to the server
        await response.WriteAsync(request);
        // Set "done" to true when sending requests is complete
    }

    // Complete writing requests to the stream
    await response.WriteCompleteAsync();
    // Await the response handler
    // This will complete once all server responses have been processed
    await responseHandlerTask;

### ReceivePackets(CallSettings, BidirectionalStreamingSettings)

    public virtual StreamingServiceClient.ReceivePacketsStream ReceivePackets(CallSettings callSettings = null, BidirectionalStreamingSettings streamingSettings = null)

Receive packets from the series.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |
| `streamingSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.BidirectionalStreamingSettings.html` If not null, applies streaming overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.StreamingServiceClienthttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.StreamingServiceClient.ReceivePacketsStream` | The client-server stream. |

**Example**

    // Create client
    StreamingServiceClient streamingServiceClient = StreamingServiceClient.Create();
    // Initialize streaming call, retrieving the stream object
    using StreamingServiceClient.ReceivePacketsStream response = streamingServiceClient.ReceivePackets();

    // Sending requests and retrieving responses can be arbitrarily interleaved
    // Exact sequence will depend on client/server behavior

    // Create task to do something with responses from server
    Task responseHandlerTask = Task.Run(async () =>
    {
        // Note that C# 8 code can use await foreach
        AsyncResponseStream<ReceivePacketsResponse> responseStream = response.GetResponseStream();
        while (await responseStream.MoveNextAsync())
        {
            ReceivePacketsResponse responseItem = responseStream.Current;
            // Do something with streamed response
        }
        // The response stream has completed
    });

    // Send requests to the server
    bool done = false;
    while (!done)
    {
        // Initialize a request
        ReceivePacketsRequest request = new ReceivePacketsRequest
        {
            SetupRequest = new ReceivePacketsRequest.Types.SetupRequest(),
        };
        // Stream a request to the server
        await response.WriteAsync(request);
        // Set "done" to true when sending requests is complete
    }

    // Complete writing requests to the stream
    await response.WriteCompleteAsync();
    // Await the response handler
    // This will complete once all server responses have been processed
    await responseHandlerTask;

### ReleaseLease(ReleaseLeaseRequest, CallSettings)

    public virtual ReleaseLeaseResponse ReleaseLease(ReleaseLeaseRequest request, CallSettings callSettings = null)

RleaseLease releases a lease.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.ReleaseLeaseRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.ReleaseLeaseResponse` | The RPC response. |

**Example**

    // Create client
    StreamingServiceClient streamingServiceClient = StreamingServiceClient.Create();
    // Initialize request argument(s)
    ReleaseLeaseRequest request = new ReleaseLeaseRequest
    {
        Id = "",
        Series = "",
        Owner = "",
    };
    // Make the request
    ReleaseLeaseResponse response = streamingServiceClient.ReleaseLease(request);

### ReleaseLeaseAsync(ReleaseLeaseRequest, CallSettings)

    public virtual Task<ReleaseLeaseResponse> ReleaseLeaseAsync(ReleaseLeaseRequest request, CallSettings callSettings = null)

RleaseLease releases a lease.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.ReleaseLeaseRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.ReleaseLeaseResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    StreamingServiceClient streamingServiceClient = await StreamingServiceClient.CreateAsync();
    // Initialize request argument(s)
    ReleaseLeaseRequest request = new ReleaseLeaseRequest
    {
        Id = "",
        Series = "",
        Owner = "",
    };
    // Make the request
    ReleaseLeaseResponse response = await streamingServiceClient.ReleaseLeaseAsync(request);

### ReleaseLeaseAsync(ReleaseLeaseRequest, CancellationToken)

    public virtual Task<ReleaseLeaseResponse> ReleaseLeaseAsync(ReleaseLeaseRequest request, CancellationToken cancellationToken)

RleaseLease releases a lease.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.ReleaseLeaseRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.ReleaseLeaseResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    StreamingServiceClient streamingServiceClient = await StreamingServiceClient.CreateAsync();
    // Initialize request argument(s)
    ReleaseLeaseRequest request = new ReleaseLeaseRequest
    {
        Id = "",
        Series = "",
        Owner = "",
    };
    // Make the request
    ReleaseLeaseResponse response = await streamingServiceClient.ReleaseLeaseAsync(request);

### RenewLease(RenewLeaseRequest, CallSettings)

    public virtual Lease RenewLease(RenewLeaseRequest request, CallSettings callSettings = null)

RenewLease renews a lease.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.RenewLeaseRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.Lease` | The RPC response. |

**Example**

    // Create client
    StreamingServiceClient streamingServiceClient = StreamingServiceClient.Create();
    // Initialize request argument(s)
    RenewLeaseRequest request = new RenewLeaseRequest
    {
        Id = "",
        Series = "",
        Owner = "",
        Term = new Duration(),
    };
    // Make the request
    Lease response = streamingServiceClient.RenewLease(request);

### RenewLeaseAsync(RenewLeaseRequest, CallSettings)

    public virtual Task<Lease> RenewLeaseAsync(RenewLeaseRequest request, CallSettings callSettings = null)

RenewLease renews a lease.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.RenewLeaseRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.Lease` | A Task containing the RPC response. |

**Example**

    // Create client
    StreamingServiceClient streamingServiceClient = await StreamingServiceClient.CreateAsync();
    // Initialize request argument(s)
    RenewLeaseRequest request = new RenewLeaseRequest
    {
        Id = "",
        Series = "",
        Owner = "",
        Term = new Duration(),
    };
    // Make the request
    Lease response = await streamingServiceClient.RenewLeaseAsync(request);

### RenewLeaseAsync(RenewLeaseRequest, CancellationToken)

    public virtual Task<Lease> RenewLeaseAsync(RenewLeaseRequest request, CancellationToken cancellationToken)

RenewLease renews a lease.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.RenewLeaseRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.Lease` | A Task containing the RPC response. |

**Example**

    // Create client
    StreamingServiceClient streamingServiceClient = await StreamingServiceClient.CreateAsync();
    // Initialize request argument(s)
    RenewLeaseRequest request = new RenewLeaseRequest
    {
        Id = "",
        Series = "",
        Owner = "",
        Term = new Duration(),
    };
    // Make the request
    Lease response = await streamingServiceClient.RenewLeaseAsync(request);

### SendPackets(CallSettings, BidirectionalStreamingSettings)

    public virtual StreamingServiceClient.SendPacketsStream SendPackets(CallSettings callSettings = null, BidirectionalStreamingSettings streamingSettings = null)

Send packets to the series.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |
| `streamingSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.BidirectionalStreamingSettings.html` If not null, applies streaming overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.StreamingServiceClienthttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.StreamingServiceClient.SendPacketsStream` | The client-server stream. |

**Example**

    // Create client
    StreamingServiceClient streamingServiceClient = StreamingServiceClient.Create();
    // Initialize streaming call, retrieving the stream object
    using StreamingServiceClient.SendPacketsStream response = streamingServiceClient.SendPackets();

    // Sending requests and retrieving responses can be arbitrarily interleaved
    // Exact sequence will depend on client/server behavior

    // Create task to do something with responses from server
    Task responseHandlerTask = Task.Run(async () =>
    {
        // Note that C# 8 code can use await foreach
        AsyncResponseStream<SendPacketsResponse> responseStream = response.GetResponseStream();
        while (await responseStream.MoveNextAsync())
        {
            SendPacketsResponse responseItem = responseStream.Current;
            // Do something with streamed response
        }
        // The response stream has completed
    });

    // Send requests to the server
    bool done = false;
    while (!done)
    {
        // Initialize a request
        SendPacketsRequest request = new SendPacketsRequest
        {
            Packet = new Packet(),
        };
        // Stream a request to the server
        await response.WriteAsync(request);
        // Set "done" to true when sending requests is complete
    }

    // Complete writing requests to the stream
    await response.WriteCompleteAsync();
    // Await the response handler
    // This will complete once all server responses have been processed
    await responseHandlerTask;

### ShutdownDefaultChannelsAsync()

    public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by [Create()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.StreamingServiceClient#Google_Cloud_VisionAI_V1_StreamingServiceClient_Create) and [CreateAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.StreamingServiceClient#Google_Cloud_VisionAI_V1_StreamingServiceClient_CreateAsync_System_Threading_CancellationToken_). Channels which weren't automatically created are not affected.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task` | A task representing the asynchronous shutdown operation. |

**Remarks** After calling this method, further calls to [Create()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.StreamingServiceClient#Google_Cloud_VisionAI_V1_StreamingServiceClient_Create) and [CreateAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.VisionAI.V1/latest/Google.Cloud.VisionAI.V1.StreamingServiceClient#Google_Cloud_VisionAI_V1_StreamingServiceClient_CreateAsync_System_Threading_CancellationToken_) will create new channels, which could in turn be shut down by another call to this method.