Skip to content

Commit f16890a

Browse files
committed
feat: Added WatsonResponse and WatsonError
1 parent 3798616 commit f16890a

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

Scripts/Core/WatsonError.cs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/**
2+
* Copyright 2019 IBM Corp. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
namespace IBM.Watson
19+
{
20+
class WatsonError
21+
{
22+
/// <summary>
23+
/// The url that generated the error.
24+
/// </summary>
25+
public string Url { get; set; }
26+
/// <summary>
27+
/// The error code returned from the server.
28+
/// </summary>
29+
public long StatusCode { get; set; }
30+
/// <summary>
31+
/// The error message returned from the server.
32+
/// </summary>
33+
public string ErrorMessage { get; set; }
34+
/// <summary>
35+
/// The contents of the response from the server.
36+
/// </summary>
37+
public string Response { get; set; }
38+
}
39+
}

Scripts/Core/WatsonResponse.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* Copyright 2019 IBM Corp. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
using System.Collections.Generic;
19+
20+
namespace IBM.Watson
21+
{
22+
public class WatsonResponse<T>
23+
{
24+
/// <summary>
25+
/// The status code returned from the server.
26+
/// </summary>
27+
public int StatusCode { get; set; }
28+
/// <summary>
29+
/// Dictionary of headers returned by the request.
30+
/// </summary>
31+
public Dictionary<string, object> Headers { get; set; }
32+
/// <summary>
33+
/// The deserialized result.
34+
/// </summary>
35+
public T Result { get; set; }
36+
}
37+
}

0 commit comments

Comments
 (0)