/// <summary> /// Get ranking data list from Google sheets. /// You can use yield to wait until the process completes. /// </summary> /// <param name="requestDataList">List of request data.</param> /// <param name="responseHandler">Method that will be called to handle response.</param> /// <returns></returns> public CustomYieldInstruction GetRankingListsAsync(IList <RankingRequestData> requestDataList, Action <IList <RankingResponseData> > responseHandler) { var data = new Dictionary <string, object>(); data[Const.PlayerId] = LocalSaveDataHelper.GetUserID(); data[Const.RankingRequest] = requestDataList.Select(r => RankingRequestDataSerializer.Serialize(r)).ToArray(); return(SendRequestAsync(Const.GetRankingMethod, data, response => responseHandler?.Invoke(ParseResponse(response)))); }
/// <summary> /// Get data from Google sheets. /// You can use yield to wait until the process completes. /// </summary> /// <param name="keys">List of data keys.</param> /// <param name="responseHandler">Method that will be called to handle response.</param> /// <param name="sheetName">Sheet name of the Google sheet to communicate with, if not provided the default sheet name will be used.</param> /// <returns></returns> public CustomYieldInstruction GetDataAsync(IList <string> keys, Action <IList <object> > responseHandler, string sheetName = null) { var sendData = new Dictionary <string, object>(); sendData[Const.UserId] = LocalSaveDataHelper.GetUserID(); sendData[Const.SheetName] = sheetName ?? _settings.DefaultSheetName; sendData[Const.Data] = keys; return(SendRequestAsync(Const.GetDataMethod, sendData, response => responseHandler?.Invoke(ParseResponse(response)))); }
/// <summary> /// Send data to Google Sheets. /// You can use yield to wait until the process completes. /// </summary> /// <param name="data">Key value pairs of the data.</param> /// <param name="sheetName">Sheet name of the Google sheet to communicate with, if not provided the default sheet name will be used.</param> /// <returns></returns> public CustomYieldInstruction SendDataAsync(IDictionary <string, object> data, string sheetName = null) { var sendData = new Dictionary <string, object>(); sendData[Const.UserId] = LocalSaveDataHelper.GetUserID(); sendData[Const.SheetName] = sheetName ?? _settings.DefaultSheetName; sendData[Const.Data] = data; return(SendRequestAsync(Const.SaveDataMethod, sendData, null)); }