Esempio n. 1
0
        /// <summary>Snippet for ListWorkspacesAsync</summary>
        public async Task ListWorkspacesRequestObjectAsync()
        {
            // Snippet: ListWorkspacesAsync(ListWorkspacesRequest, CallSettings)
            // Create client
            TablesServiceClient tablesServiceClient = await TablesServiceClient.CreateAsync();

            // Initialize request argument(s)
            ListWorkspacesRequest request = new ListWorkspacesRequest {
            };
            // Make the request
            PagedAsyncEnumerable <ListWorkspacesResponse, Workspace> response = tablesServiceClient.ListWorkspacesAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((Workspace item) =>
            {
                // Do something with each item
                Console.WriteLine(item);
            });

            // Or iterate over pages (of server-defined size), performing one RPC per page
            await response.AsRawResponses().ForEachAsync((ListWorkspacesResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Workspace item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            });

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int pageSize = 10;
            Page <Workspace> singlePage = await response.ReadPageAsync(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (Workspace item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
Esempio n. 2
0
        /// <summary>Snippet for GetWorkspaceAsync</summary>
        public async Task GetWorkspaceRequestObjectAsync()
        {
            // Snippet: GetWorkspaceAsync(GetWorkspaceRequest, CallSettings)
            // Additional: GetWorkspaceAsync(GetWorkspaceRequest, CancellationToken)
            // Create client
            TablesServiceClient tablesServiceClient = await TablesServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetWorkspaceRequest request = new GetWorkspaceRequest
            {
                WorkspaceName = WorkspaceName.FromWorkspace("[WORKSPACE]"),
            };
            // Make the request
            Workspace response = await tablesServiceClient.GetWorkspaceAsync(request);

            // End snippet
        }
Esempio n. 3
0
        /// <summary>Snippet for BatchDeleteRowsAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task BatchDeleteRowsRequestObjectAsync()
        {
            // Create client
            TablesServiceClient tablesServiceClient = await TablesServiceClient.CreateAsync();

            // Initialize request argument(s)
            BatchDeleteRowsRequest request = new BatchDeleteRowsRequest
            {
                ParentAsTableName = TableName.FromTable("[TABLE]"),
                RowNames          =
                {
                    RowName.FromTableRow("[TABLE]", "[ROW]"),
                },
            };
            // Make the request
            await tablesServiceClient.BatchDeleteRowsAsync(request);
        }
        /// <summary>Snippet for DeleteRowAsync</summary>
        public async Task DeleteRowRequestObjectAsync()
        {
            // Snippet: DeleteRowAsync(DeleteRowRequest, CallSettings)
            // Additional: DeleteRowAsync(DeleteRowRequest, CancellationToken)
            // Create client
            TablesServiceClient tablesServiceClient = await TablesServiceClient.CreateAsync();

            // Initialize request argument(s)
            DeleteRowRequest request = new DeleteRowRequest
            {
                RowName = RowName.FromTableRow("[TABLE]", "[ROW]"),
            };
            // Make the request
            await tablesServiceClient.DeleteRowAsync(request);

            // End snippet
        }
Esempio n. 5
0
        /// <summary>Snippet for BatchUpdateRowsAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task BatchUpdateRowsRequestObjectAsync()
        {
            // Create client
            TablesServiceClient tablesServiceClient = await TablesServiceClient.CreateAsync();

            // Initialize request argument(s)
            BatchUpdateRowsRequest request = new BatchUpdateRowsRequest
            {
                Parent   = "",
                Requests =
                {
                    new UpdateRowRequest(),
                },
            };
            // Make the request
            BatchUpdateRowsResponse response = await tablesServiceClient.BatchUpdateRowsAsync(request);
        }
Esempio n. 6
0
        /// <summary>Snippet for GetRowAsync</summary>
        public async Task GetRowRequestObjectAsync()
        {
            // Snippet: GetRowAsync(GetRowRequest, CallSettings)
            // Additional: GetRowAsync(GetRowRequest, CancellationToken)
            // Create client
            TablesServiceClient tablesServiceClient = await TablesServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetRowRequest request = new GetRowRequest
            {
                Name = "",
                View = View.Unspecified,
            };
            // Make the request
            Row response = await tablesServiceClient.GetRowAsync(request);

            // End snippet
        }
Esempio n. 7
0
        /// <summary>Snippet for UpdateRowAsync</summary>
        public async Task UpdateRowRequestObjectAsync()
        {
            // Snippet: UpdateRowAsync(UpdateRowRequest, CallSettings)
            // Additional: UpdateRowAsync(UpdateRowRequest, CancellationToken)
            // Create client
            TablesServiceClient tablesServiceClient = await TablesServiceClient.CreateAsync();

            // Initialize request argument(s)
            UpdateRowRequest request = new UpdateRowRequest
            {
                Row        = new Row(),
                UpdateMask = new FieldMask(),
                View       = View.Unspecified,
            };
            // Make the request
            Row response = await tablesServiceClient.UpdateRowAsync(request);

            // End snippet
        }
Esempio n. 8
0
        /// <summary>Snippet for BatchUpdateRowsAsync</summary>
        public async Task BatchUpdateRowsRequestObjectAsync()
        {
            // Snippet: BatchUpdateRowsAsync(BatchUpdateRowsRequest, CallSettings)
            // Additional: BatchUpdateRowsAsync(BatchUpdateRowsRequest, CancellationToken)
            // Create client
            TablesServiceClient tablesServiceClient = await TablesServiceClient.CreateAsync();

            // Initialize request argument(s)
            BatchUpdateRowsRequest request = new BatchUpdateRowsRequest
            {
                Parent   = "",
                Requests =
                {
                    new UpdateRowRequest(),
                },
            };
            // Make the request
            BatchUpdateRowsResponse response = await tablesServiceClient.BatchUpdateRowsAsync(request);

            // End snippet
        }
Esempio n. 9
0
        /// <summary>Snippet for BatchDeleteRowsAsync</summary>
        public async Task BatchDeleteRowsRequestObjectAsync()
        {
            // Snippet: BatchDeleteRowsAsync(BatchDeleteRowsRequest, CallSettings)
            // Additional: BatchDeleteRowsAsync(BatchDeleteRowsRequest, CancellationToken)
            // Create client
            TablesServiceClient tablesServiceClient = await TablesServiceClient.CreateAsync();

            // Initialize request argument(s)
            BatchDeleteRowsRequest request = new BatchDeleteRowsRequest
            {
                ParentAsTableName = TableName.FromTable("[TABLE]"),
                RowNames          =
                {
                    RowName.FromTableRow("[TABLE]", "[ROW]"),
                },
            };
            // Make the request
            await tablesServiceClient.BatchDeleteRowsAsync(request);

            // End snippet
        }