Skip to content

Commit ab6109d

Browse files
authored
Merge pull request #514 from watson-developer-cloud/6029-regenerate-sdk-2
Update SDK
2 parents 830bc85 + a0240e5 commit ab6109d

File tree

11 files changed

+387
-59
lines changed

11 files changed

+387
-59
lines changed

README.md

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -179,20 +179,21 @@ void Start()
179179
}
180180
```
181181

182-
### ibm-credentials.env
183-
You can create an ibm-credentials.env file for authentication. This has the basic format
184-
```
185-
VISUAL_RECOGNITION_APIKEY=<visual-recognition-apikey>
186-
VISUAL_RECOGNITION_URL=<visual-recognition-service-url>
187-
ASSISTANT_APIKEY=<assistant-apikey>
188-
ASSISTANT_URL=<assistant-service-url>
189-
```
190-
The SDK will search for this file in the following order
191-
- Path specified by environmental variable `IBM_CREDENTIALS_FILE`
192-
- System home directory
193-
- Top level of the project directory
182+
### Supplying credentials
183+
184+
There are two ways to supply the credentials you found above to the SDK for authentication.
185+
186+
#### Credential file (easier!)
187+
188+
With a credential file, you just need to put the file in the right place and the SDK will do the work of parsing it and authenticating. You can get this file by clicking the **Download** button for the credentials in the **Manage** tab of your service instance.
189+
190+
The file downloaded will be called `ibm-credentials.env`. This is the name the SDK will search for and **must** be preserved unless you want to configure the file path (more on that later). The SDK will look for your `ibm-credentials.env` file in the following places (in order):
191+
192+
- Your system's home directory
193+
- The top-level directory of the project you're using the SDK in
194+
195+
As long as you set that up correctly, you don't have to worry about setting any authentication options in your code. So, for example, if you created and downloaded the credential file for your Discovery instance, you just need to do the following:
194196

195-
Using a `ibm-credentials.env` file you can easily instantiate and authenticate a service. If you are using an IAM Apikey you will need to invoke this using a coroutine to wait for the authorization token.
196197
```cs
197198
public IEnumerator ExampleAutoService()
198199
{
@@ -205,7 +206,23 @@ public IEnumerator ExampleAutoService()
205206

206207
var listWorkspacesResult = assistantService.ListWorkspaces();
207208
}
208-
```
209+
```
210+
211+
And that's it!
212+
213+
If you're using more than one service at a time in your code and get two different `ibm-credentials.env` files, just put the contents together in one `ibm-credentials.env` file and the SDK will handle assigning credentials to their appropriate services.
214+
215+
If you would like to configure the location/name of your credential file, you can set an environment variable called `IBM_CREDENTIALS_FILE`. **This will take precedence over the locations specified above.** Here's how you can do that:
216+
217+
```bash
218+
export IBM_CREDENTIALS_FILE="<path>"
219+
```
220+
221+
where `<path>` is something like `/home/user/Downloads/<file_name>.env`.
222+
223+
#### Manually
224+
225+
If you'd prefer to set authentication values manually in your code, the SDK supports that as well. The way you'll do this depends on what type of credentials your service instance gives you.
209226

210227
## Callbacks
211228
Success and failure callbacks are required. You can specify the return type in the callback.

Scripts/Services/CompareComply/v1/Models/Attribute.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ public enum Type
4545
/// Enum location for Location
4646
/// </summary>
4747
[EnumMember(Value = "Location")]
48-
Location
48+
Location,
49+
/// <summary>
50+
/// Enum ADDRESS for Address
51+
/// </summary>
52+
[EnumMember(Value = "Address")]
53+
ADDRESS,
4954
}
5055

5156
/// <summary>

