Exemple #1
0
        public async Task AddTermForConceptWithCustomFields(string termbaseId)
        {
            var groupShareClient = Helper.GsClient;
            var conceptId        = await CreateConceptWithCustomFields(termbaseId, "NewEntry");

            var conceptRequest  = new ConceptResponse(termbaseId, conceptId);
            var conceptResponse = await groupShareClient.Terminology.GetConcept(conceptRequest);

            var newTerm = new TermbaseTerms
            {
                Attributes   = null,
                Transactions = new List <Transactions>
                {
                    new Transactions
                    {
                        DateTime = DateTime.Now,
                        Id       = null,
                        Username = "",
                        Details  = new TransactionsDetails
                        {
                            User = "",
                            Type = "Create"
                        }
                    }
                },
                Text = "Added term with custom fields"
            };

            conceptResponse.Concept.Languages[0].Terms.Add(newTerm);

            var updatedResponse = await groupShareClient.Terminology.EditConcept(termbaseId, conceptResponse);

            await DeleteConcept(termbaseId, conceptId);
        }
Exemple #2
0
        public async Task UpdateNewCreatedConcept(string termbaseId, string conceptId)
        {
            var groupShareClient = Helper.GsClient;

            var conceptRequest  = new ConceptResponse(termbaseId, conceptId);
            var conceptResponse = await groupShareClient.Terminology.GetConcept(conceptRequest);

            conceptResponse.Concept.Languages[0].Terms[0].Text = "json";

            var updatedResponse = await groupShareClient.Terminology.EditConcept(termbaseId, conceptResponse);
        }
        public async Task GetConcept()
        {
            var groupShareClient = Helper.GsClient;
            var conceptId        = await CreateConcept(Helper.TermbaseId, "TestEntry");

            var conceptRequest = new ConceptResponse(Helper.TermbaseId, conceptId);

            var conceptResponse = await groupShareClient.Terminology.GetConcept(conceptRequest);

            Assert.Equal(conceptResponse.Concept.Id, conceptId);
            await DeleteConcept(Helper.TermbaseId, conceptId);
        }
Exemple #4
0
        public async Task GetConcept(string termbaseId, string conceptId)
        {
            var groupShareClient = Helper.GsClient;
            var conceptRequest   = new ConceptResponse(termbaseId, conceptId);

            var conceptResponse = await groupShareClient.Terminology.GetConcept(conceptRequest);

            Assert.Equal(conceptResponse.Concept.Id, conceptId);

            var conceptResponse1 = await groupShareClient.Terminology.GetConcept(termbaseId, conceptId);

            Assert.Equal(conceptResponse1.Concept.Id, conceptId);
        }
Exemple #5
0
        public async Task UpdateConcept(string termbaseId)
        {
            var groupShareClient = Helper.GsClient;
            var conceptId        = await CreateConcept(termbaseId, "NewEntry");

            var conceptRequest  = new ConceptResponse(termbaseId, conceptId);
            var conceptResponse = await groupShareClient.Terminology.GetConcept(conceptRequest);

            conceptResponse.Concept.Languages[0].Terms[0].Text = "updated";

            var updatedResponse = await groupShareClient.Terminology.EditConcept(termbaseId, conceptResponse);

            var updatedText = updatedResponse.Concept.Languages[0].Terms[0].Text;

            Assert.Equal("updated", updatedText);
            await DeleteConcept(termbaseId, conceptId);
        }
