Skip to content

Commit d11da58

Browse files
committed
feat(Discovery): Added learning opt-out and language enum
1 parent 3be0180 commit d11da58

File tree

2 files changed

+88
-2
lines changed

2 files changed

+88
-2
lines changed

Scripts/Services/Discovery/v1/DataModels.cs

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,89 @@ public class XPathPatterns
573573
[fsObject]
574574
public class EnrichmentOptions
575575
{
576+
/// <summary>
577+
/// ISO 639-1 code indicating the language to use for the analysis. This code overrides the automatic language
578+
/// detection performed by the service. Valid codes are `ar` (Arabic), `en` (English), `fr` (French), `de`
579+
/// (German), `it` (Italian), `pt` (Portuguese), `ru` (Russian), `es` (Spanish), and `sv` (Swedish). **Note:**
580+
/// Not all features support all languages, automatic detection is recommended.
581+
/// </summary>
582+
/// <value>
583+
/// ISO 639-1 code indicating the language to use for the analysis. This code overrides the automatic language
584+
/// detection performed by the service. Valid codes are `ar` (Arabic), `en` (English), `fr` (French), `de`
585+
/// (German), `it` (Italian), `pt` (Portuguese), `ru` (Russian), `es` (Spanish), and `sv` (Swedish). **Note:**
586+
/// Not all features support all languages, automatic detection is recommended.
587+
/// </value>
588+
public enum LanguageEnum
589+
{
590+
591+
/// <summary>
592+
/// Enum AR for ar
593+
/// </summary>
594+
[EnumMember(Value = "ar")]
595+
AR,
596+
597+
/// <summary>
598+
/// Enum EN for en
599+
/// </summary>
600+
[EnumMember(Value = "en")]
601+
EN,
602+
603+
/// <summary>
604+
/// Enum FR for fr
605+
/// </summary>
606+
[EnumMember(Value = "fr")]
607+
FR,
608+
609+
/// <summary>
610+
/// Enum DE for de
611+
/// </summary>
612+
[EnumMember(Value = "de")]
613+
DE,
614+
615+
/// <summary>
616+
/// Enum IT for it
617+
/// </summary>
618+
[EnumMember(Value = "it")]
619+
IT,
620+
621+
/// <summary>
622+
/// Enum PT for pt
623+
/// </summary>
624+
[EnumMember(Value = "pt")]
625+
PT,
626+
627+
/// <summary>
628+
/// Enum RU for ru
629+
/// </summary>
630+
[EnumMember(Value = "ru")]
631+
RU,
632+
633+
/// <summary>
634+
/// Enum ES for es
635+
/// </summary>
636+
[EnumMember(Value = "es")]
637+
ES,
638+
639+
/// <summary>
640+
/// Enum SV for sv
641+
/// </summary>
642+
[EnumMember(Value = "sv")]
643+
SV
644+
}
645+
/// <summary>
646+
/// ISO 639-1 code indicating the language to use for the analysis. This code overrides the automatic language
647+
/// detection performed by the service. Valid codes are `ar` (Arabic), `en` (English), `fr` (French), `de`
648+
/// (German), `it` (Italian), `pt` (Portuguese), `ru` (Russian), `es` (Spanish), and `sv` (Swedish). **Note:**
649+
/// Not all features support all languages, automatic detection is recommended.
650+
/// </summary>
651+
/// <value>
652+
/// ISO 639-1 code indicating the language to use for the analysis. This code overrides the automatic language
653+
/// detection performed by the service. Valid codes are `ar` (Arabic), `en` (English), `fr` (French), `de`
654+
/// (German), `it` (Italian), `pt` (Portuguese), `ru` (Russian), `es` (Spanish), and `sv` (Swedish). **Note:**
655+
/// Not all features support all languages, automatic detection is recommended.
656+
/// </value>
657+
[fsProperty("language")]
658+
public LanguageEnum? Language { get; set; }
576659
/// <summary>
577660
/// A comma sepeated list of analyses that should be applied when using the alchemy_language enrichment.
578661
/// See the the service documentation for details on each extract option.

Scripts/Services/Discovery/v1/Discovery.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2516,7 +2516,7 @@ private void OnUpdateDocumentResponse(RESTConnector.Request req, RESTConnector.R
25162516
/// are returned is 10, and the offset is 8, it returns the last two results.</param>
25172517
/// <param name="customData">Optional custom data.</param>
25182518
/// <returns>True if the call succeeds, false if the call is unsuccessful.</returns>
2519-
public bool Query(SuccessCallback<QueryResponse> successCallback, FailCallback failCallback, string environmentID, string collectionID, string filter, string query, string aggregation, int count, string _return, int offset, Dictionary<string, object> customData = null)
2519+
public bool Query(SuccessCallback<QueryResponse> successCallback, FailCallback failCallback, string environmentID, string collectionID, string filter, string query, string aggregation, int count, string _return, int offset, bool? loggingOptOut = null, Dictionary<string, object> customData = null)
25202520
{
25212521
if (successCallback == null)
25222522
throw new ArgumentNullException("successCallback");
@@ -2551,7 +2551,10 @@ public bool Query(SuccessCallback<QueryResponse> successCallback, FailCallback f
25512551
req.Parameters["aggregation"] = aggregation;
25522552

25532553
if (!string.IsNullOrEmpty(_return))
2554-
req.Parameters["_return"] = _return;
2554+
req.Parameters["return"] = _return;
2555+
2556+
if (!string.IsNullOrEmpty(loggingOptOut)
2557+
restRequest.WithHeader("X-Watson-Logging-Opt-Out", loggingOptOut);
25552558

25562559
req.Parameters["offset"] = offset;
25572560
req.Parameters["count"] = count;

0 commit comments

Comments
 (0)