コード例 #1
0
        public void ResourcesDictionaryAddPostTest()
        {
            DictionaryAddResponse dictionaryAddResponse = new DictionaryAddResponse();
            DictionaryAddBody dictionaryAddBody = new DictionaryAddBody();
            DictionaryAddInput dictionaryAddInput = new DictionaryAddInput();
            dictionaryAddInput.SourceLang = "en";
            dictionaryAddInput.TargetLangs = "fr";
            dictionaryAddInput.Name = "testCsharpClient";
            dictionaryAddInput.Type = "UD";
            dictionaryAddInput.Comments = "This dictionary has been created for csharp client testing purposes";

            dictionaryAddBody.Dictionary = dictionaryAddInput;
            dictionaryAddResponse = dictionaryApi.ResourcesDictionaryAddPost(dictionaryAddBody);
            Assert.IsNotNull(dictionaryAddResponse.Added);
            if (dictionaryAddResponse != null)
            {
                dictionaryId = dictionaryAddResponse.Added.Id;
            }
        }
コード例 #2
0
	 /// <summary>
    /// Add dictionary Add a new dictionary.
    /// </summary>
    /// <param name="Input">Input with dictionary information</param>
    /// <returns>DictionaryAddResponse</returns>
    public async Task<DictionaryAddResponse> ResourcesDictionaryAddPostAsync (DictionaryAddBody Input) {

      
          // verify the required parameter 'Input' is set
          if (Input == null) throw new ApiException(400, "Missing required parameter 'Input' when calling ResourcesDictionaryAddPost");
      

      var path = "/resources/dictionary/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;

      
      
      
      postBody = apiClient.Serialize(Input); // 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 ResourcesDictionaryAddPost: " + response.Content, response.Content);
      }
      return (DictionaryAddResponse) apiClient.Deserialize(response.Content, typeof(DictionaryAddResponse));
    }