Skip to content

Analytics headers #509

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions Assistant.meta

This file was deleted.

8 changes: 0 additions & 8 deletions Assistant/v2.meta

This file was deleted.

8 changes: 0 additions & 8 deletions Core.meta

This file was deleted.

8 changes: 0 additions & 8 deletions Core/Editor.meta

This file was deleted.

8 changes: 0 additions & 8 deletions Core/Editor/Help.meta

This file was deleted.

8 changes: 0 additions & 8 deletions Core/Editor/Help/Working.meta

This file was deleted.

13 changes: 12 additions & 1 deletion Scripts/Connection/RESTConnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,18 @@ private void AddHeaders(Dictionary<string, string> headers)
}
}

headers.Add("User-Agent", Constants.String.Version);
string osInfo = SystemInfo.operatingSystem;
int osIndex = osInfo.IndexOf(" ");
string os = osInfo.Substring(0, osIndex).Replace(" ", "");
string osVersion = osInfo.Substring(osIndex).Replace(" ", "");
headers.Add("User-Agent",
string.Format(
"{0} {1} {2} {3}",
Constants.String.Version,
os,
osVersion,
Application.unityVersion
));
}

private IEnumerator ProcessRequestQueue()
Expand Down
45 changes: 45 additions & 0 deletions Scripts/Services/Assistant/v1/Assistant.cs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Scripts/Services/Assistant/v2/Assistant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ public bool CreateSession(SuccessCallback<SessionResponse> successCallback, Fail
req.Headers["Content-Type"] = "application/json";
req.Parameters["version"] = VersionDate;
req.OnResponse = OnCreateSessionResponse;
req.Headers["X-IBMCloud-SDK-Analytics"] = "service_name=conversation;service_version=v2;operation_id=CreateSession";

RESTConnector connector = RESTConnector.GetConnector(Credentials, string.Format("/v2/assistants/{0}/sessions", assistantId));
if (connector == null)
Expand Down Expand Up @@ -281,6 +282,7 @@ public bool DeleteSession(SuccessCallback<object> successCallback, FailCallback
}
req.Parameters["version"] = VersionDate;
req.OnResponse = OnDeleteSessionResponse;
req.Headers["X-IBMCloud-SDK-Analytics"] = "service_name=conversation;service_version=v2;operation_id=DeleteSession";

RESTConnector connector = RESTConnector.GetConnector(Credentials, string.Format("/v2/assistants/{0}/sessions/{1}", assistantId, sessionId));
if (connector == null)
Expand Down Expand Up @@ -410,6 +412,7 @@ public bool Message(SuccessCallback<MessageResponse> successCallback, FailCallba
req.Headers["Content-Type"] = "application/json";
req.Parameters["version"] = VersionDate;
req.OnResponse = OnMessageResponse;
req.Headers["X-IBMCloud-SDK-Analytics"] = "service_name=conversation;service_version=v2;operation_id=Message";

RESTConnector connector = RESTConnector.GetConnector(Credentials, string.Format("/v2/assistants/{0}/sessions/{1}/message", assistantId, sessionId));
if (connector == null)
Expand Down
12 changes: 12 additions & 0 deletions Scripts/Services/CompareComply/v1/CompareComply.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ public bool ConvertToHtml(SuccessCallback<HTMLReturn> successCallback, FailCallb
if (!string.IsNullOrEmpty(modelId))
req.Parameters["model_id"] = modelId;
req.OnResponse = OnConvertToHtmlResponse;
req.Headers["X-IBMCloud-SDK-Analytics"] = "service_name=compare-comply;service_version=v1;operation_id=ConvertToHtml";

RESTConnector connector = RESTConnector.GetConnector(Credentials, "/v1/html_conversion");
if (connector == null)
Expand Down Expand Up @@ -269,6 +270,7 @@ public bool ClassifyElements(SuccessCallback<ClassifyReturn> successCallback, Fa
if (!string.IsNullOrEmpty(modelId))
req.Parameters["model_id"] = modelId;
req.OnResponse = OnClassifyElementsResponse;
req.Headers["X-IBMCloud-SDK-Analytics"] = "service_name=compare-comply;service_version=v1;operation_id=ClassifyElements";

RESTConnector connector = RESTConnector.GetConnector(Credentials, "/v1/element_classification");
if (connector == null)
Expand Down Expand Up @@ -376,6 +378,7 @@ public bool ExtractTables(SuccessCallback<TableReturn> successCallback, FailCall
if (!string.IsNullOrEmpty(modelId))
req.Parameters["model_id"] = modelId;
req.OnResponse = OnExtractTablesResponse;
req.Headers["X-IBMCloud-SDK-Analytics"] = "service_name=compare-comply;service_version=v1;operation_id=ExtractTables";

RESTConnector connector = RESTConnector.GetConnector(Credentials, "/v1/tables");
if (connector == null)
Expand Down Expand Up @@ -498,6 +501,7 @@ public bool CompareDocuments(SuccessCallback<CompareReturn> successCallback, Fai
if (!string.IsNullOrEmpty(modelId))
req.Parameters["model_id"] = modelId;
req.OnResponse = OnCompareDocumentsResponse;
req.Headers["X-IBMCloud-SDK-Analytics"] = "service_name=compare-comply;service_version=v1;operation_id=CompareDocuments";

RESTConnector connector = RESTConnector.GetConnector(Credentials, "/v1/comparison");
if (connector == null)
Expand Down Expand Up @@ -607,6 +611,7 @@ public bool AddFeedback(SuccessCallback<FeedbackReturn> successCallback, FailCal
req.Headers["Content-Type"] = "application/json";
req.Parameters["version"] = VersionDate;
req.OnResponse = OnAddFeedbackResponse;
req.Headers["X-IBMCloud-SDK-Analytics"] = "service_name=compare-comply;service_version=v1;operation_id=AddFeedback";

RESTConnector connector = RESTConnector.GetConnector(Credentials, "/v1/feedback");
if (connector == null)
Expand Down Expand Up @@ -710,6 +715,7 @@ public bool DeleteFeedback(SuccessCallback<FeedbackDeleted> successCallback, Fai
if (!string.IsNullOrEmpty(modelId))
req.Parameters["model_id"] = modelId;
req.OnResponse = OnDeleteFeedbackResponse;
req.Headers["X-IBMCloud-SDK-Analytics"] = "service_name=compare-comply;service_version=v1;operation_id=DeleteFeedback";

RESTConnector connector = RESTConnector.GetConnector(Credentials, string.Format("/v1/feedback/{0}", feedbackId));
if (connector == null)
Expand Down Expand Up @@ -814,6 +820,7 @@ public bool GetFeedback(SuccessCallback<GetFeedback> successCallback, FailCallba
if (!string.IsNullOrEmpty(modelId))
req.Parameters["model_id"] = modelId;
req.OnResponse = OnGetFeedbackResponse;
req.Headers["X-IBMCloud-SDK-Analytics"] = "service_name=compare-comply;service_version=v1;operation_id=GetFeedback";

RESTConnector connector = RESTConnector.GetConnector(Credentials, string.Format("/v1/feedback/{0}", feedbackId));
if (connector == null)
Expand Down Expand Up @@ -981,6 +988,7 @@ public bool ListFeedback(SuccessCallback<FeedbackList> successCallback, FailCall
if (includeTotal != null)
req.Parameters["include_total"] = includeTotal;
req.OnResponse = OnListFeedbackResponse;
req.Headers["X-IBMCloud-SDK-Analytics"] = "service_name=compare-comply;service_version=v1;operation_id=ListFeedback";

RESTConnector connector = RESTConnector.GetConnector(Credentials, "/v1/feedback");
if (connector == null)
Expand Down Expand Up @@ -1126,6 +1134,7 @@ public bool CreateBatch(SuccessCallback<BatchStatus> successCallback, FailCallba
if (!string.IsNullOrEmpty(modelId))
req.Parameters["model_id"] = modelId;
req.OnResponse = OnCreateBatchResponse;
req.Headers["X-IBMCloud-SDK-Analytics"] = "service_name=compare-comply;service_version=v1;operation_id=CreateBatch";

RESTConnector connector = RESTConnector.GetConnector(Credentials, "/v1/batches");
if (connector == null)
Expand Down Expand Up @@ -1226,6 +1235,7 @@ public bool GetBatch(SuccessCallback<BatchStatus> successCallback, FailCallback
}
req.Parameters["version"] = VersionDate;
req.OnResponse = OnGetBatchResponse;
req.Headers["X-IBMCloud-SDK-Analytics"] = "service_name=compare-comply;service_version=v1;operation_id=GetBatch";

RESTConnector connector = RESTConnector.GetConnector(Credentials, string.Format("/v1/batches/{0}", batchId));
if (connector == null)
Expand Down Expand Up @@ -1323,6 +1333,7 @@ public bool ListBatches(SuccessCallback<Batches> successCallback, FailCallback f
}
req.Parameters["version"] = VersionDate;
req.OnResponse = OnGetBatchesResponse;
req.Headers["X-IBMCloud-SDK-Analytics"] = "service_name=compare-comply;service_version=v1;operation_id=ListBatches";

RESTConnector connector = RESTConnector.GetConnector(Credentials, "/v1/batches");
if (connector == null)
Expand Down Expand Up @@ -1436,6 +1447,7 @@ public bool UpdateBatch(SuccessCallback<BatchStatus> successCallback, FailCallba
if (!string.IsNullOrEmpty(modelId))
req.Parameters["model_id"] = modelId;
req.OnResponse = OnUpdateBatchResponse;
req.Headers["X-IBMCloud-SDK-Analytics"] = "service_name=compare-comply;service_version=v1;operation_id=UpdateBatch";

RESTConnector connector = RESTConnector.GetConnector(Credentials, string.Format("/v1/batches/{0}", batchId));
if (connector == null)
Expand Down
3 changes: 3 additions & 0 deletions Scripts/Services/Conversation/v1/Conversation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ public bool Message(SuccessCallback<object> successCallback, FailCallback failCa
req.Function = "/" + workspaceID + "/message";
req.Send = Encoding.UTF8.GetBytes(reqString);
req.OnResponse = MessageResp;
req.Headers["X-IBMCloud-SDK-Analytics"] = "service_name=conversation;service_version=v1;operation_id=Message";
req.DisableSslVerification = DisableSslVerification;
req.CustomData = customData == null ? new Dictionary<string, object>() : customData;
if (req.CustomData.ContainsKey(Constants.String.CUSTOM_REQUEST_HEADERS))
Expand Down Expand Up @@ -242,6 +243,7 @@ public bool Message(SuccessCallback<object> successCallback, FailCallback failCa
req.Function = "/" + workspaceID + "/message";
req.Send = Encoding.UTF8.GetBytes(stringToSend);
req.OnResponse = MessageResp;
req.Headers["X-IBMCloud-SDK-Analytics"] = "service_name=conversation;service_version=v1;operation_id=Message";
req.DisableSslVerification = DisableSslVerification;
req.CustomData = customData == null ? new Dictionary<string, object>() : customData;
if (req.CustomData.ContainsKey(Constants.String.CUSTOM_REQUEST_HEADERS))
Expand Down Expand Up @@ -355,6 +357,7 @@ public bool DeleteUserData(SuccessCallback<object> successCallback, FailCallback
req.Parameters["version"] = VersionDate;

req.OnResponse = OnDeleteUserDataResponse;
req.Headers["X-IBMCloud-SDK-Analytics"] = "service_name=conversation;service_version=v1;operation_id=DeleteUserData";

RESTConnector connector = RESTConnector.GetConnector(Credentials, "/v1/user_data");
if (connector == null)
Expand Down
Loading