Пример #1
0
 /// <summary>
 /// Creates a new <see cref="Translator"/> object.
 /// </summary>
 /// <param name="apiKey">Your subscription key for the Microsoft Translator Text API.</param>
 public Translator(string apiKey)
 {
     if (string.IsNullOrWhiteSpace(apiKey))
     {
         throw new ArgumentNullException(nameof(apiKey));
     }
     _authToken = new AzureAuthToken(apiKey);
 }
Пример #2
0
 /// <summary>
 /// Creates a new <see cref="Translator"/> object.
 /// </summary>
 /// <param name="apiKey">Your subscription key for the Microsoft Translator Text API.</param>
 /// <param name="customHttpClient">alternate http client</param>
 public Translator(string apiKey, HttpClient customHttpClient = null)
 {
     _httpClient = customHttpClient ?? DefaultHttpClient;
     if (string.IsNullOrWhiteSpace(apiKey))
     {
         throw new ArgumentNullException(nameof(apiKey));
     }
     _authToken = new AzureAuthToken(apiKey);
 }
Пример #3
0
 /// <summary>
 /// Creates a new <see cref="Translator"/> object.
 /// </summary>
 /// <param name="apiKey">Your subscription key for the Microsoft Translator Text API.</param>
 public Translator(string apiKey)
 {
     _authToken     = new AzureAuthToken(apiKey);
     _postProcessor = new PostProcessTranslator();
 }