public void ResourcesCorpusSegmentTargetAddPostTest() { CorpusSegmentListResponse corpusSegmentListResponse = new CorpusSegmentListResponse(); corpusSegmentListResponse = corpusApi.ResourcesCorpusSegmentListGet(corpusId, null, null, null); CorpusSegmentAddTargetRequest corpusSegmentAddTargetRequest = new CorpusSegmentAddTargetRequest(); CorpusSegmentAddTargetResponse corpusSegmentAddTargetResponse = new CorpusSegmentAddTargetResponse(); corpusSegmentAddTargetRequest.CorpusId = corpusId; corpusSegmentAddTargetRequest.SegId = segmentId; CorpusAddSegmentTarget corpusAddSegmentTarget = new CorpusAddSegmentTarget(); corpusAddSegmentTarget.Lang = "fr"; corpusAddSegmentTarget.Target = "nouveau segment cible"; List<CorpusAddSegmentTarget> segList = new List<CorpusAddSegmentTarget>(); segList.Add(corpusAddSegmentTarget); corpusSegmentAddTargetRequest.Targets = segList; corpusSegmentAddTargetRequest.SegId = corpusSegmentListResponse.Segments[0].Id; corpusSegmentAddTargetResponse = corpusApi.ResourcesCorpusSegmentTargetAddPost(corpusSegmentAddTargetRequest, null); Assert.IsNotNull(corpusSegmentAddTargetResponse.Added); }
/// <summary> /// Add corpus segment targets Add targets to a segment in a corpus.\n /// </summary> /// <param name="Body">List of targets to add</param>/// <param name="Callback">Javascript callback function name for JSONP Support\n</param> /// <returns>CorpusSegmentAddTargetResponse</returns> public async Task<CorpusSegmentAddTargetResponse> ResourcesCorpusSegmentTargetAddPostAsync (CorpusSegmentAddTargetRequest Body, string Callback) { // verify the required parameter 'Body' is set if (Body == null) throw new ApiException(400, "Missing required parameter 'Body' when calling ResourcesCorpusSegmentTargetAddPost"); var path = "/resources/corpus/segment/target/add"; path = path.Replace("{format}", "json"); var queryParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>(); var fileParams = new Dictionary<String, String>(); String postBody = null; if (Callback != null) queryParams.Add("callback", apiClient.ParameterToString(Callback)); // query parameter postBody = apiClient.Serialize(Body); // http body (model) parameter // authentication setting, if any String[] authSettings = new String[] { "accessToken", "apiKey" }; // make the HTTP request IRestResponse response = (IRestResponse) await apiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); if (((int)response.StatusCode) >= 400) { throw new ApiException ((int)response.StatusCode, "Error calling ResourcesCorpusSegmentTargetAddPost: " + response.Content, response.Content); } return (CorpusSegmentAddTargetResponse) apiClient.Deserialize(response.Content, typeof(CorpusSegmentAddTargetResponse)); }