Beispiel #1
0
 /// <summary>Snippet for GetKnowledgeBase</summary>
 public void GetKnowledgeBaseResourceNames()
 {
     // Snippet: GetKnowledgeBase(KnowledgeBaseName, CallSettings)
     // Create client
     KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.Create();
     // Initialize request argument(s)
     KnowledgeBaseName name = KnowledgeBaseName.FromProjectKnowledgeBase("[PROJECT]", "[KNOWLEDGE_BASE]");
     // Make the request
     KnowledgeBase response = knowledgeBasesClient.GetKnowledgeBase(name);
     // End snippet
 }
Beispiel #2
0
 /// <summary>Snippet for GetKnowledgeBase</summary>
 public void GetKnowledgeBase()
 {
     // Snippet: GetKnowledgeBase(string, CallSettings)
     // Create client
     KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.Create();
     // Initialize request argument(s)
     string name = "projects/[PROJECT]/knowledgeBases/[KNOWLEDGE_BASE]";
     // Make the request
     KnowledgeBase response = knowledgeBasesClient.GetKnowledgeBase(name);
     // End snippet
 }
Beispiel #3
0
 /// <summary>Snippet for UpdateKnowledgeBase</summary>
 public void UpdateKnowledgeBase()
 {
     // Snippet: UpdateKnowledgeBase(KnowledgeBase, FieldMask, CallSettings)
     // Create client
     KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.Create();
     // Initialize request argument(s)
     KnowledgeBase knowledgeBase = new KnowledgeBase();
     FieldMask     updateMask    = new FieldMask();
     // Make the request
     KnowledgeBase response = knowledgeBasesClient.UpdateKnowledgeBase(knowledgeBase, updateMask);
     // End snippet
 }
Beispiel #4
0
 /// <summary>Snippet for CreateKnowledgeBase</summary>
 public void CreateKnowledgeBaseResourceNames2()
 {
     // Snippet: CreateKnowledgeBase(LocationName, KnowledgeBase, CallSettings)
     // Create client
     KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.Create();
     // Initialize request argument(s)
     LocationName  parent        = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
     KnowledgeBase knowledgeBase = new KnowledgeBase();
     // Make the request
     KnowledgeBase response = knowledgeBasesClient.CreateKnowledgeBase(parent, knowledgeBase);
     // End snippet
 }
Beispiel #5
0
 /// <summary>Snippet for CreateKnowledgeBase</summary>
 public void CreateKnowledgeBase()
 {
     // Snippet: CreateKnowledgeBase(string, KnowledgeBase, CallSettings)
     // Create client
     KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.Create();
     // Initialize request argument(s)
     string        parent        = "projects/[PROJECT]";
     KnowledgeBase knowledgeBase = new KnowledgeBase();
     // Make the request
     KnowledgeBase response = knowledgeBasesClient.CreateKnowledgeBase(parent, knowledgeBase);
     // End snippet
 }
Beispiel #6
0
 /// <summary>Snippet for GetKnowledgeBase</summary>
 public void GetKnowledgeBaseRequestObject()
 {
     // Snippet: GetKnowledgeBase(GetKnowledgeBaseRequest, CallSettings)
     // Create client
     KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.Create();
     // Initialize request argument(s)
     GetKnowledgeBaseRequest request = new GetKnowledgeBaseRequest
     {
         KnowledgeBaseName = KnowledgeBaseName.FromProjectKnowledgeBase("[PROJECT]", "[KNOWLEDGE_BASE]"),
     };
     // Make the request
     KnowledgeBase response = knowledgeBasesClient.GetKnowledgeBase(request);
     // End snippet
 }
Beispiel #7
0
 /// <summary>Snippet for UpdateKnowledgeBase</summary>
 public void UpdateKnowledgeBaseRequestObject()
 {
     // Snippet: UpdateKnowledgeBase(UpdateKnowledgeBaseRequest, CallSettings)
     // Create client
     KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.Create();
     // Initialize request argument(s)
     UpdateKnowledgeBaseRequest request = new UpdateKnowledgeBaseRequest
     {
         KnowledgeBase = new KnowledgeBase(),
         UpdateMask    = new FieldMask(),
     };
     // Make the request
     KnowledgeBase response = knowledgeBasesClient.UpdateKnowledgeBase(request);
     // End snippet
 }
Beispiel #8
0
 /// <summary>Snippet for CreateKnowledgeBase</summary>
 public void CreateKnowledgeBaseRequestObject()
 {
     // Snippet: CreateKnowledgeBase(CreateKnowledgeBaseRequest, CallSettings)
     // Create client
     KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.Create();
     // Initialize request argument(s)
     CreateKnowledgeBaseRequest request = new CreateKnowledgeBaseRequest
     {
         ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
         KnowledgeBase       = new KnowledgeBase(),
     };
     // Make the request
     KnowledgeBase response = knowledgeBasesClient.CreateKnowledgeBase(request);
     // End snippet
 }
Beispiel #9
0
        /// <summary>Snippet for ListKnowledgeBases</summary>
        public void ListKnowledgeBasesRequestObject()
        {
            // Snippet: ListKnowledgeBases(ListKnowledgeBasesRequest, CallSettings)
            // Create client
            KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.Create();
            // Initialize request argument(s)
            ListKnowledgeBasesRequest request = new ListKnowledgeBasesRequest
            {
                ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
                Filter = "",
            };
            // Make the request
            PagedEnumerable <ListKnowledgeBasesResponse, KnowledgeBase> response = knowledgeBasesClient.ListKnowledgeBases(request);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (KnowledgeBase item in response)
            {
                // Do something with each item
                Console.WriteLine(item);
            }

            // Or iterate over pages (of server-defined size), performing one RPC per page
            foreach (ListKnowledgeBasesResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (KnowledgeBase 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 <KnowledgeBase> singlePage = response.ReadPage(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (KnowledgeBase 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
        }
Beispiel #10
0
        /// <summary>Snippet for DeleteKnowledgeBase</summary>
        public void DeleteKnowledgeBaseRequestObject()
        {
            // Snippet: DeleteKnowledgeBase(DeleteKnowledgeBaseRequest, CallSettings)
            // Create client
            KnowledgeBasesClient knowledgeBasesClient = KnowledgeBasesClient.Create();
            // Initialize request argument(s)
            DeleteKnowledgeBaseRequest request = new DeleteKnowledgeBaseRequest
            {
                KnowledgeBaseName = KnowledgeBaseName.FromProjectKnowledgeBase("[PROJECT]", "[KNOWLEDGE_BASE]"),
                Force             = false,
            };

            // Make the request
            knowledgeBasesClient.DeleteKnowledgeBase(request);
            // End snippet
        }