示例#1
0
        // Expected result:
        // http://census.soe.com/s:soe/json/get/ps2:v2/character/?name.first_lower=krusen&c:join=outfit_member^inject_at:outfit^show:member_since_date'rank'rank_ordinal'outfit_id(outfit^show:name'alias'member_count'leader_character_id^inject_at:outfit_info(character^on:leader_character_id^to:character_id^inject_at:leader_profile^show:name'battle_rank))
        public static dynamic JoinTest()
        {
            // TODO: Test with 2 joins on same collection instead of just nested joins
            var api = new CensusApi("ps2:v2");
            var request = new DataRequest("character");
            request.Parameters.Add("name.first_lower", "krusen");

            // Join character with outfit_member
            var join = new Join("outfit_member");
            join.InjectAt = "outfit";
            join.Show.Add("member_since_date", "rank", "rank_ordinal", "outfit_id");

            // Join outfit_member with outfit
            var join2 = new Join("outfit");
            join2.InjectAt = "outfit_info";
            join2.Show.Add("name", "alias", "member_count", "leader_character_id");

            // Join outfit with character
            var join3 = new Join("character");
            join3.InjectAt = "leader_profile";
            join3.Show.Add("name", "battle_rank");
            join3.On = "leader_character_id";
            join3.To = "character_id";

            request.JoinWith(join.JoinWith(join2.JoinWith(join3)));

            return api.Execute(request);
        }
示例#2
0
        // Exptected result:
        // http://census.soe.com/get/ps2:v2/vehicle?c:limit=5&c:lang=en&cost=%3E300&c:tree=cost^prefix:cost_^list:1
        public static dynamic TreeTest()
        {
            var api = new CensusApi("ps2:v2");
            var request = new DataRequest("vehicle");
            request.Parameters.Add("cost", ">300");
            request.Tree = new Tree("cost", "cost_");
            request.Limit = 5;
            request.Language = "en";

            return api.Execute(request);
        }