Exemple #6
0
        public async Task UpdateConceptWithCustomFields(string termbaseId)
        {
            var groupShareClient = Helper.GsClient;
            var conceptId        = await CreateConceptWithCustomFields(termbaseId, "conceptName");

            var conceptRequest  = new ConceptResponse(termbaseId, conceptId);
            var conceptResponse = await groupShareClient.Terminology.GetConcept(conceptRequest);

            conceptResponse.Concept.Languages[0].Terms[0].Text = "Updated Term From kit with custom fields";

            var updatedResponse = await groupShareClient.Terminology.EditConcept(termbaseId, conceptResponse);

            var updatedText = updatedResponse.Concept.Languages[0].Terms[0].Text;

            Assert.Equal("Updated Term From kit with custom fields", updatedText);
            await DeleteConcept(termbaseId, conceptId);
        }
        public async Task AddTermForConceptWithCustomFields()
        {
            var groupShareClient = Helper.GsClient;
            var conceptId        = await CreateConceptWithCustomFields(Helper.TermbaseId, "TestEntry");

            var conceptRequest  = new ConceptResponse(Helper.TermbaseId, conceptId);
            var conceptResponse = await groupShareClient.Terminology.GetConcept(conceptRequest);

            var newTerm = new TermbaseTerms
            {
                Attributes   = null,
                Transactions = new List <Transactions>
                {
                    new Transactions
                    {
                        DateTime = DateTime.Now,
                        Id       = null,
                        Username = "",
                        Details  = new TransactionsDetails
                        {
                            User = "",
                            Type = "Create"
                        }
                    }
                },
                Text = "Added term with custom fields"
            };

            conceptResponse.Concept.Languages[0].Terms.Add(newTerm);

            var updatedResponse = await groupShareClient.Terminology.EditConcept(Helper.TermbaseId, conceptResponse);

            var query    = "Added term with custom fields";
            var language = conceptResponse.Concept.Languages[0].Language.Id;
            var request  = new SearchTermRequest(Helper.TermbaseId, language, query);

            var searchedResponse = await groupShareClient.Terminology.SearchTerm(request);

            var searchedWord = searchedResponse.Terms.Where(s => s.TermText == query);

            Assert.True(searchedWord != null);
            await DeleteConcept(Helper.TermbaseId, conceptId);
        }
        public async Task SearchTerm()
        {
            var groupShareClient = Helper.GsClient;
            var conceptId        = await CreateConcept(Helper.TermbaseId, "NewEntry");

            var conceptRequest  = new ConceptResponse(Helper.TermbaseId, conceptId);
            var conceptResponse = await groupShareClient.Terminology.GetConcept(conceptRequest);

            var newTerm = new TermbaseTerms
            {
                Attributes   = null,
                Transactions = new List <Transactions>
                {
                    new Transactions
                    {
                        DateTime = DateTime.Now,
                        Id       = null,
                        Username = "",
                        Details  = new TransactionsDetails
                        {
                            User = "",
                            Type = "Create"
                        }
                    }
                },
                Text = "gsKitTest"
            };

            conceptResponse.Concept.Languages[0].Terms.Add(newTerm);
            var language = conceptResponse.Concept.Languages[0].Language.Id;
            var request  = new SearchTermRequest(Helper.TermbaseId, language, "gsKitTest");

            var searchedResponse = await groupShareClient.Terminology.SearchTerm(request);

            var searchedWord = searchedResponse.Terms.Where(s => s.TermText == "gsKitTest");

            Assert.True(searchedWord != null);
            await DeleteConcept(Helper.TermbaseId, conceptId);
        }
 /// <summary>
 /// Gets <see cref="Models.Response.ConceptDetails"/>
 /// </summary>
 /// <param name="response"><see cref="ConceptResponse"/></param>
 /// <remarks>
 /// This method requires authentication.
 /// See the <a href="http://gs2017dev.sdl.com:41234/documentation/api/index#/">API documentation</a> for more information.
 /// </remarks>
 /// <exception cref="AuthorizationException">
 /// Thrown when the current user does not have permission to make the request.
 /// </exception>
 /// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
 /// <returns> <see cref="Models.Response.ConceptDetails"/></returns>
 public async Task <Models.Response.ConceptDetails> GetConcept(ConceptResponse response)
 {
     Ensure.ArgumentNotNull(response, "request");
     return(await ApiConnection.Get <Models.Response.ConceptDetails>(ApiUrls.GetConcepts(response), null));
 }