/// <summary>Snippet for DeleteProductAsync</summary> public async Task DeleteProductResourceNamesAsync() { // Snippet: DeleteProductAsync(ProductName, CallSettings) // Additional: DeleteProductAsync(ProductName, CancellationToken) // Create client ProductServiceClient productServiceClient = await ProductServiceClient.CreateAsync(); // Initialize request argument(s) ProductName name = ProductName.FromProjectLocationCatalogBranchProduct("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]"); // Make the request await productServiceClient.DeleteProductAsync(name); // End snippet }
/// <summary>Snippet for DeleteProductAsync</summary> public async Task DeleteProductAsync() { // Snippet: DeleteProductAsync(string, CallSettings) // Additional: DeleteProductAsync(string, CancellationToken) // Create client ProductServiceClient productServiceClient = await ProductServiceClient.CreateAsync(); // Initialize request argument(s) string name = "projects/[PROJECT]/locations/[LOCATION]/catalogs/[CATALOG]/branches/[BRANCH]/products/[PRODUCT]"; // Make the request await productServiceClient.DeleteProductAsync(name); // End snippet }
/// <summary>Snippet for UpdateProductAsync</summary> public async Task UpdateProductAsync() { // Snippet: UpdateProductAsync(Product, FieldMask, CallSettings) // Additional: UpdateProductAsync(Product, FieldMask, CancellationToken) // Create client ProductServiceClient productServiceClient = await ProductServiceClient.CreateAsync(); // Initialize request argument(s) Product product = new Product(); FieldMask updateMask = new FieldMask(); // Make the request Product response = await productServiceClient.UpdateProductAsync(product, updateMask); // End snippet }
/// <summary>Snippet for CreateProductAsync</summary> public async Task CreateProductAsync() { // Snippet: CreateProductAsync(string, Product, string, CallSettings) // Additional: CreateProductAsync(string, Product, string, CancellationToken) // Create client ProductServiceClient productServiceClient = await ProductServiceClient.CreateAsync(); // Initialize request argument(s) string parent = "projects/[PROJECT]/locations/[LOCATION]/catalogs/[CATALOG]/branches/[BRANCH]"; Product product = new Product(); string productId = ""; // Make the request Product response = await productServiceClient.CreateProductAsync(parent, product, productId); // End snippet }
/// <summary>Snippet for CreateProductAsync</summary> public async Task CreateProductResourceNamesAsync() { // Snippet: CreateProductAsync(BranchName, Product, string, CallSettings) // Additional: CreateProductAsync(BranchName, Product, string, CancellationToken) // Create client ProductServiceClient productServiceClient = await ProductServiceClient.CreateAsync(); // Initialize request argument(s) BranchName parent = BranchName.FromProjectLocationCatalogBranch("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]"); Product product = new Product(); string productId = ""; // Make the request Product response = await productServiceClient.CreateProductAsync(parent, product, productId); // End snippet }
/// <summary>Snippet for GetProductAsync</summary> public async Task GetProductRequestObjectAsync() { // Snippet: GetProductAsync(GetProductRequest, CallSettings) // Additional: GetProductAsync(GetProductRequest, CancellationToken) // Create client ProductServiceClient productServiceClient = await ProductServiceClient.CreateAsync(); // Initialize request argument(s) GetProductRequest request = new GetProductRequest { ProductName = ProductName.FromProjectLocationCatalogBranchProduct("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]", "[PRODUCT]"), }; // Make the request Product response = await productServiceClient.GetProductAsync(request); // End snippet }
/// <summary>Snippet for UpdateProductAsync</summary> public async Task UpdateProductRequestObjectAsync() { // Snippet: UpdateProductAsync(UpdateProductRequest, CallSettings) // Additional: UpdateProductAsync(UpdateProductRequest, CancellationToken) // Create client ProductServiceClient productServiceClient = await ProductServiceClient.CreateAsync(); // Initialize request argument(s) UpdateProductRequest request = new UpdateProductRequest { Product = new Product(), UpdateMask = new FieldMask(), }; // Make the request Product response = await productServiceClient.UpdateProductAsync(request); // End snippet }
/// <summary>Snippet for CreateProductAsync</summary> public async Task CreateProductRequestObjectAsync() { // Snippet: CreateProductAsync(CreateProductRequest, CallSettings) // Additional: CreateProductAsync(CreateProductRequest, CancellationToken) // Create client ProductServiceClient productServiceClient = await ProductServiceClient.CreateAsync(); // Initialize request argument(s) CreateProductRequest request = new CreateProductRequest { ParentAsBranchName = BranchName.FromProjectLocationCatalogBranch("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]"), Product = new Product(), ProductId = "", }; // Make the request Product response = await productServiceClient.CreateProductAsync(request); // End snippet }
/// <summary>Snippet for ImportProductsAsync</summary> public async Task ImportProductsRequestObjectAsync() { // Snippet: ImportProductsAsync(ImportProductsRequest, CallSettings) // Additional: ImportProductsAsync(ImportProductsRequest, CancellationToken) // Create client ProductServiceClient productServiceClient = await ProductServiceClient.CreateAsync(); // Initialize request argument(s) ImportProductsRequest request = new ImportProductsRequest { Parent = "", InputConfig = new ProductInputConfig(), ErrorsConfig = new ImportErrorsConfig(), UpdateMask = new FieldMask(), }; // Make the request Operation <ImportProductsResponse, ImportMetadata> response = await productServiceClient.ImportProductsAsync(request); // Poll until the returned long-running operation is complete Operation <ImportProductsResponse, ImportMetadata> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result ImportProductsResponse result = completedResponse.Result; // Or get the name of the operation string operationName = response.Name; // This name can be stored, then the long-running operation retrieved later by name Operation <ImportProductsResponse, ImportMetadata> retrievedResponse = await productServiceClient.PollOnceImportProductsAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result ImportProductsResponse retrievedResult = retrievedResponse.Result; } // End snippet }