/// <summary>Snippet for ImportCatalogItems</summary> public void ImportCatalogItems() { // Snippet: ImportCatalogItems(string, string, InputConfig, ImportErrorsConfig, CallSettings) // Create client CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create(); // Initialize request argument(s) string parent = "projects/[PROJECT]/locations/[LOCATION]/catalogs/[CATALOG]"; string requestId = ""; InputConfig inputConfig = new InputConfig(); ImportErrorsConfig errorsConfig = new ImportErrorsConfig(); // Make the request Operation <ImportCatalogItemsResponse, ImportMetadata> response = catalogServiceClient.ImportCatalogItems(parent, requestId, inputConfig, errorsConfig); // Poll until the returned long-running operation is complete Operation <ImportCatalogItemsResponse, ImportMetadata> completedResponse = response.PollUntilCompleted(); // Retrieve the operation result ImportCatalogItemsResponse 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 <ImportCatalogItemsResponse, ImportMetadata> retrievedResponse = catalogServiceClient.PollOnceImportCatalogItems(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result ImportCatalogItemsResponse retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary>Snippet for ImportCatalogItems</summary> public void ImportCatalogItemsRequestObject() { // Snippet: ImportCatalogItems(ImportCatalogItemsRequest, CallSettings) // Create client CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create(); // Initialize request argument(s) ImportCatalogItemsRequest request = new ImportCatalogItemsRequest { ParentAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"), RequestId = "", InputConfig = new InputConfig(), ErrorsConfig = new ImportErrorsConfig(), }; // Make the request Operation <ImportCatalogItemsResponse, ImportMetadata> response = catalogServiceClient.ImportCatalogItems(request); // Poll until the returned long-running operation is complete Operation <ImportCatalogItemsResponse, ImportMetadata> completedResponse = response.PollUntilCompleted(); // Retrieve the operation result ImportCatalogItemsResponse 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 <ImportCatalogItemsResponse, ImportMetadata> retrievedResponse = catalogServiceClient.PollOnceImportCatalogItems(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result ImportCatalogItemsResponse retrievedResult = retrievedResponse.Result; } // End snippet }
public void ConfigureServices(IServiceCollection services) { services.AddStandardTemplate((svc, resolver) => { var config = resolver.GetService <IConfiguration>(); var cartChannel = new Channel(config["RpcClients:CartService"], ChannelCredentials.Insecure); var cartClient = new CartServiceClient(cartChannel); var inventoryChannel = new Channel(config["RpcClients:InventoryService"], ChannelCredentials.Insecure); var inventoryClient = new InventoryServiceClient(inventoryChannel); var reviewChannel = new Channel(config["RpcClients:ReviewService"], ChannelCredentials.Insecure); var reviewClient = new ReviewServiceClient(reviewChannel); var pingClient = new PingServiceClient(reviewChannel); var catalogChannel = new Channel(config["RpcClients:CatalogService"], ChannelCredentials.Insecure); var catalogClient = new CatalogServiceClient(catalogChannel); var ratingChannel = new Channel(config["RpcClients:RatingService"], ChannelCredentials.Insecure); var ratingClient = new RatingServiceClient(ratingChannel); services.AddSingleton(typeof(CartServiceClient), cartClient); services.AddSingleton(typeof(InventoryServiceClient), inventoryClient); services.AddSingleton(typeof(ReviewServiceClient), reviewClient); services.AddSingleton(typeof(PingServiceClient), pingClient); services.AddSingleton(typeof(CatalogServiceClient), catalogClient); services.AddSingleton(typeof(RatingServiceClient), ratingClient); }); }
/// <summary>Snippet for ImportCatalogItemsAsync</summary> public async Task ImportCatalogItemsResourceNamesAsync() { // Snippet: ImportCatalogItemsAsync(CatalogName, string, InputConfig, ImportErrorsConfig, CallSettings) // Additional: ImportCatalogItemsAsync(CatalogName, string, InputConfig, ImportErrorsConfig, CancellationToken) // Create client CatalogServiceClient catalogServiceClient = await CatalogServiceClient.CreateAsync(); // Initialize request argument(s) CatalogName parent = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"); string requestId = ""; InputConfig inputConfig = new InputConfig(); ImportErrorsConfig errorsConfig = new ImportErrorsConfig(); // Make the request Operation <ImportCatalogItemsResponse, ImportMetadata> response = await catalogServiceClient.ImportCatalogItemsAsync(parent, requestId, inputConfig, errorsConfig); // Poll until the returned long-running operation is complete Operation <ImportCatalogItemsResponse, ImportMetadata> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result ImportCatalogItemsResponse 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 <ImportCatalogItemsResponse, ImportMetadata> retrievedResponse = await catalogServiceClient.PollOnceImportCatalogItemsAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result ImportCatalogItemsResponse retrievedResult = retrievedResponse.Result; } // End snippet }
private void RegisterGrpcServices(IServiceCollection services) { var cartChannel = new Channel(Configuration["RpcClients:CartService"], ChannelCredentials.Insecure); var cartClient = new CartServiceClient(cartChannel); var inventoryChannel = new Channel(Configuration["RpcClients:InventoryService"], ChannelCredentials.Insecure); var inventoryClient = new InventoryServiceClient(inventoryChannel); var reviewChannel = new Channel(Configuration["RpcClients:ReviewService"], ChannelCredentials.Insecure); var reviewClient = new ReviewServiceClient(reviewChannel); var pingClient = new PingServiceClient(reviewChannel); var catalogChannel = new Channel(Configuration["RpcClients:CatalogService"], ChannelCredentials.Insecure); var catalogClient = new CatalogServiceClient(catalogChannel); var ratingChannel = new Channel(Configuration["RpcClients:RatingService"], ChannelCredentials.Insecure); var ratingClient = new RatingServiceClient(ratingChannel); services.AddSingleton(typeof(CartServiceClient), cartClient); services.AddSingleton(typeof(InventoryServiceClient), inventoryClient); services.AddSingleton(typeof(ReviewServiceClient), reviewClient); services.AddSingleton(typeof(PingServiceClient), pingClient); services.AddSingleton(typeof(CatalogServiceClient), catalogClient); services.AddSingleton(typeof(RatingServiceClient), ratingClient); }
/// <summary>Snippet for GetCatalogItem</summary> public void GetCatalogItemResourceNames() { // Snippet: GetCatalogItem(CatalogItemPathName, CallSettings) // Create client CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create(); // Initialize request argument(s) CatalogItemPathName name = CatalogItemPathName.FromProjectLocationCatalogCatalogItemPath("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CATALOG_ITEM_PATH]"); // Make the request CatalogItem response = catalogServiceClient.GetCatalogItem(name); // End snippet }
/// <summary>Snippet for GetCatalogItem</summary> public void GetCatalogItem() { // Snippet: GetCatalogItem(string, CallSettings) // Create client CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create(); // Initialize request argument(s) string name = "projects/[PROJECT]/locations/[LOCATION]/catalogs/[CATALOG]/catalogItems/[CATALOG_ITEM_PATH]"; // Make the request CatalogItem response = catalogServiceClient.GetCatalogItem(name); // End snippet }
/// <summary>Snippet for GetDefaultBranch</summary> public void GetDefaultBranchResourceNames() { // Snippet: GetDefaultBranch(CatalogName, CallSettings) // Create client CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create(); // Initialize request argument(s) CatalogName catalog = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"); // Make the request GetDefaultBranchResponse response = catalogServiceClient.GetDefaultBranch(catalog); // End snippet }
/// <summary>Snippet for GetDefaultBranch</summary> public void GetDefaultBranch() { // Snippet: GetDefaultBranch(string, CallSettings) // Create client CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create(); // Initialize request argument(s) string catalog = "projects/[PROJECT]/locations/[LOCATION]/catalogs/[CATALOG]"; // Make the request GetDefaultBranchResponse response = catalogServiceClient.GetDefaultBranch(catalog); // End snippet }
static void Main(string[] args) { using (var scope = new TransactionScope(TransactionScopeOption.RequiresNew)) using (var catalog = new CatalogServiceClient()) { catalog.AddProduct("Producto 16", new Uri("http://miimage.com")); scope.Complete(); } Console.WriteLine("Terminado"); Console.ReadKey(); }
/// <summary>Snippet for CreateCatalogItem</summary> public void CreateCatalogItem() { // Snippet: CreateCatalogItem(string, CatalogItem, CallSettings) // Create client CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create(); // Initialize request argument(s) string parent = "projects/[PROJECT]/locations/[LOCATION]/catalogs/[CATALOG]"; CatalogItem catalogItem = new CatalogItem(); // Make the request CatalogItem response = catalogServiceClient.CreateCatalogItem(parent, catalogItem); // End snippet }
/// <summary>Snippet for CreateCatalogItem</summary> public void CreateCatalogItemResourceNames() { // Snippet: CreateCatalogItem(CatalogName, CatalogItem, CallSettings) // Create client CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create(); // Initialize request argument(s) CatalogName parent = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"); CatalogItem catalogItem = new CatalogItem(); // Make the request CatalogItem response = catalogServiceClient.CreateCatalogItem(parent, catalogItem); // End snippet }
/// <summary>Snippet for UpdateCatalog</summary> public void UpdateCatalog() { // Snippet: UpdateCatalog(Catalog, FieldMask, CallSettings) // Create client CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create(); // Initialize request argument(s) Catalog catalog = new Catalog(); FieldMask updateMask = new FieldMask(); // Make the request Catalog response = catalogServiceClient.UpdateCatalog(catalog, updateMask); // End snippet }
/// <summary>Snippet for UpdateCatalogItem</summary> public void UpdateCatalogItemResourceNames() { // Snippet: UpdateCatalogItem(CatalogItemPathName, CatalogItem, FieldMask, CallSettings) // Create client CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create(); // Initialize request argument(s) CatalogItemPathName name = CatalogItemPathName.FromProjectLocationCatalogCatalogItemPath("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CATALOG_ITEM_PATH]"); CatalogItem catalogItem = new CatalogItem(); FieldMask updateMask = new FieldMask(); // Make the request CatalogItem response = catalogServiceClient.UpdateCatalogItem(name, catalogItem, updateMask); // End snippet }
/// <summary>Snippet for UpdateCatalogItem</summary> public void UpdateCatalogItem() { // Snippet: UpdateCatalogItem(string, CatalogItem, FieldMask, CallSettings) // Create client CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create(); // Initialize request argument(s) string name = "projects/[PROJECT]/locations/[LOCATION]/catalogs/[CATALOG]/catalogItems/[CATALOG_ITEM_PATH]"; CatalogItem catalogItem = new CatalogItem(); FieldMask updateMask = new FieldMask(); // Make the request CatalogItem response = catalogServiceClient.UpdateCatalogItem(name, catalogItem, updateMask); // End snippet }
public CoolStoreResolverService( CatalogServiceClient catalogServiceClient, CartServiceClient cartServiceClient, InventoryServiceClient inventoryServiceClient, RatingServiceClient ratingServiceClient, ReviewServiceClient reviewServiceClient) { _catalogServiceClient = catalogServiceClient; _cartServiceClient = cartServiceClient; _inventoryServiceClient = inventoryServiceClient; _ratingServiceClient = ratingServiceClient; _reviewServiceClient = reviewServiceClient; }
public CoolStoreResolverService( IHttpContextAccessor httpContext, CatalogServiceClient catalogServiceClient, CartServiceClient cartServiceClient, InventoryServiceClient inventoryServiceClient, RatingServiceClient ratingServiceClient) { _httpContext = httpContext; _catalogServiceClient = catalogServiceClient; _cartServiceClient = cartServiceClient; _inventoryServiceClient = inventoryServiceClient; _ratingServiceClient = ratingServiceClient; }
public void ConfigureServices(IServiceCollection services) { services.AddStandardTemplate((svc, resolver) => { var cartChannel = new Channel(Configuration["RpcClients:CartService"], ChannelCredentials.Insecure); var cartClient = new CartServiceClient(cartChannel); var inventoryChannel = new Channel(Configuration["RpcClients:InventoryService"], ChannelCredentials.Insecure); var inventoryClient = new InventoryServiceClient(inventoryChannel); var reviewChannel = new Channel(Configuration["RpcClients:ReviewService"], ChannelCredentials.Insecure); var reviewClient = new ReviewServiceClient(reviewChannel); var pingClient = new PingServiceClient(reviewChannel); var catalogChannel = new Channel(Configuration["RpcClients:CatalogService"], ChannelCredentials.Insecure); var catalogClient = new CatalogServiceClient(catalogChannel); var ratingChannel = new Channel(Configuration["RpcClients:RatingService"], ChannelCredentials.Insecure); var ratingClient = new RatingServiceClient(ratingChannel); services.AddSingleton(typeof(CartServiceClient), cartClient); services.AddSingleton(typeof(InventoryServiceClient), inventoryClient); services.AddSingleton(typeof(ReviewServiceClient), reviewClient); services.AddSingleton(typeof(PingServiceClient), pingClient); services.AddSingleton(typeof(CatalogServiceClient), catalogClient); services.AddSingleton(typeof(RatingServiceClient), ratingClient); services.AddSingleton <ICoolStoreResolverService, CoolStoreResolverService>(); services.AddSingleton <CoolStoreSchema>(); services.AddSingleton(provider => provider.GetRequiredService <CoolStoreSchema>().CoolStore); services.AddSignalR(options => options.EnableDetailedErrors = true) .AddQueryStreamHubWithTracing(); services.AddCors(options => { options.AddDefaultPolicy(policy => { policy.WithOrigins("*"); policy.AllowAnyHeader(); policy.AllowAnyMethod(); policy.AllowCredentials(); policy.WithHeaders("X-Requested-With", "authorization"); }); }); services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); }); }
/// <summary>Snippet for GetDefaultBranch</summary> public void GetDefaultBranchRequestObject() { // Snippet: GetDefaultBranch(GetDefaultBranchRequest, CallSettings) // Create client CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create(); // Initialize request argument(s) GetDefaultBranchRequest request = new GetDefaultBranchRequest { CatalogAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"), }; // Make the request GetDefaultBranchResponse response = catalogServiceClient.GetDefaultBranch(request); // End snippet }
/// <summary>Snippet for GetDefaultBranchAsync</summary> public async Task GetDefaultBranchResourceNamesAsync() { // Snippet: GetDefaultBranchAsync(CatalogName, CallSettings) // Additional: GetDefaultBranchAsync(CatalogName, CancellationToken) // Create client CatalogServiceClient catalogServiceClient = await CatalogServiceClient.CreateAsync(); // Initialize request argument(s) CatalogName catalog = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"); // Make the request GetDefaultBranchResponse response = await catalogServiceClient.GetDefaultBranchAsync(catalog); // End snippet }
/// <summary>Snippet for GetDefaultBranchAsync</summary> public async Task GetDefaultBranchAsync() { // Snippet: GetDefaultBranchAsync(string, CallSettings) // Additional: GetDefaultBranchAsync(string, CancellationToken) // Create client CatalogServiceClient catalogServiceClient = await CatalogServiceClient.CreateAsync(); // Initialize request argument(s) string catalog = "projects/[PROJECT]/locations/[LOCATION]/catalogs/[CATALOG]"; // Make the request GetDefaultBranchResponse response = await catalogServiceClient.GetDefaultBranchAsync(catalog); // End snippet }
public void ConfigureServices(IServiceCollection services) { services.AddStandardTemplate((svc, resolver) => { var cartChannel = new Channel(Configuration["RpcClients:CartService"], ChannelCredentials.Insecure); var cartClient = new CartServiceClient(cartChannel); var inventoryChannel = new Channel(Configuration["RpcClients:InventoryService"], ChannelCredentials.Insecure); var inventoryClient = new InventoryServiceClient(inventoryChannel); var reviewChannel = new Channel(Configuration["RpcClients:ReviewService"], ChannelCredentials.Insecure); var reviewClient = new ReviewServiceClient(reviewChannel); var pingClient = new PingServiceClient(reviewChannel); var catalogChannel = new Channel(Configuration["RpcClients:CatalogService"], ChannelCredentials.Insecure); var catalogClient = new CatalogServiceClient(catalogChannel); var ratingChannel = new Channel(Configuration["RpcClients:RatingService"], ChannelCredentials.Insecure); var ratingClient = new RatingServiceClient(ratingChannel); services.AddSingleton(typeof(CartServiceClient), cartClient); services.AddSingleton(typeof(InventoryServiceClient), inventoryClient); services.AddSingleton(typeof(ReviewServiceClient), reviewClient); services.AddSingleton(typeof(PingServiceClient), pingClient); services.AddSingleton(typeof(CatalogServiceClient), catalogClient); services.AddSingleton(typeof(RatingServiceClient), ratingClient); services.AddSingleton <ICoolStoreResolverService, CoolStoreResolverService>(); services.AddSingleton <CoolStoreSchema>(); services.AddSingleton(provider => provider.GetRequiredService <CoolStoreSchema>().CoolStore); services.AddCors(options => { options.AddPolicy("CorsPolicy", policy => policy .AllowAnyMethod() .AllowAnyHeader() /* https://github.com/aspnet/AspNetCore/issues/4457 */ .SetIsOriginAllowed(host => true) .AllowCredentials()); }); services.AddSignalR(options => options.EnableDetailedErrors = true) .AddQueryStreamHubWithTracing(); services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); }); }
/// <summary>Snippet for DeleteCatalogItemAsync</summary> public async Task DeleteCatalogItemResourceNamesAsync() { // Snippet: DeleteCatalogItemAsync(CatalogItemPathName, CallSettings) // Additional: DeleteCatalogItemAsync(CatalogItemPathName, CancellationToken) // Create client CatalogServiceClient catalogServiceClient = await CatalogServiceClient.CreateAsync(); // Initialize request argument(s) CatalogItemPathName name = CatalogItemPathName.FromProjectLocationCatalogCatalogItemPath("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CATALOG_ITEM_PATH]"); // Make the request await catalogServiceClient.DeleteCatalogItemAsync(name); // End snippet }
/// <summary>Snippet for DeleteCatalogItemAsync</summary> public async Task DeleteCatalogItemAsync() { // Snippet: DeleteCatalogItemAsync(string, CallSettings) // Additional: DeleteCatalogItemAsync(string, CancellationToken) // Create client CatalogServiceClient catalogServiceClient = await CatalogServiceClient.CreateAsync(); // Initialize request argument(s) string name = "projects/[PROJECT]/locations/[LOCATION]/catalogs/[CATALOG]/catalogItems/[CATALOG_ITEM_PATH]"; // Make the request await catalogServiceClient.DeleteCatalogItemAsync(name); // End snippet }
/// <summary>Snippet for ListCatalogItems</summary> public async Task ListCatalogItemsRequestObjectAsync() { // Snippet: ListCatalogItemsAsync(ListCatalogItemsRequest, CallSettings) // Create client CatalogServiceClient catalogServiceClient = await CatalogServiceClient.CreateAsync(); // Initialize request argument(s) ListCatalogItemsRequest request = new ListCatalogItemsRequest { ParentAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"), Filter = "", }; // Make the request PagedAsyncEnumerable <ListCatalogItemsResponse, CatalogItem> response = catalogServiceClient.ListCatalogItemsAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((CatalogItem 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((ListCatalogItemsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (CatalogItem 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 <CatalogItem> 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 (CatalogItem 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 }
/// <summary>Snippet for DeleteCatalogItem</summary> public void DeleteCatalogItemRequestObject() { // Snippet: DeleteCatalogItem(DeleteCatalogItemRequest, CallSettings) // Create client CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create(); // Initialize request argument(s) DeleteCatalogItemRequest request = new DeleteCatalogItemRequest { CatalogItemPathName = CatalogItemPathName.FromProjectLocationCatalogCatalogItemPath("[PROJECT]", "[LOCATION]", "[CATALOG]", "[CATALOG_ITEM_PATH]"), }; // Make the request catalogServiceClient.DeleteCatalogItem(request); // End snippet }
/// <summary>Snippet for UpdateCatalogAsync</summary> public async Task UpdateCatalogAsync() { // Snippet: UpdateCatalogAsync(Catalog, FieldMask, CallSettings) // Additional: UpdateCatalogAsync(Catalog, FieldMask, CancellationToken) // Create client CatalogServiceClient catalogServiceClient = await CatalogServiceClient.CreateAsync(); // Initialize request argument(s) Catalog catalog = new Catalog(); FieldMask updateMask = new FieldMask(); // Make the request Catalog response = await catalogServiceClient.UpdateCatalogAsync(catalog, updateMask); // End snippet }
/// <summary>Snippet for UpdateCatalog</summary> public void UpdateCatalogRequestObject() { // Snippet: UpdateCatalog(UpdateCatalogRequest, CallSettings) // Create client CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create(); // Initialize request argument(s) UpdateCatalogRequest request = new UpdateCatalogRequest { Catalog = new Catalog(), UpdateMask = new FieldMask(), }; // Make the request Catalog response = catalogServiceClient.UpdateCatalog(request); // End snippet }
/// <summary>Snippet for CreateCatalogItemAsync</summary> public async Task CreateCatalogItemAsync() { // Snippet: CreateCatalogItemAsync(string, CatalogItem, CallSettings) // Additional: CreateCatalogItemAsync(string, CatalogItem, CancellationToken) // Create client CatalogServiceClient catalogServiceClient = await CatalogServiceClient.CreateAsync(); // Initialize request argument(s) string parent = "projects/[PROJECT]/locations/[LOCATION]/catalogs/[CATALOG]"; CatalogItem catalogItem = new CatalogItem(); // Make the request CatalogItem response = await catalogServiceClient.CreateCatalogItemAsync(parent, catalogItem); // End snippet }
/// <summary>Snippet for CreateCatalogItem</summary> public void CreateCatalogItemRequestObject() { // Snippet: CreateCatalogItem(CreateCatalogItemRequest, CallSettings) // Create client CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create(); // Initialize request argument(s) CreateCatalogItemRequest request = new CreateCatalogItemRequest { ParentAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"), CatalogItem = new CatalogItem(), }; // Make the request CatalogItem response = catalogServiceClient.CreateCatalogItem(request); // End snippet }
public int SaveProduct(ProductDO objProduct) { logger.Debug("SaveProduct Json method in Catalog Controller called-" + objProduct.ProductID); int iResult = -1; CatalogServiceClient objCatalogServiceClient = new CatalogServiceClient(); try { //int iUserProfileID = ((UserDO)SessionManager.ReadSession(UtilityConstants.SessionNames.USER)).UserProfileID; //objProduct.CreatedBy = iUserProfileID; iResult = objCatalogServiceClient.SaveProduct(objProduct); } catch (Exception objException) { logger.Error("Method SaveResource - Error." + objException.Message); } finally { objCatalogServiceClient.Close(); } return iResult; }
public void can_create() { CatalogServiceClient serviceClient = new CatalogServiceClient(); }