Skip to content

Commit d1bbee8

Browse files
committed
feat: Removed customData from operations
1 parent e78754e commit d1bbee8

File tree

12 files changed

+1254
-2299
lines changed

12 files changed

+1254
-2299
lines changed

Scripts/Services/Assistant/V1/AssistantService.cs

Lines changed: 270 additions & 495 deletions
Large diffs are not rendered by default.

Scripts/Services/Assistant/V2/AssistantService.cs

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,8 @@ public AssistantService(string versionDate, Credentials credentials) : base(vers
138138
/// [documentation](https://console.bluemix.net/docs/services/assistant/assistant-add.html#assistant-add-task).
139139
///
140140
/// **Note:** Currently, the v2 API does not support creating assistants.</param>
141-
/// <param name="customData">A Dictionary<string, object> of data that will be passed to the callback. The raw
142-
/// json output from the REST call will be passed in this object as the value of the 'json'
143-
/// key.</string></param>
144141
/// <returns><see cref="SessionResponse" />SessionResponse</returns>
145-
public bool CreateSession(Callback<SessionResponse> callback, string assistantId, Dictionary<string, object> customData = null)
142+
public bool CreateSession(Callback<SessionResponse> callback, string assistantId)
146143
{
147144
if (callback == null)
148145
throw new ArgumentNullException("`callback` is required for `CreateSession`");
@@ -153,18 +150,16 @@ public bool CreateSession(Callback<SessionResponse> callback, string assistantId
153150
{
154151
Callback = callback,
155152
HttpMethod = UnityWebRequest.kHttpVerbPOST,
156-
DisableSslVerification = DisableSslVerification,
157-
CustomData = customData == null ? new Dictionary<string, object>() : customData
153+
DisableSslVerification = DisableSslVerification
158154
};
159155

160-
if (req.CustomData.ContainsKey(Constants.String.CUSTOM_REQUEST_HEADERS))
156+
foreach (KeyValuePair<string, string> kvp in customRequestHeaders)
161157
{
162-
foreach (KeyValuePair<string, string> kvp in req.CustomData[Constants.String.CUSTOM_REQUEST_HEADERS] as Dictionary<string, string>)
163-
{
164-
req.Headers.Add(kvp.Key, kvp.Value);
165-
}
158+
req.Headers.Add(kvp.Key, kvp.Value);
166159
}
167160

161+
ClearCustomRequestHeaders();
162+
168163
foreach (KeyValuePair<string, string> kvp in Common.GetSdkHeaders("conversation", "V2", "CreateSession"))
169164
{
170165
req.Headers.Add(kvp.Key, kvp.Value);
@@ -219,11 +214,8 @@ private void OnCreateSessionResponse(RESTConnector.Request req, RESTConnector.Re
219214
///
220215
/// **Note:** Currently, the v2 API does not support creating assistants.</param>
221216
/// <param name="sessionId">Unique identifier of the session.</param>
222-
/// <param name="customData">A Dictionary<string, object> of data that will be passed to the callback. The raw
223-
/// json output from the REST call will be passed in this object as the value of the 'json'
224-
/// key.</string></param>
225217
/// <returns><see cref="object" />object</returns>
226-
public bool DeleteSession(Callback<object> callback, string assistantId, string sessionId, Dictionary<string, object> customData = null)
218+
public bool DeleteSession(Callback<object> callback, string assistantId, string sessionId)
227219
{
228220
if (callback == null)
229221
throw new ArgumentNullException("`callback` is required for `DeleteSession`");
@@ -236,18 +228,16 @@ public bool DeleteSession(Callback<object> callback, string assistantId, string
236228
{
237229
Callback = callback,
238230
HttpMethod = UnityWebRequest.kHttpVerbDELETE,
239-
DisableSslVerification = DisableSslVerification,
240-
CustomData = customData == null ? new Dictionary<string, object>() : customData
231+
DisableSslVerification = DisableSslVerification
241232
};
242233

243-
if (req.CustomData.ContainsKey(Constants.String.CUSTOM_REQUEST_HEADERS))
234+
foreach (KeyValuePair<string, string> kvp in customRequestHeaders)
244235
{
245-
foreach (KeyValuePair<string, string> kvp in req.CustomData[Constants.String.CUSTOM_REQUEST_HEADERS] as Dictionary<string, string>)
246-
{
247-
req.Headers.Add(kvp.Key, kvp.Value);
248-
}
236+
req.Headers.Add(kvp.Key, kvp.Value);
249237
}
250238

239+
ClearCustomRequestHeaders();
240+
251241
foreach (KeyValuePair<string, string> kvp in Common.GetSdkHeaders("conversation", "V2", "DeleteSession"))
252242
{
253243
req.Headers.Add(kvp.Key, kvp.Value);
@@ -308,11 +298,8 @@ private void OnDeleteSessionResponse(RESTConnector.Request req, RESTConnector.Re
308298
/// <param name="context">State information for the conversation. The context is stored by the assistant on a
309299
/// per-session basis. You can use this property to set or modify context variables, which can also be accessed
310300
/// by dialog nodes. (optional)</param>
311-
/// <param name="customData">A Dictionary<string, object> of data that will be passed to the callback. The raw
312-
/// json output from the REST call will be passed in this object as the value of the 'json'
313-
/// key.</string></param>
314301
/// <returns><see cref="MessageResponse" />MessageResponse</returns>
315-
public bool Message(Callback<MessageResponse> callback, string assistantId, string sessionId, Dictionary<string, object> customData = null, MessageInput input = null, MessageContext context = null)
302+
public bool Message(Callback<MessageResponse> callback, string assistantId, string sessionId, MessageInput input = null, MessageContext context = null)
316303
{
317304
if (callback == null)
318305
throw new ArgumentNullException("`callback` is required for `Message`");
@@ -325,18 +312,16 @@ public bool Message(Callback<MessageResponse> callback, string assistantId, stri
325312
{
326313
Callback = callback,
327314
HttpMethod = UnityWebRequest.kHttpVerbPOST,
328-
DisableSslVerification = DisableSslVerification,
329-
CustomData = customData == null ? new Dictionary<string, object>() : customData
315+
DisableSslVerification = DisableSslVerification
330316
};
331317

332-
if (req.CustomData.ContainsKey(Constants.String.CUSTOM_REQUEST_HEADERS))
318+
foreach (KeyValuePair<string, string> kvp in customRequestHeaders)
333319
{
334-
foreach (KeyValuePair<string, string> kvp in req.CustomData[Constants.String.CUSTOM_REQUEST_HEADERS] as Dictionary<string, string>)
335-
{
336-
req.Headers.Add(kvp.Key, kvp.Value);
337-
}
320+
req.Headers.Add(kvp.Key, kvp.Value);
338321
}
339322

323+
ClearCustomRequestHeaders();
324+
340325
foreach (KeyValuePair<string, string> kvp in Common.GetSdkHeaders("conversation", "V2", "Message"))
341326
{
342327
req.Headers.Add(kvp.Key, kvp.Value);

0 commit comments

Comments
 (0)