示例#1
0
        public static void ForgotPassword(string email, Action <Dictionary <string, object> > onComplete)
        {
            Dictionary <string, object> body = new Dictionary <string, object>()
            {
                { "email", email }
            };

            ServerRequest.CallAPI("/forgot", HTTPMethod.POST, body, (r) => { ServerRequest.ResponseHandler(r, null, onComplete); }, false);
        }
示例#2
0
        public static void InviteMember(string email, Action <TeamInvitationResponse> onComplete)
        {
            Dictionary <string, object> body = new Dictionary <string, object>();

            body.Add("email", email);


            ServerRequest.CallAPI("/teams/invite", HTTPMethod.POST, body, (r) => { ServerRequest.ResponseHandler(r, null, onComplete); }, true);
        }
示例#3
0
        public static void UpdateTeam(string id, string name, string logo, Action <Team> onComplete)
        {
            Dictionary <string, object> body = new Dictionary <string, object>();

            body.Add("team", id);
            body.Add("name", name);
            body.Add("logo", logo);

            ServerRequest.CallAPI("/teams/update", HTTPMethod.POST, body, (r) => { ServerRequest.ResponseHandler(r, "team", onComplete); }, true);
        }
        public static void SubmitMetrics(MetricEvent[] metrics, System.Action <MetricsResponse> onComplete)
        {
            Dictionary <string, object> body = new Dictionary <string, object>()
            {
                { "metrics", metrics }
            };


            ServerRequest.CallAPI("/metrics", HTTPMethod.POST, body, (r) => { ServerRequest.ResponseHandler(r, null, onComplete); }, false);
        }
示例#5
0
        public static void ResetPassword(string email, string code, string password, Action <Dictionary <string, object> > onComplete)
        {
            Dictionary <string, object> body = new Dictionary <string, object>()
            {
                { "code", code },
                { "email", email },
                { "password", password }
            };

            ServerRequest.CallAPI("/reset", HTTPMethod.POST, body, (r) => { ServerRequest.ResponseHandler(r, null, onComplete); }, false);
        }
        public static void GetMetrics(string teamId, string startDate, string endDate, System.Action <MetricsResponse> onComplete)
        {
            Dictionary <string, object> body = new Dictionary <string, object>()
            {
                { "teamId", teamId },
                { "startDate", startDate },
                { "endDate", endDate }
            };


            ServerRequest.CallAPI("/metrics/list", HTTPMethod.POST, body, (r) => { ServerRequest.ResponseHandler(r, null, onComplete); }, false);
        }
 public static void DeleteTheme(InteractiveTheme theme, Action <bool> onComplete)
 {
     ServerRequest.CallAPI("/interactive/themes/" + theme._id, HTTPMethod.DELETE, null, (response) => {
         ServerRequest.ResponseHandler <Dictionary <string, object> >(response, null, (dict) =>
         {
             if (dict != null && dict.ContainsKey("ok") && System.Convert.ToInt32(dict["ok"]) == 1)
             {
                 onComplete.Invoke(true);
             }
             else
             {
                 onComplete.Invoke(false);
             }
         });
     }, true);
 }
示例#8
0
 public static void DeleteGroup(TeamGroup group, Action <bool> onComplete)
 {
     ServerRequest.CallAPI("/teams/groups/" + group._id, HTTPMethod.DELETE, null, (response) =>
     {
         ServerRequest.ResponseHandler <Dictionary <string, object> >(response, null, (dict) =>
         {
             if (dict != null && dict.ContainsKey("ok") && System.Convert.ToInt32(dict["ok"]) == 1)
             {
                 onComplete.Invoke(true);
             }
             else
             {
                 onComplete.Invoke(false);
             }
         });
     }, true);
 }
 public static void GenerateMinigameLink(InteractiveInstructorDeck deck, Action <MinigameLinkResponse> onComplete)
 {
     ServerRequest.CallAPI("/interactive/instructor/generatelink/" + deck._id, HTTPMethod.GET, null, (response) => ServerRequest.ResponseHandler(response, null, onComplete), false);
 }
 public static void ListInstructorDecks(Action <InstructorDecksResponse> onComplete)
 {
     ServerRequest.CallAPI("/interactive/instructor/decks/list", HTTPMethod.GET, null, (response) => ServerRequest.ResponseHandler(response, null, onComplete), true);
 }
 public static void ListCourses(string teamId, Action <InteractiveCourse[]> onComplete)
 {
     ServerRequest.CallAPI("/interactive/courses/list/" + teamId, HTTPMethod.GET, null, (r) => { ServerRequest.ResponseHandler(r, "courses", onComplete); }, true);
 }
        public static void UpdateCourse(string id, string name, string description, string themeId, string[] levelIds, Action <InteractiveCourse> onComplete)
        {
            // PUT /api/interactive/courses/:courseId
            //Body = { "name": "", "description": "", "theme": "theme id", "levels": [levelIds]}

            Dictionary <string, object> body = new Dictionary <string, object>()
            {
                { "name", name },
                { "description", description },
                { "theme", themeId },
                { "levels", levelIds }
            };

            ServerRequest.CallAPI("/interactive/courses/" + id, HTTPMethod.PUT, body, (r) => { ServerRequest.ResponseHandler(r, null, onComplete); }, true);
        }
 public static void GetCourse(string id, Action <InteractiveCourse> onComplete)
 {
     ServerRequest.CallAPI("/interactive/courses/" + id, HTTPMethod.GET, null, (r) => { ServerRequest.ResponseHandler(r, null, onComplete); }, true);
 }
        public static void UpdateTheme(InteractiveTheme theme, Action <InteractiveTheme> onComplete)
        {
            Debug.Log("Updating theme: " + theme.name);
            Dictionary <string, object> body = new Dictionary <string, object>()
            {
                { "name", theme.name },
                { "bgURL", theme.bgURL },
                { "levelSelectStyle", theme.levelSelectStyle },
                { "lessonAreaStyle", theme.lessonAreaStyle }
            };

            ServerRequest.CallAPI("/interactive/themes/" + theme._id, HTTPMethod.PUT, body, (r) => { ServerRequest.ResponseHandler(r, null, onComplete); }, true);
        }
