private void GetByPlatformAccountId(HydraRequest request) { IHydraItem item = HydraItemDeserializer.Deserialize(request.PostData); HydraHashMap map = item as HydraHashMap; HydraUtf8String platformAccountIdString = map.Items["value"] as HydraUtf8String; ulong platformAccountId = ulong.Parse(platformAccountIdString.Value); HydraHashMap result = new HydraHashMap(new Dictionary <string, IHydraItem>() { { "getUsersByProperty", new HydraHashMap(new Dictionary <string, IHydraItem>() { { "result", new HydraHashMap(new Dictionary <string, IHydraItem>() { { "items", new HydraHashMap(new Dictionary <string, IHydraItem>() { { "item", new HydraUtf8String("1") } }) } }) } }) } }); HydraResponse response = new HydraResponse(Connection, result); response.Send(); }
private void Create(HydraRequest request) { List <IHydraItem> items = HydraItemDeserializer.DeserializeAll(request.PostData); HydraResponse response = new HydraResponse(Connection, new HydraInt64(1)); response.Send(); }
private void Update(HydraRequest request) { List <IHydraItem> items = HydraItemDeserializer.DeserializeAll(request.PostData); HydraInt64 profileId = items[0] as HydraInt64; HydraHashMap map = items[1] as HydraHashMap; HydraResponse response = new HydraResponse(Connection, new HydraNone()); response.Send(); }
private void DisplayUser(HydraRequest request) { IHydraItem item = HydraItemDeserializer.Deserialize(request.PostData); HydraHashMap map = item as HydraHashMap; HydraInt32 userId = map.Items["user_id"] as HydraInt32; HydraHashMap result = new HydraHashMap(new Dictionary <string, IHydraItem>() { { "username", new HydraUtf8StringAsBinary("user") } }); HydraResponse response = new HydraResponse(Connection, result); response.Send(); }
private void GetByName(HydraRequest request) { IHydraItem item = HydraItemDeserializer.Deserialize(request.PostData); HydraHashMap map = item as HydraHashMap; HydraUtf8String username = map.Items["username"] as HydraUtf8String; int userId = 1; HydraInt32 result = new HydraInt32(userId); HydraResponse response = new HydraResponse(Connection, result); response.Send(); }
private void LoginWithAuthUserSession(HydraRequest request) { IHydraItem item = HydraItemDeserializer.Deserialize(request.PostData); HydraHashMap map = item as HydraHashMap; string username = (map.Items["username"] as HydraUtf8String).Value; string password = (map.Items["password"] as HydraUtf8String).Value; HydraHashMap result = new HydraHashMap(new Dictionary <string, IHydraItem>() { { "auth_user_return", new HydraUtf8StringAsBinary("success") }, { "user_id", new HydraInt32(1) } }); HydraResponse response = new HydraResponse(Connection, result); response.Send(); }
private void Create(HydraRequest request) { IHydraItem item = HydraItemDeserializer.Deserialize(request.PostData); HydraHashMap map = item as HydraHashMap; string username = (map.Items["username"] as HydraUtf8String).Value; string password = (map.Items["password"] as HydraUtf8String).Value; string email = (map.Items["email"] as HydraUtf8String).Value; string firstname = (map.Items["firstname"] as HydraUtf8String).Value; // always contains "firstname" string lastname = (map.Items["lastname"] as HydraUtf8String).Value; // always contains "lastname" int birthDay = int.Parse((map.Items["birth_day"] as HydraUtf8String).Value); // always 0 int birthMonth = int.Parse((map.Items["birth_month"] as HydraUtf8String).Value); // always 0 int birthYear = int.Parse((map.Items["birth_year"] as HydraUtf8String).Value); // always 2000 int userId = 1; HydraInt32 result = new HydraInt32(userId); HydraResponse response = new HydraResponse(Connection, result); response.Send(); }
private void SetPlatformAccountId(HydraRequest request) { IHydraItem item = HydraItemDeserializer.Deserialize(request.PostData); HydraHashMap map = item as HydraHashMap; int userId = int.Parse((map.Items["userID"] as HydraUtf8String).Value); ulong accountId = ulong.Parse((map.Items["value"] as HydraUtf8String).Value); HydraHashMap result = new HydraHashMap(new Dictionary <string, IHydraItem>() { { "setProperty", new HydraHashMap(new Dictionary <string, IHydraItem>() { { "status", new HydraHashMap(new Dictionary <string, IHydraItem>() { { "code", new HydraUtf8String("1") } } ) } }) } }); HydraResponse response = new HydraResponse(Connection, result); response.Send(); }
private void Create(HydraRequest request) { List <IHydraItem> items = HydraItemDeserializer.DeserializeAll(request.PostData); HydraInt64 profileId = items[0] as HydraInt64; HydraHashMap map = items[1] as HydraHashMap; HydraBinary imageBinary = items[2] as HydraBinary; Game game = Game.GetFromApiKey(request.ApiKey); string category = ((HydraUtf8String)map.Items["category"]).Value; if (category == "characters") { Character character = new Character(game, profileId, map, imageBinary); character.Save(); Console.WriteLine("Saved new character. ID {0}", character.ID); HydraResponse response = new HydraResponse(Connection, new HydraInt64(character.ID)); response.Send(); } else if (category == "screenshots") { Screenshot screenshot = new Screenshot(game, profileId, map, imageBinary); screenshot.Save(); Console.WriteLine("Saved new screenshot. ID {0}", screenshot.ID); HydraResponse response = new HydraResponse(Connection, new HydraInt64(screenshot.ID)); response.Send(); } else { throw new Exception("Unknown category? " + category); } }