public static ReviewList GetReviews(int restaurantID) { string urlParameters = $"reviews?res_id={restaurantID}&apikey={apiKey}"; var response = APICall.RunAsync <ReviewList>(url, urlParameters).GetAwaiter().GetResult(); return(response); }
public static RestaurantList GetRestaurants() { string urlParameters = $"search?entity_id=59&entity_type=city&apikey={apiKey}"; var response = APICall.RunAsync <RestaurantList>(url, urlParameters).GetAwaiter().GetResult(); return(response); }
public void QA_DeleteAllDecorations() { APICall <QADeleteAllDecorationsOperation> aPICall = clubPenguinClient.IglooApi.QaDeleteAllDecorations(); aPICall.OnError += handleCPResponseError; aPICall.Execute(); }
public static GiphyResponse GetTrending() { string urlParameters = $"trending?api_key={apiKey}&limit=10&rating=g"; var response = APICall.RunAsync <GiphyResponse>(url, urlParameters).GetAwaiter().GetResult(); return(response); }
public void JoinRoom() { if (clubPenguinClient.GameServer.IsConnected()) { if (clubPenguinClient.GameServer.CurrentRoom() == roomToJoin.ToString()) { Service.Get <EventDispatcher>().DispatchEvent(new WorldServiceEvents.SelfRoomJoinedEvent(clubPenguinClient.PlayerSessionId, clubPenguinClient.PlayerName, roomToJoin, null, null, isRoomOwner: false)); if (successHandler != null) { successHandler(); } } else { LeaveRoomSequence leaveRoomSequence = new LeaveRoomSequence(clubPenguinClient, JoinRoom); leaveRoomSequence.LeaveRoom(); } } else { bool bypassCaptcha = false; APICall <PostRoomPlayersOperation> aPICall = clubPenguinClient.GameApi.PostRoomPlayers(roomToJoin.world, LocalizationLanguage.GetLanguageString(roomToJoin.language), roomToJoin.zoneId.name, bypassCaptcha); aPICall.OnResponse += onPostRoomPlayersResponse; aPICall.OnError += onPostRoomPlayersError; aPICall.Execute(); } }
public void getData() { nameText.enabled = false; scoreText.enabled = false; loadingText.enabled = true; StartCoroutine(APICall.getAllScore(callback)); }
/// <summary> /// 商品を購入した /// </summary> /// <param name="PurchaseEvent">購入イベント情報</param> public override void OnPurchaseProduct(PurchaseEventArgs PurchaseEvent) { PurchaseInfo Info = JsonUtility.FromJson <PurchaseInfo>(PurchaseEvent.purchasedProduct.receipt); Debug.Log("Store:" + Info.Store); Debug.Log("Payload:" + Info.Payload); switch (PurchaseEvent.purchasedProduct.definition.id) { case ProductIDs.AddMoneyItem: StartCoroutine(APICall.VerifyAddGoldPurchase(Info, (Result) => { if (!Result.success) { Debug.LogError("Verify Error..."); SimpleDialog.Show("購入エラー"); return; } UserData.Instance.Gold = Result.gold; StoreController.ConfirmPendingPurchase(StoreController.products.WithID(ProductIDs.AddMoneyItem)); SimpleDialog.Show("購入しました。"); })); break; } }
public bool Run() { Logger.Info("Running Inventory Module"); var collection = new DtoInventoryCollection(); var instances = from t in Assembly.GetExecutingAssembly().GetTypes() where t.GetInterfaces().Contains(typeof(IInventorySearcher)) && t.GetConstructor(Type.EmptyTypes) != null select Activator.CreateInstance(t) as IInventorySearcher; foreach (var instance in instances) { Logger.Debug("Scanning " + instance); instance.Search(collection); } var result = new APICall().InventoryApi.SubmitInventory(collection); if (result != null) { return(result.Value); } else { return(false); } }
public async Task <Meal> AddToMealAsync(Meal meal, String query) { APICall apiCall = new APICall(); Meal newMeal = await apiCall.GetMealAsync(query); if (meal == null) { meal = new Meal(); } foreach (var food in newMeal.Foods) { if (food.ServingUnit != "meal") { meal.Foods.Add(food); } } if (meal.Type == null || meal.Type.Length == 0) { meal.Type = newMeal.Type; } if (meal.Date == null || meal.Date == DateTime.MinValue) { meal.Date = newMeal.Date; } return(meal); }
protected void Page_Load(object sender, EventArgs e) { //Only check after login if (Request.QueryString["fromlogin"] == "true") { //check for db upgrades here var versionInfo = Call.VersionApi.GetAllVersionInfo(); if (versionInfo.DatabaseVersion != versionInfo.TargetDbVersion) { Response.Redirect("~/views/dashboard/dbupdate.aspx"); } } if (Request.QueryString["access"] == "denied") { lblDenied.Text = "You Are Not Authorized For That Action<br><br>"; var tokenExpired = new APICall().SettingApi.CheckExpiredToken(); if (tokenExpired) { HttpContext.Current.Session.Abandon(); FormsAuthentication.SignOut(); Response.Redirect("~/?session=expired", true); } } PopulateStats(); }
public static RestaurantList GetRestaurantLocSearchResult(int cityID) { string urlParameters = $"/api/v2.1/search?entity_id={cityID}&entity_type=city"; var response = APICall.RunAsync <RestaurantList>(url, urlParameters).GetAwaiter().GetResult(); return(response); }
private void setStatus(string questId, QuestStatus status) { if (status == QuestStatus.SUSPENDED) { ClearQueue(); } Stopwatch sw = new Stopwatch(); sw.Start(); APICall <SetStatusOperation> aPICall = clubPenguinClient.QuestApi.SetStatus(questId, status); aPICall.OnResponse += delegate(SetStatusOperation op, HttpResponse response) { RewardSource rewardSource = RewardSource.QUEST_STARTED; if (status == QuestStatus.COMPLETED) { rewardSource = RewardSource.QUEST_COMPLETED; } if (sw.Elapsed.TotalSeconds >= 10.0) { Log.LogNetworkErrorFormatted(this, "Set status for quest took a long time: {0}", sw.Elapsed); } questDataReturned(op.ResponseBody, rewardSource); }; aPICall.OnError += handleRequestError; aPICall.Execute(); }
private int GenerateProcessArguments() { var multicastArgs = new MulticastArgsDTO(); multicastArgs.schema = new ClientPartitionHelper(_imageProfile).GetImageSchema(); multicastArgs.Environment = _imageProfile.Image.Environment; multicastArgs.ImageName = _imageProfile.Image.Name; multicastArgs.Port = _multicastSession.Port.ToString(); if (_isOnDemand) { multicastArgs.ExtraArgs = SettingServices.GetSettingValue(SettingStrings.SenderArgs); if (!string.IsNullOrEmpty(_clientCount)) { multicastArgs.clientCount = _clientCount; } } else { multicastArgs.ExtraArgs = string.IsNullOrEmpty(_imageProfile.SenderArguments) ? SettingServices.GetSettingValue(SettingStrings.SenderArgs) : _imageProfile.SenderArguments; multicastArgs.clientCount = _computers.Count.ToString(); } var pid = 0; if (_multicastServerId == -1) { pid = new MulticastArguments().GenerateProcessArguments(multicastArgs); } else { var secondaryServer = new SecondaryServerServices().GetSecondaryServer(_multicastServerId); pid = new APICall(new SecondaryServerServices().GetToken(secondaryServer.Name)) .ServiceAccountApi.GetMulticastSenderArgs(multicastArgs); } if (pid == 0) { return(pid); } var activeMulticastSessionServices = new ActiveMulticastSessionServices(); if (_isOnDemand) { _multicastSession.Pid = pid; _multicastSession.Name = _group.Name; activeMulticastSessionServices.AddActiveMulticastSession(_multicastSession); } else { _multicastSession.Pid = pid; activeMulticastSessionServices.UpdateActiveMulticastSession(_multicastSession); } return(pid); }
public void GetLatestPostTime(string language) { APICall <GetLatestPostTimeOperation> latestPostTime = clubPenguinClient.NewsfeedApi.GetLatestPostTime(language); latestPostTime.OnResponse += onLatestPostTimeReceived; latestPostTime.Execute(); }
private List <ReservaDTO> GetReservas(DateTime dataInicio, DateTime dataFim, String obra) { string urlParameters = $"?dataInicio={dataInicio}&dataFim={dataFim}&obra={obra}"; var response = APICall.RunAsync <ReservaDTO>(_reservaClienteOptions.Value.URL, urlParameters).GetAwaiter().GetResult(); return(response); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var version = new APICall().VersionApi.GetAllVersionInfo(); if (version != null) { if (version.DatabaseVersion == version.TargetDbVersion) { lblVersion.Text = "Database Is Up To Date"; } else { lblVersion.Text = "Database Update Required"; } lblVersion.Text += "<br> Current Version: " + version.DatabaseVersion + "<br> Required Version: " + version.TargetDbVersion; } else { lblVersion.Text = "Error: Could Not Determine Current Database Version"; } } }
public void ReportPlayer(string displayName, string reason) { APICall <ReportPlayerOperation> aPICall = clubPenguinClient.ModerationApi.ReportPlayer(displayName, reason); aPICall.OnError += handleCPResponseError; aPICall.Execute(); }
// Use this for initialization void Start() { print("api test runs...."); StartCoroutine(APICall.Call("me", "photos", null, (callback) => { print(callback); })); }
public TftpServerDTO GetAllTftpServers() { var tftpDto = new TftpServerDTO(); tftpDto.TftpServers = new List <string>(); if (SettingServices.ServerIsNotClustered) { tftpDto.TftpServers.Add( StringManipulationServices.PlaceHolderReplace( SettingServices.GetSettingValue(SettingStrings.TftpServerIp))); } else { if (SettingServices.TftpServerRole) { tftpDto.TftpServers.Add( StringManipulationServices.PlaceHolderReplace( SettingServices.GetSettingValue(SettingStrings.TftpServerIp))); } var tftpServers = new SecondaryServerServices().SearchSecondaryServers().Where(x => x.TftpRole == 1 && x.IsActive == 1); foreach (var tftpServer in tftpServers) { var tServer = new APICall(new SecondaryServerServices().GetToken(tftpServer.Name)).ServiceAccountApi .GetTftpServer(); if (!string.IsNullOrEmpty(tServer)) { tftpDto.TftpServers.Add(tServer); } } } return(tftpDto); }
public static RestaurantList GetRestaurantSearchResult(string query) { string urlParameters = $"/api/v2.1/search?entity_type=city&q={query}"; var response = APICall.RunAsync <RestaurantList>(url, urlParameters).GetAwaiter().GetResult(); return(response); }
public static GiphyResponse GetBySearch(string searchTerm = " ") { string urlParameters = $"search?api_key={apiKey}&q={searchTerm}&limit=10&offset=0&rating=g&lang=en"; var response = APICall.RunAsync <GiphyResponse>(url, urlParameters).GetAwaiter().GetResult(); return(response); }
public static int GetCityID(string cityName) { string urlParameters = $"/api/v2.1/cities?q={cityName}"; var response = APICall.RunAsync <CitiesSearch>(url, urlParameters).GetAwaiter().GetResult(); return(response.locationSuggestions[0].ID); }
public CustomApiCallDTO GetToken(string serverName) { var secondaryServer = GetSecondaryServerByName(serverName); var customApiCall = new CustomApiCallDTO(); customApiCall.BaseUrl = new Uri(secondaryServer.ApiURL); customApiCall.Token = secondaryServer.LastToken; if (new APICall(customApiCall).ServiceAccountApi.Test()) { return(customApiCall); } var token = new APICall(customApiCall).TokenApi.Get(secondaryServer.ServiceAccountName, new EncryptionServices().DecryptText(secondaryServer.ServiceAccountPassword)); if (token != null) { if (!string.IsNullOrEmpty(token.error_description)) { return(null); } customApiCall.Token = token.access_token; secondaryServer.LastToken = token.access_token; _uow.SecondaryServerRepository.Update(secondaryServer, secondaryServer.Id); _uow.Save(); } return(customApiCall); }
public static Restaurant GetRestaurantDetails(int restaurantID) { string urlParameters = $"/api/v2.1/restaurant?res_id={restaurantID}"; var response = APICall.RunAsync <Restaurant>(url, urlParameters).GetAwaiter().GetResult(); return(response); }
public void CheckSensorTransaction(DateTime startDateTime, DateTime endDateTime) { this.url = DefaultValues.Defaults.WebApiUrl; //this.url = "https://localhost:5001/"; // api/Transactions/checkAllCriticalSensorValues?minutes=10"; string urlParameters = string.Format("api/Transactions/checkAllCriticalSensorValues?minutes={0}", 10); var response = APICall.RunAsync <object>(url, urlParameters).GetAwaiter().GetResult(); }
public async Task <FoodNutritions> GetNutritions(String keyWord) { APICall apiCall = new APICall(); NutritionsObject obj = await apiCall.GetNutritions(keyWord); FoodNutritions res = null; if (obj != null) { res = new FoodNutritions() { FoodName = obj.FoodName, ServingQuantity = (int)obj.ServingQty, ServingUnit = obj.ServingUnit, ServingWeight = obj.ServingWeightGrams.ToString(), Calories = obj.NfCalories, TotalFat = obj.NfTotalFat, SaturatedFat = obj.NfSaturatedFat, Cholestrol = obj.NfCholesterol, Sodium = obj.NfSodium, TotalCarbohydrate = obj.NfTotalCarbohydrate, DietaryFiber = obj.NfDietaryFiber, Sugars = obj.NfSugars, Protien = obj.NfProtein, Potassium = obj.NfPotassium, Photo = obj.Photo.Highres }; } return(res); }
private bool onClaimDelayedReward(RewardServiceEvents.ClaimDelayedReward evt) { bool flag = false; foreach (KeyValuePair <RewardedUserCollection, SignedResponse <RewardedUserCollectionJsonHelper> > delayedReward in delayedRewards) { if (delayedReward.Key.source == evt.Source && delayedReward.Key.sourceId == evt.SourceId) { RewardedUserCollection key = delayedReward.Key; SignedResponse <RewardedUserCollectionJsonHelper> value = delayedReward.Value; if (key.rewards.ContainsKey(clubPenguinClient.PlayerSessionId)) { APICall <AddRewardOperation> aPICall = clubPenguinClient.RewardApi.AddReward(value); aPICall.OnResponse += onAssetsSet; aPICall.OnError += handleCPResponseError; aPICall.Execute(); } Service.Get <EventDispatcher>().DispatchEvent(new RewardServiceEvents.RewardsEarned(key)); delayedRewards.Remove(key); flag = true; break; } } if (!flag) { } return(false); }
public byte [] RunAllServers(DtoIsoGenOptions isoOptions) { var uow = new UnitOfWork(); var tftpComServers = uow.ClientComServerRepository.Get(x => x.IsTftpServer); EntityClientComServer tftpInfoServer; if (tftpComServers.Count == 0) { Logger.Error("No Tftp Servers Are Currently Enabled To Generate ISO"); return(null); } if (tftpComServers.Count > 1) { tftpInfoServer = tftpComServers.Where(x => x.IsTftpInfoServer).FirstOrDefault(); if (tftpInfoServer == null) { Logger.Error("No Tftp Servers Are Currently Set As The Information Server. Unable To Generate ISO"); return(null); } } else { tftpInfoServer = tftpComServers.First(); } //Connect To Client Com Server var intercomKey = ServiceSetting.GetSettingValue(SettingStrings.IntercomKeyEncrypted); var decryptedKey = new EncryptionServices().DecryptText(intercomKey); var result = new APICall().ClientComServerApi.GenerateISO(tftpInfoServer.Url, "", decryptedKey, isoOptions); return(result); }
public void SetTutorial(Tutorial tutorial) { APICall <SetTutorialOperation> aPICall = clubPenguinClient.TutorialApi.SetTutorial(tutorial); aPICall.OnResponse += onSetTutorialReceived; aPICall.Execute(); }
public bool UpdatePxeSettings(List <SettingEntity> settings) { if (!UpdateSetting(settings)) { return(false); } if (!ServerIsNotClustered) { var secondaryServers = new SecondaryServerServices().SearchSecondaryServers() .Where(x => x.TftpRole == 1 && x.IsActive == 1); foreach (var server in secondaryServers) { var result = new APICall(new SecondaryServerServices().GetToken(server.Name)) .ServiceAccountApi.UpdateSettings(settings); if (!result) { return(false); } } return(true); } return(true); }
public APIResponse(APICall called, object Response) { }