Scripts/Services/CompareComply/v1/Models/BodyCells.cs

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,35 +64,42 @@ public class BodyCells
6464
[fsProperty("column_index_end")]
6565
public long? ColumnIndexEnd { get; set; }
6666
/// <summary>
67-
/// Gets or Sets rowHeaderIds
67+
/// An array of values, each being the `id` value of a row header that is applicable to this body cell.
6868
/// </summary>
6969
[fsProperty("row_header_ids")]
70-
public List<RowHeaderIds> RowHeaderIds { get; set; }
70+
public List<string> RowHeaderIds { get; set; }
7171
/// <summary>
72-
/// Gets or Sets rowHeaderTexts
72+
/// An array of values, each being the `text` value of a row header that is applicable to this body cell.
7373
/// </summary>
7474
[fsProperty("row_header_texts")]
75-
public List<RowHeaderTexts> RowHeaderTexts { get; set; }
75+
public List<string> RowHeaderTexts { get; set; }
7676
/// <summary>
77-
/// Gets or Sets rowHeaderTextsNormalized
77+
/// If you provide customization input, the normalized version of the row header texts according to the
78+
/// customization; otherwise, the same value as `row_header_texts`.
7879
/// </summary>
7980
[fsProperty("row_header_texts_normalized")]
80-
public List<RowHeaderTextsNormalized> RowHeaderTextsNormalized { get; set; }
81+
public List<string> RowHeaderTextsNormalized { get; set; }
8182
/// <summary>
82-
/// Gets or Sets columnHeaderIds
83+
/// An array of values, each being the `id` value of a column header that is applicable to the current cell.
8384
/// </summary>
8485
[fsProperty("column_header_ids")]
85-
public List<ColumnHeaderIds> ColumnHeaderIds { get; set; }
86+
public List<string> ColumnHeaderIds { get; set; }
8687
/// <summary>
87-
/// Gets or Sets columnHeaderTexts
88+
/// An array of values, each being the `id` value of a column header that is applicable to the current cell.
8889
/// </summary>
8990
[fsProperty("column_header_texts")]
90-
public List<ColumnHeaderTexts> ColumnHeaderTexts { get; set; }
91+
public List<string> ColumnHeaderTexts { get; set; }
9192
/// <summary>
92-
/// Gets or Sets columnHeaderTextsNormalized
93+
/// If you provide customization input, the normalized version of the column header texts according to the
94+
/// customization; otherwise, the same value as `column_header_texts`.
9395
/// </summary>
9496
[fsProperty("column_header_texts_normalized")]
95-
public List<ColumnHeaderTextsNormalized> ColumnHeaderTextsNormalized { get; set; }
97+
public List<string> ColumnHeaderTextsNormalized { get; set; }
98+
/// <summary>
99+
/// Gets or Sets Attributes
100+
/// </summary>
101+
[fsProperty("attributes")]
102+
public List<Attribute> Attributes { get; set; }
96103
}
97104

98105
}