示例#15
0
        public static void DeleteLevel(string id, Action <Dictionary <string, object> > onComplete)
        {
            //DELETE /api/interactive/levels/:levelId

            ServerRequest.CallAPI("/interactive/levels/" + id, HTTPMethod.DELETE, null, (r) => ServerRequest.ResponseHandler(r, null, onComplete), true);
        }
示例#16
0
        public static void UpdateLevel(string id, string name, string description, string[] quizIds, string[] lessonIds, Action <InteractiveLevel> onComplete)
        {
            //PUT /api/interactive/levels/:levelId


            Dictionary <string, object> body = new Dictionary <string, object>()
            {
                { "name", name },
                { "description", description },
                { "quizzes", quizIds },
                { "lessons", lessonIds },
                { "team", User.current.selectedMembership.team._id }
            };

            ServerRequest.CallAPI("/interactive/levels/" + id, HTTPMethod.PUT, body, (r) => ServerRequest.ResponseHandler(r, null, onComplete), true);
        }
 public static void GetTheme(string themeId, Action <InteractiveTheme> onComplete)
 {
     ServerRequest.CallAPI("/interactive/themes/" + themeId, HTTPMethod.GET, null, (r) => { ServerRequest.ResponseHandler(r, null, onComplete); }, true);
 }
示例#18
0
        public static void ListLevels(string teamId, Action <InteractiveLevel[]> onComplete)
        {
            //GET /api/interactive/levels/list/:teamId

            ServerRequest.CallAPI("/interactive/levels/list/" + teamId, HTTPMethod.GET, null, (r) => ServerRequest.ResponseHandler(r, "levels", onComplete), true);
        }
        public static void GetUserAssignments(string memberId, Action <InteractiveCourseAssignment[]> onComplete)
        {
            //GET /api/interactive/courses/assignments/:memberId

            ServerRequest.CallAPI("/interactive/courses/assignments/" + memberId, HTTPMethod.GET, null, (response) => { ServerRequest.ResponseHandler(response, "assignments", onComplete); }, true);
        }
示例#20
0
 public static void GetCourseProgress(Action <CourseProgress[]> onComplete)
 {
     ServerRequest.CallAPI("/interactive/progress/" + User.current._id, HTTPMethod.GET, null, (r) => ServerRequest.ResponseHandler(r, "userProgress", onComplete), true);
 }
        public static void CreateCourse(string name, string description, string themeId, string[] levelIds, Action <InteractiveCourse> onComplete)
        {
            //POST /api/interactive/courses/create
            //Body = { "name": "", "description": "", "theme": "theme id", "team": "team id", "levels": [levelIds]}

            Dictionary <string, object> body = new Dictionary <string, object>()
            {
                { "team", User.current.selectedMembership.team._id },
                { "name", name },
                { "description", description },
                { "theme", themeId },
                { "levels", levelIds }
            };

            ServerRequest.CallAPI("/interactive/courses/create", HTTPMethod.POST, body, (r) => { ServerRequest.ResponseHandler(r, null, onComplete); }, true);
        }
