private static void QueueAndChangeFilename(ref string path, PebbleApp app, WatchHardware hardware, string name) { if (path != null) { if (path.Length > 2) { string save = CreateFilename(name, hardware, app); string newUrl = "%rootUrl%files/" + app.id + "/" + hardware.ToString() + "/" + name; Program.AddWebAsset(save, path); path = newUrl; } } }
public static PebbleApp[] GetPage(int offset, WatchHardware hardware, FetchType type, int limit = 100) { //Create a GET request here and get the data. string url = "https://api2.getpebble.com/v2/apps/collection/all/" + type.ToString().Replace('_', '-') + "?platform=all&hardware=" + hardware.ToString() + "&filter_hardware=false&image_ratio=1&limit=" + limit.ToString() + "&offset=" + offset.ToString(); //Request string raw = DoGetRequest(url); //Save SaveAsset(savePath + "raw_pages\\" + type.ToString() + "_" + hardware.ToString() + "_" + offset.ToString() + ".json", Encoding.UTF8.GetBytes(raw)); //Deserialize JSON. PebbleApp_Page page = (PebbleApp_Page)DeserializeObject(raw, typeof(PebbleApp_Page)); //Extract data and return it return(page.data); }
private static string CreateFilename(string name, WatchHardware hardware, PebbleApp app) { return(Program.savePath + "files\\" + app.id + "\\" + hardware.ToString() + "\\" + name); }
public static void SeekEntireType(FetchType type) { int platform = 0; while (platform < 5) { //Ran for each platform WatchHardware hw = (WatchHardware)platform; Console.WriteLine("Getting apps for " + type.ToString() + " on hardware " + hw.ToString()); //Get apps and add them foreach (PebbleApp app in GetAppsForHardware(type, hw)) { UpdateApp(app, hw); } platform++; } }