Scripts/Services/CompareComply/v1/Models/ContractAmts.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,33 @@ namespace IBM.Watson.DeveloperCloud.Services.CompareComply.v1
2525
[fsObject]
2626
public class ContractAmts
2727
{
28+
/// <summary>
29+
/// The confidence level in the identification of the contract amount.
30+
/// </summary>
31+
public enum ConfidenceLevelEnum
32+
{
33+
34+
/// <summary>
35+
/// Enum HIGH for High
36+
/// </summary>
37+
High,
38+
39+
/// <summary>
40+
/// Enum MEDIUM for Medium
41+
/// </summary>
42+
Medium,
43+
44+
/// <summary>
45+
/// Enum LOW for Low
46+
/// </summary>
47+
Low
48+
}
49+
50+
/// <summary>
51+
/// The confidence level in the identification of the contract amount.
52+
/// </summary>
53+
[fsProperty("confidence_level")]
54+
public ConfidenceLevelEnum? ConfidenceLevel { get; set; }
2855
/// <summary>
2956
/// The monetary amount.
3057
/// </summary>

Scripts/Services/CompareComply/v1/Models/EffectiveDates.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,34 @@ namespace IBM.Watson.DeveloperCloud.Services.CompareComply.v1
2525
[fsObject]
2626
public class EffectiveDates
2727
{
28+
/// <summary>
29+
/// The confidence level in the identification of the effective date.
30+
/// </summary>
31+
public enum ConfidenceLevelEnum
32+
{
33+
34+
/// <summary>
35+
/// Enum HIGH for High
36+
/// </summary>
37+
High,
38+
39+
/// <summary>
40+
/// Enum MEDIUM for Medium
41+
/// </summary>
42+
Medium,
43+
44+
/// <summary>
45+
/// Enum LOW for Low
46+
/// </summary>
47+
Low
48+
}
49+
50+
/// <summary>
51+
/// The confidence level in the identification of the effective date.
52+
/// </summary>
53+
[fsProperty("confidence_level")]
54+
public ConfidenceLevelEnum? ConfidenceLevel { get; set; }
55+
2856
/// <summary>
2957
/// The effective date, listed as a string.
3058
/// </summary>

Scripts/Services/CompareComply/v1/Models/Parties.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,28 @@ namespace IBM.Watson.DeveloperCloud.Services.CompareComply.v1
2626
[fsObject]
2727
public class Parties
2828
{
29+
/// <summary>
30+
/// A string that identifies the importance of the party.
31+
/// </summary>
32+
public enum ImportanceEnum
33+
{
34+
35+
/// <summary>
36+
/// Enum PRIMARY for Primary
37+
/// </summary>
38+
Primary,
39+
40+
/// <summary>
41+
/// Enum UNKNOWN for Unknown
42+
/// </summary>
43+
Unknown
44+
}
45+
46+
/// <summary>
47+
/// A string that identifies the importance of the party.
48+
/// </summary>
49+
[fsProperty("importance")]
50+
public ImportanceEnum? Importance { get; set; }
2951
/// <summary>
3052
/// A string identifying the party.
3153
/// </summary>

Scripts/Services/CompareComply/v1/Models/TerminationDates.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,34 @@ namespace IBM.Watson.DeveloperCloud.Services.CompareComply.v1
2525
[fsObject]
2626
public class TerminationDates
2727
{
28+
/// <summary>
29+
/// The confidence level in the identification of the termination date.
30+
/// </summary>
31+
public enum ConfidenceLevelEnum
32+
{
33+
34+
/// <summary>
35+
/// Enum HIGH for High
36+
/// </summary>
37+
High,
38+
39+
/// <summary>
40+
/// Enum MEDIUM for Medium
41+
/// </summary>
42+
Medium,
43+
44+
/// <summary>
45+
/// Enum LOW for Low
46+
/// </summary>
47+
Low
48+
}
49+
50+
/// <summary>
51+
/// The confidence level in the identification of the termination date.
52+
/// </summary>
53+
[fsProperty("confidence_level")]
54+
public ConfidenceLevelEnum? ConfidenceLevel { get; set; }
55+
2856
/// <summary>
2957
/// The termination date.
3058
/// </summary>

Scripts/Services/Discovery/v1/DataModels.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,10 @@ public class DocumentCounts
10051005
/// The number of documents in the collection that failed to be ingested.
10061006
/// </summary>
10071007
public int failed { get; set; }
1008+
/// <summary>
1009+
/// The number of documents that have been uploaded to the collection, but have not yet started processing.
1010+
/// </summary>
1011+
public virtual long? pending { get; private set; }
10081012
}
10091013

10101014
/// <summary>

Scripts/Services/Discovery/v1/Discovery.cs

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5649,6 +5649,99 @@ private void OnCreateStopwordListResponse(RESTConnector.Request req, RESTConnect
56495649
}
56505650
}
56515651

5652+
public bool GetStopwordListStatus(SuccessCallback<TokenDictStatusResponse> successCallback, FailCallback failCallback, string environmentID, string collectionId, Dictionary<string, object> customData = null)
5653+
{
5654+
if (successCallback == null)
5655+
throw new ArgumentNullException("successCallback");
5656+
if (failCallback == null)
5657+
throw new ArgumentNullException("failCallback");
5658+
if (string.IsNullOrEmpty(environmentID))
5659+
throw new ArgumentNullException("environmentID");
5660+
if (string.IsNullOrEmpty(collectionId))
5661+
throw new ArgumentNullException("collectionId");
5662+
5663+
GetStopwordListStatusRequest req = new GetStopwordListStatusRequest();
5664+
req.SuccessCallback = successCallback;
5665+
req.FailCallback = failCallback;
5666+
req.HttpMethod = UnityWebRequest.kHttpVerbGET;
5667+
req.DisableSslVerification = DisableSslVerification;
5668+
req.CustomData = customData == null ? new Dictionary<string, object>() : customData;
5669+
req.Headers["Content-Type"] = "application/json";
5670+
if (req.CustomData.ContainsKey(Constants.String.CUSTOM_REQUEST_HEADERS))
5671+
{
5672+
foreach (KeyValuePair<string, string> kvp in req.CustomData[Constants.String.CUSTOM_REQUEST_HEADERS] as Dictionary<string, string>)
5673+
{
5674+
req.Headers.Add(kvp.Key, kvp.Value);
5675+
}
5676+
}
5677+
req.Parameters["version"] = VersionDate;
5678+
req.OnResponse = OnGetStopwordListStatusResponse;
5679+
req.Headers["X-IBMCloud-SDK-Analytics"] = "service_name=discovery;service_version=v1;operation_id=GetStopwordListStatus";
5680+
5681+
RESTConnector connector = RESTConnector.GetConnector(Credentials, string.Format("/v1/environments/{0}/collections/{1}/word_lists/stopwords", environmentID, collectionId));
5682+
if (connector == null)
5683+
return false;
5684+
5685+
return connector.Send(req);
5686+
}
5687+
5688+
private class GetStopwordListStatusRequest : RESTConnector.Request
5689+
{
5690+
/// <summary>
5691+
/// The success callback.
5692+
/// </summary>
5693+
public SuccessCallback<TokenDictStatusResponse> SuccessCallback { get; set; }
5694+
/// <summary>
5695+
/// The fail callback.
5696+
/// </summary>
5697+
public FailCallback FailCallback { get; set; }
5698+
/// <summary>
5699+
/// Custom data.
5700+
/// </summary>
5701+
public Dictionary<string, object> CustomData { get; set; }
5702+
}
5703+
5704+
private void OnGetStopwordListStatusResponse(RESTConnector.Request req, RESTConnector.Response resp)
5705+
{
5706+
TokenDictStatusResponse result = new TokenDictStatusResponse();
5707+
fsData data = null;
5708+
Dictionary<string, object> customData = ((GetStopwordListStatusRequest)req).CustomData;
5709+
customData.Add(Constants.String.RESPONSE_HEADERS, resp.Headers);
5710+
5711+
if (resp.Success)
5712+
{
5713+
try
5714+
{
5715+
fsResult r = fsJsonParser.Parse(Encoding.UTF8.GetString(resp.Data), out data);
5716+
if (!r.Succeeded)
5717+
throw new WatsonException(r.FormattedMessages);
5718+
5719+
object obj = result;
5720+
r = _serializer.TryDeserialize(data, obj.GetType(), ref obj);
5721+
if (!r.Succeeded)
5722+
throw new WatsonException(r.FormattedMessages);
5723+
5724+
customData.Add("json", data);
5725+
}
5726+
catch (Exception e)
5727+
{
5728+
Log.Error("Discovery.OnGetStopwordListStatusResponse()", "OnGetStopwordListStatusResponse Exception: {0}", e.ToString());
5729+
resp.Success = false;
5730+
}
5731+
}
5732+
5733+
if (resp.Success)
5734+
{
5735+
if (((GetStopwordListStatusRequest)req).SuccessCallback != null)
5736+
((GetStopwordListStatusRequest)req).SuccessCallback(result, customData);
5737+
}
5738+
else
5739+
{
5740+
if (((GetStopwordListStatusRequest)req).FailCallback != null)
5741+
((GetStopwordListStatusRequest)req).FailCallback(resp.Error, customData);
5742+
}
5743+
}
5744+
56525745
/// <summary>
56535746
/// Delete a custom stopword list.
56545747
///

0 commit comments

Comments
 (0)