示例#22
0
        public static void SubmitQuizScore(InteractiveQuizScore quizScore, Action <CourseProgress[]> onComplete)
        {
            Dictionary <string, object> body = new Dictionary <string, object>();

            body.Add("score", quizScore.score);
            body.Add("didPass", quizScore.didPass);
            body.Add("quiz", quizScore.quiz);
            body.Add("member", User.current.selectedMembership._id);
            body.Add("course", InteractiveCourse.current._id);

            ServerRequest.CallAPI("/interactive/progress/quiz", HTTPMethod.PUT, body, (response) => ServerRequest.ResponseHandler(response, "userProgress", onComplete), true);
        }
        public static void UpdateCourse(InteractiveCourse course, Action <InteractiveCourse> onComplete)
        {
            // PUT /api/interactive/courses/:courseId
            //Body = { "name": "", "description": "", "theme": "theme id", "levels": [levelIds]}
            List <string> levelIds = new List <string>();

            for (int i = 0; i < course.levels.Length; i++)
            {
                levelIds.Add(course.levels[i]._id);
            }

            Dictionary <string, object> body = new Dictionary <string, object>()
            {
                { "name", course.name },
                { "description", course.description },
                { "levels", levelIds }
            };

            if (course.theme != null)
            {
                body.Add("theme", course.theme._id);
            }
            else
            {
                body.Add("theme", null);
            }

            ServerRequest.CallAPI("/interactive/courses/" + course._id, HTTPMethod.PUT, body, (r) => { ServerRequest.ResponseHandler(r, null, onComplete); }, true);
        }
示例#24
0
        public static void CompleteLesson(InteractiveCourse course, InteractiveLesson lesson, bool complete, Action <CourseProgress[]> onComplete)
        {
            //PUT /api/interactive/progress
            Dictionary <string, object> body = new Dictionary <string, object>()
            {
                { "type", "lesson" },
                { "id", lesson._id },
                { "course", course._id },
                { "complete", complete },
                { "member", User.current.selectedMembership._id }
            };

            ServerRequest.CallAPI("/interactive/progress", HTTPMethod.PUT, body, (r) => ServerRequest.ResponseHandler(r, "userProgress", onComplete), true);
        }
        public static void CreateInstructorDeck(Action <InstructorDeckResponse> onComplete)
        {
            Dictionary <string, object> body = new Dictionary <string, object>()
            {
                { "team", User.current.selectedMembership.team._id },
                { "deck", new InteractiveInstructorDeck()
                  {
                      name = "NEW INSTRUCTOR DECK"
                  } }
            };

            ServerRequest.CallAPI("/interactive/instructor/decks/create", HTTPMethod.POST, body, (response) => ServerRequest.ResponseHandler(response, null, onComplete), true);
        }
示例#26
0
        public static void UpdateLesson(InteractiveLesson lesson, Action <InteractiveLesson> onComplete)
        {
            Dictionary <string, object> body = new Dictionary <string, object>()
            {
                { "name", lesson.name },
                { "description", lesson.description },
                { "type", "Video" },
                { "data", lesson.data },
                { "team", User.current.selectedMembership.team._id },
                { "onComplete", lesson.onComplete }
            };

            ServerRequest.CallAPI("/interactive/lessons/" + lesson._id, HTTPMethod.PUT, body, (response) => ServerRequest.ResponseHandler(response, null, onComplete), true);
        }
        public static void DeleteInstructorDeck(string id, Action <InstructorDeckResponse> onComplete)
        {
            Dictionary <string, object> body = new Dictionary <string, object>()
            {
                { "team", User.current.selectedMembership.team._id }
            };

            ServerRequest.CallAPI("/interactive/instructor/decks/delete/" + id, HTTPMethod.POST, body, (response) => ServerRequest.ResponseHandler(response, null, onComplete), true);
        }
示例#28
0
 public static void ListLessons(string teamId, Action <InteractiveLesson[]> onComplete)
 {
     ServerRequest.CallAPI("/interactive/lessons/list/" + teamId, HTTPMethod.GET, null, (response) => { ServerRequest.ResponseHandler(response, "lessons", onComplete); }, true);
 }
 public static void GetMinigameData(string gameCode, Action <MinigameDataResponse> onComplete)
 {
     ServerRequest.CallAPI("/interactive/instructor/minigame/" + gameCode, HTTPMethod.GET, null, (response) => ServerRequest.ResponseHandler(response, null, onComplete), false);
 }
        public static void CreateTheme(InteractiveTheme theme, Action <InteractiveTheme> onComplete)
        {
            Dictionary <string, object> body = new Dictionary <string, object>()
            {
                { "name", theme.name },
                { "bgURL", theme.bgURL },
                { "levelSelectStyle", theme.levelSelectStyle },
                { "lessonAreaStyle", theme.lessonAreaStyle },
                { "team", User.current.selectedMembership.team._id }
            };

            ServerRequest.CallAPI("/interactive/themes/create", HTTPMethod.POST, body, (r) => { ServerRequest.ResponseHandler(r, null, onComplete); }, true);
        }