1
1
/*
2
- * (C) Copyright IBM Corp. 2020, 2023 .
2
+ * (C) Copyright IBM Corp. 2024 .
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5
5
* the License. You may obtain a copy of the License at
@@ -46,6 +46,14 @@ public class EnrichmentOptions extends GenericModel {
46
46
@ SerializedName ("top_k" )
47
47
protected Long topK ;
48
48
49
+ protected String url ;
50
+ protected String version ;
51
+ protected String secret ;
52
+ protected WebhookHeader headers ;
53
+
54
+ @ SerializedName ("location_encoding" )
55
+ protected String locationEncoding ;
56
+
49
57
/** Builder. */
50
58
public static class Builder {
51
59
private List <String > languages ;
@@ -56,6 +64,11 @@ public static class Builder {
56
64
private String modelId ;
57
65
private Double confidenceThreshold ;
58
66
private Long topK ;
67
+ private String url ;
68
+ private String version ;
69
+ private String secret ;
70
+ private WebhookHeader headers ;
71
+ private String locationEncoding ;
59
72
60
73
/**
61
74
* Instantiates a new Builder from an existing EnrichmentOptions instance.
@@ -71,6 +84,11 @@ private Builder(EnrichmentOptions enrichmentOptions) {
71
84
this .modelId = enrichmentOptions .modelId ;
72
85
this .confidenceThreshold = enrichmentOptions .confidenceThreshold ;
73
86
this .topK = enrichmentOptions .topK ;
87
+ this .url = enrichmentOptions .url ;
88
+ this .version = enrichmentOptions .version ;
89
+ this .secret = enrichmentOptions .secret ;
90
+ this .headers = enrichmentOptions .headers ;
91
+ this .locationEncoding = enrichmentOptions .locationEncoding ;
74
92
}
75
93
76
94
/** Instantiates a new builder. */
@@ -86,9 +104,9 @@ public EnrichmentOptions build() {
86
104
}
87
105
88
106
/**
89
- * Adds an languages to languages.
107
+ * Adds a new element to languages.
90
108
*
91
- * @param languages the new languages
109
+ * @param languages the new element to be added
92
110
* @return the EnrichmentOptions builder
93
111
*/
94
112
public Builder addLanguages (String languages ) {
@@ -187,6 +205,61 @@ public Builder topK(long topK) {
187
205
this .topK = topK ;
188
206
return this ;
189
207
}
208
+
209
+ /**
210
+ * Set the url.
211
+ *
212
+ * @param url the url
213
+ * @return the EnrichmentOptions builder
214
+ */
215
+ public Builder url (String url ) {
216
+ this .url = url ;
217
+ return this ;
218
+ }
219
+
220
+ /**
221
+ * Set the version.
222
+ *
223
+ * @param version the version
224
+ * @return the EnrichmentOptions builder
225
+ */
226
+ public Builder version (String version ) {
227
+ this .version = version ;
228
+ return this ;
229
+ }
230
+
231
+ /**
232
+ * Set the secret.
233
+ *
234
+ * @param secret the secret
235
+ * @return the EnrichmentOptions builder
236
+ */
237
+ public Builder secret (String secret ) {
238
+ this .secret = secret ;
239
+ return this ;
240
+ }
241
+
242
+ /**
243
+ * Set the headers.
244
+ *
245
+ * @param headers the headers
246
+ * @return the EnrichmentOptions builder
247
+ */
248
+ public Builder headers (WebhookHeader headers ) {
249
+ this .headers = headers ;
250
+ return this ;
251
+ }
252
+
253
+ /**
254
+ * Set the locationEncoding.
255
+ *
256
+ * @param locationEncoding the locationEncoding
257
+ * @return the EnrichmentOptions builder
258
+ */
259
+ public Builder locationEncoding (String locationEncoding ) {
260
+ this .locationEncoding = locationEncoding ;
261
+ return this ;
262
+ }
190
263
}
191
264
192
265
protected EnrichmentOptions () {}
@@ -200,6 +273,11 @@ protected EnrichmentOptions(Builder builder) {
200
273
modelId = builder .modelId ;
201
274
confidenceThreshold = builder .confidenceThreshold ;
202
275
topK = builder .topK ;
276
+ url = builder .url ;
277
+ version = builder .version ;
278
+ secret = builder .secret ;
279
+ headers = builder .headers ;
280
+ locationEncoding = builder .locationEncoding ;
203
281
}
204
282
205
283
/**
@@ -312,4 +390,69 @@ public Double confidenceThreshold() {
312
390
public Long topK () {
313
391
return topK ;
314
392
}
393
+
394
+ /**
395
+ * Gets the url.
396
+ *
397
+ * <p>A URL that uses the SSL protocol (begins with https) for the webhook. Required when type is
398
+ * `webhook`. Not valid when creating any other type of enrichment.
399
+ *
400
+ * @return the url
401
+ */
402
+ public String url () {
403
+ return url ;
404
+ }
405
+
406
+ /**
407
+ * Gets the version.
408
+ *
409
+ * <p>The Discovery API version that allows to distinguish the schema. The version is specified in
410
+ * the `yyyy-mm-dd` format. Optional when `type` is `webhook`. Not valid when creating any other
411
+ * type of enrichment.
412
+ *
413
+ * @return the version
414
+ */
415
+ public String version () {
416
+ return version ;
417
+ }
418
+
419
+ /**
420
+ * Gets the secret.
421
+ *
422
+ * <p>A private key can be included in the request to authenticate with the external service. The
423
+ * maximum length is 1,024 characters. Optional when `type` is `webhook`. Not valid when creating
424
+ * any other type of enrichment.
425
+ *
426
+ * @return the secret
427
+ */
428
+ public String secret () {
429
+ return secret ;
430
+ }
431
+
432
+ /**
433
+ * Gets the headers.
434
+ *
435
+ * <p>An array of headers to pass with the HTTP request. Optional when `type` is `webhook`. Not
436
+ * valid when creating any other type of enrichment.
437
+ *
438
+ * @return the headers
439
+ */
440
+ public WebhookHeader headers () {
441
+ return headers ;
442
+ }
443
+
444
+ /**
445
+ * Gets the locationEncoding.
446
+ *
447
+ * <p>Discovery calculates offsets of the text's location with this encoding type in documents.
448
+ * Use the same location encoding type in both Discovery and external enrichment for a document.
449
+ *
450
+ * <p>These encoding types are supported: `utf-8`, `utf-16`, and `utf-32`. Optional when `type` is
451
+ * `webhook`. Not valid when creating any other type of enrichment.
452
+ *
453
+ * @return the locationEncoding
454
+ */
455
+ public String locationEncoding () {
456
+ return locationEncoding ;
457
+ }
315
458
}
0 commit comments