コード例 #1
0
ファイル: SwrveQAUser.cs プロジェクト: smdx24/CPI-Source-Code
        private void MakeRequest(string endpoint, Dictionary <string, object> json)
        {
            json.Add("version", 1);
            json.Add("client_time", DateTime.UtcNow.ToString("yyyy-MM-ddTHH\\:mm\\:ss.fffffffzzz"));
            string s = Json.Serialize(json);

            byte[] bytes = Encoding.UTF8.GetBytes(s);
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            dictionary.Add("Content-Type", "application/json; charset=utf-8");
            Dictionary <string, string> headers = dictionary;

            swrve.Container.StartCoroutine(restClient.Post(endpoint, bytes, headers, RestListener));
        }
コード例 #2
0
        private void MakeRequest(string endpoint, Dictionary <string, object> json)
        {
            json.Add("version", ApiVersion);
            json.Add("client_time", DateTime.UtcNow.ToString(@"yyyy-MM-ddTHH\:mm\:ss.fffffffzzz"));
            string qaPostData = SwrveMiniJSON.Json.Serialize(json);

            byte[] qaPostEncodedData = Encoding.UTF8.GetBytes(qaPostData);
            Dictionary <string, string> requestHeaders = new Dictionary <string, string> {
                { @"Content-Type", @"application/json; charset=utf-8" },
                { @"Content-Length", qaPostEncodedData.Length.ToString() }
            };

            swrve.Container.StartCoroutine(restClient.Post(endpoint, qaPostEncodedData, requestHeaders, RestListener));
        }
コード例 #3
0
        private void MakeRequest(string qaEventsStringJson)
        {
            if (qaEventsStringJson == null)
            {
                return;
            }

            byte[] qaPostEncodedData = null;
            qaPostEncodedData = PostBodyBuilder.BuildQaEvent(apiKey, appId, userId, this.deviceUUID, appVersion, SwrveHelper.GetMilliseconds(), qaEventsStringJson);

            Dictionary <string, string> requestHeaders = new Dictionary <string, string> {
                { @"Content-Type", @"application/json; charset=utf-8" }
            };

            if (qaPostEncodedData != null)
            {
                container.StartCoroutine(restClient.Post(endPoint, qaPostEncodedData, requestHeaders, RestListener));
                SwrveLog.LogInfo("Swrve: SwrveQa Json Event sent:" + qaEventsStringJson);
            }
        }