Exemplo n.º 1
0
        private static UnityWebRequest MakeGetLessonsRequest(string address, string lessonId)
        {
            if (!string.IsNullOrEmpty(lessonId))
            {
                address += "?lessonId=" + lessonId;
            }

            var req = UnityWebRequest.Post(address, new WWWForm());

            req.SetRequestHeader("Content-Type", "application/json");
            req.SetRequestHeader("Authorization", "Bearer " + UnityConnectProxy.GetAccessToken());
            req.method = "GET";
            return(req);
        }
Exemplo n.º 2
0
        public static void LogTutorialStatusUpdate(string lessonId, string lessonStatus)
        {
            var userId  = UnityConnectProxy.GetUserId();
            var getLink = @"/v1/users/" + userId + @"/lessons";
            var address = HostAddress + getLink;

            var jsonData = RegisterLessonRequest.GetJSONString(lessonStatus, userId, lessonId);
            var req      = UnityWebRequest.Post(address, jsonData);
            var data     = System.Text.Encoding.UTF8.GetBytes(jsonData);

            req.uploadHandler = new UploadHandlerRaw(data);

            req.SetRequestHeader("Content-Type", "application/json");
            req.SetRequestHeader("Authorization", "Bearer " + UnityConnectProxy.GetAccessToken());

            SendWebRequest(req, r =>
            {
                if (!IsRequestSuccess(r))
                {
                    return;
                }
            });
        }