public async Task UpdateFireblob(CloudBlobContainer blobContainer) { try { IFirebaseConfig config = new FirebaseConfig { AuthSecret = "Gg5t1fSLC0WWPVM1VMoNxlM29qO1s53dEso7Jrfp", BasePath = "https://ringtoneapp.firebaseio.com/" }; IFirebaseClient client = new FirebaseClient(config); var list = blobContainer.ListBlobs(); List<CloudBlockBlob> blobNames = list.OfType<CloudBlockBlob>().ToList(); // SET var todo = new Todo(); List<Todo> todoList = new List<Todo>(); List<UploadDataModel> MetaList = new List<UploadDataModel>(); foreach (var blb in blobNames) { blb.FetchAttributes(); Todo td = new Todo(); td.name = blb.Name; td.url = blb.Uri.AbsoluteUri.ToString(); if (blb.Metadata.Values.Count > 0) { td.Category = blb.Metadata.Values.ElementAt(0); td.UserName = blb.Metadata.Values.ElementAt(1); td.Number = blb.Metadata.Values.ElementAt(2); td.Email = blb.Metadata.Values.ElementAt(3); td.Comments = blb.Metadata.Values.ElementAt(4); } todoList.Add(td); } SetResponse response = await client.SetAsync(FirebaseContainer, todoList); List<Todo> setresult = response.ResultAs<List<Todo>>(); } catch (Exception e) { } //GET //FirebaseResponse getresponse = await client.GetAsync("ringtones"); //List<Todo> gettodo = response.ResultAs<List<Todo>>(); //The response will contain the data being retreived }
public async void TestFixtureSetUp() { IFirebaseConfig config = new FirebaseConfig { AuthSecret = FirebaseSecret, BasePath = BasePath }; _client = new FirebaseClient(config); //Uses Newtonsoft.Json Json Serializer Task<FirebaseResponse> task1 = _client.DeleteAsync("todos"); Task<FirebaseResponse> task2 = _client.DeleteAsync("fakepath"); await Task.WhenAll(task1, task2); }
public IFirebaseClient GetFirebaseClient() { var node = "https://dazzling-inferno-4653.firebaseio.com/"; IFirebaseConfig config = new FirebaseConfig { AuthSecret = _firebaseSecret, BasePath = node }; IFirebaseClient client = new FirebaseClient(config); return client; }
private async void MainPage_OnLoaded(object sender, RoutedEventArgs e) { IFirebaseConfig config = new FirebaseConfig { AuthSecret = FirebaseSecret, BasePath = BasePath }; _client = new FirebaseClient(config); await _client.OnAsync("chat", added: (s, args) => { Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { TextBox1.Text = args.Data + " -> 1(ADDED)"; }); }, changed: (s, args) => { Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { TextBox2.Text = string.Format("Data :{0}, Path: {1} -> 1(CHANGED)", args.Data, args.Path); }); }, removed: (s, args) => { Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { TextBox3.Text = args.Path + " -> 1(REMOVED)"; }); }); await _client.OnAsync("chat", added: (s, args) => { Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { TextBox4.Text = args.Data + " -> 2(ADDED)"; }); }, changed: (s, args) => { Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { TextBox5.Text = string.Format("Data :{0}, Path: {1} -> 2(CHANGED)", args.Data, args.Path); }); }, removed: (s, args) => { Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { TextBox6.Text = args.Path + " -> 2(REMOVED)"; }); }); }
//CONSTRUCTOR public ProfileViewModel() { //Initializes the connection to the Firebase database config = new FirebaseConfig { AuthSecret = FirebaseSecret, BasePath = BasePath }; client = new FirebaseClient(config); //Attempts to get the online copy try { getOnlineProfile(); } //If it's unable to, use the local copy catch (Exception) { getLocalProfile(); } }
public string PushFireBaseData(string AuthSecret, string BasePath, string item) { IFirebaseConfig config = new FirebaseConfig { AuthSecret = AuthSecret, BasePath = BasePath }; IFirebaseClient client = new FirebaseClient(config); var todo = new { name = "Execute PUSH", priority = 2 }; PushResponse response = client.Push(item, todo); string retorno = JsonConvert.SerializeObject(response).ToString(); return retorno; }
static void Main(string[] args) { IFirebaseConfig config = new FirebaseConfig { BasePath = "https://simplephonenotify.firebaseio.com/" }; IFirebaseClient client = new FirebaseClient(config); Random ran = new Random(); string input = ""; while (!input.Equals("quit")) { Console.Write("Enter input: "); input = Console.ReadLine(); Console.WriteLine(input); var item = new Item { Name = input, Amount = ran.Next(1, 30) }; client.Push("items", item); Console.WriteLine(item); } Console.WriteLine("Finished"); Console.WriteLine(input); }
public IFirebaseClient GetFirebaseClient(string node) { IFirebaseConfig config = new FirebaseConfig { AuthSecret = _firebaseSecret, BasePath = node }; IFirebaseClient client = new FirebaseClient(config); return client; }
public IFirebaseConfig conec() { IFirebaseConfig config = new FireSharp.Config.FirebaseConfig { AuthSecret = "4OUpc4rGJTetaxG8IBiE3uoXdSVNuBeRdJoo8Uju", BasePath = "https://fir-app-cf755.firebaseio.com/" }; return(config); }
public static FireBaseRetorno GetFireBaseData(FireBaseEntrada Entrada) { IFirebaseConfig config = new FirebaseConfig{ AuthSecret = Entrada.AuthSecret, BasePath = Entrada.BasePath}; IFirebaseClient client = new FirebaseClient(config); FirebaseResponse response = client.Get(Entrada.item.ToString()); FireBaseRetorno retorno = new FireBaseRetorno {StatusCode = response.StatusCode.ToString(), Body = response.Body}; retorno.StatusCode = response.StatusCode.ToString(); retorno.Body = response.Body; return retorno; }
public static void loadFirebase() { IFirebaseConfig config = new FireSharp.Config.FirebaseConfig { AuthSecret = Passwords.FirebaseSecret, //if you get error here, create class Passwords with these elements. They are string containing sensible data. Custom with your own, or ask me if colaborator. BasePath = Passwords.BasePath //if you get error here, create class Passwords with these elements. They are string containing sensible data. Custom with your own, or ask me if colaborator. }; _client = new FirebaseClient(config); authProvider = new FirebaseAuthProvider(new Firebase.Auth.FirebaseConfig(Passwords.FirebaseApiKey)); //if you get error here, create class Passwords with these elements. They are string containing sensible data. Custom with your own, or ask me if colaborator. }
private FirebaseManager () { var config = new FirebaseConfig { AuthSecret = FirebaseSecret, BasePath = BasePath }; _client = new FirebaseClient (config); GetNewestVideos(true); }
public void Program_Load() { IFirebaseConfig config = new FirebaseConfig { AuthSecret = "AIzaSyB04YQ9Xv7ZHyMjUNvu3iRwRm-rxrXXMsg", BasePath = "https://htlgkr-testet-default-rtdb.firebaseio.com" }; IFirebaseClient client; client = new FirebaseClient(config); }
public async Task<string> retrieveSupportStringForId(int id) { IFirebaseConfig config = new FirebaseConfig { AuthSecret = "WtyRxZxUb94IPMpd0ho9VlCdvpTDz7yO7dGCY42F", BasePath = "https://globaltechsupport.firebaseio.com/" }; FirebaseClient firebase = new FirebaseClient(config); string url = "https://globaltechsupport.firebaseio.com/" + id; FirebaseResponse response = await firebase.GetAsync(id.ToString()); return response.ResultAs<string>(); }
public IFirebaseClient GetFirebaseClient() { //var node = "https://dazzling-inferno-4653.firebaseio.com/"; var node = ConfigurationManager.AppSettings["FirebaseUrl"] ?? CloudConfigurationManager.GetSetting("FirebaseUrl"); IFirebaseConfig config = new FirebaseConfig { AuthSecret = _firebaseSecret, BasePath = node }; IFirebaseClient client = new FirebaseClient(config); return client; }
private static void Main() { IFirebaseConfig config = new FirebaseConfig { AuthSecret = FirebaseSecret, BasePath = BasePath }; _client = new FirebaseClient(config); //Uses JsonNet default EventStreaming(); //Crud(); System.Console.Read(); }
public string DeleteFireBaseData(string AuthSecret, string BasePath, string item) { IFirebaseConfig config = new FirebaseConfig { AuthSecret = AuthSecret, BasePath = BasePath }; IFirebaseClient client = new FirebaseClient(config); FirebaseResponse response = client.Delete(item); string retorno = JsonConvert.SerializeObject(response).ToString(); return retorno; }
public async Task SecondConnectionWithoutSlash() { // This integration test will write from _config but read from a second Firebase connection to // the same DB, but with a BasePath which does not contain the unnecessary trailing slash. IFirebaseConfig config2 = new FirebaseConfig { AuthSecret = FirebaseSecret, BasePath = BasePathWithoutSlash, }; var client2 = new FirebaseClient(config2); await _client.PushAsync("todos/get/pushAsync", new Todo { name = "SecondConnectionWithoutSlash", priority = 3 }); Thread.Sleep(400); var response = await client2.GetAsync("todos/get/"); Assert.NotNull(response); Assert.IsTrue(response.Body.Contains("name")); Assert.IsTrue(response.Body.Contains("SecondConnectionWithoutSlash")); }
public void ShouldGetBasePathFromAppConfig() { var config = new FirebaseConfig(); Assert.AreEqual(config.BasePath, BASE_PATH); }
public void ShouldGetAuthKeyFromAppConfig() { var config = new FirebaseConfig(); Assert.AreEqual(config.AuthSecret, FIREBASE_SECRET); }
public async Task<ActionResult> Index() { //initialize dropbox auth options var options = new Options { ClientId = "rnizd2wt4vhv4cn", ClientSecret = "k8exfknbce45n5g", RedirectUri = "https://fedup.azurewebsites.net/Incident" //RedirectUri = "http://localhost:49668/Incident" }; // Initialize a new Client (without an AccessToken) var dropboxClient = new Client(options); // Get the OAuth Request Url var authRequestUrl = await dropboxClient.Core.OAuth2.AuthorizeAsync("code"); if (Request.QueryString["code"] == null) { // Navigate to authRequestUrl using the browser, and retrieve the Authorization Code from the response Response.Redirect(authRequestUrl.ToString()); } //get authcode from querstring param var authCode = Request.QueryString["code"]; // Exchange the Authorization Code with Access/Refresh tokens var token = await dropboxClient.Core.OAuth2.TokenAsync(authCode); // Get account info var accountInfo = await dropboxClient.Core.Accounts.AccountInfoAsync(); Console.WriteLine("Uid: " + accountInfo.uid); Console.WriteLine("Display_name: " + accountInfo.display_name); Console.WriteLine("Email: " + accountInfo.email); // Get root folder without content var rootFolder = await dropboxClient.Core.Metadata.MetadataAsync("/", list: false); Console.WriteLine("Root Folder: {0} (Id: {1})", rootFolder.Name, rootFolder.path); // Get root folder with content rootFolder = await dropboxClient.Core.Metadata.MetadataAsync("/", list: true); foreach (var folder in rootFolder.contents) { Console.WriteLine(" -> {0}: {1} (Id: {2})", folder.is_dir ? "Folder" : "File", folder.Name, folder.path); } // Initialize a new Client (with an AccessToken) var client2 = new Client(options); // Find a file in the root folder var file = rootFolder.contents.FirstOrDefault(x => x.is_dir == false); var files = rootFolder.contents.ToList(); // Download a file foreach (var item in files) { var tempFile = Path.GetTempFileName(); if (item.path.Substring(item.path.Length - 4) == ".mp3") { using (var fileStream = System.IO.File.OpenWrite(tempFile)) { await client2.Core.Metadata.FilesAsync(item.path, fileStream); fileStream.Flush(); fileStream.Close(); } int length = item.path.Length; string destination = item.path.Substring(0, length - 4) + ".mp3"; destination = AppDomain.CurrentDomain.BaseDirectory + destination.Substring(1); System.IO.File.Copy(tempFile, destination, true); } } List<incident> Incidents = new List<incident>(); IFirebaseConfig config = new FirebaseConfig { AuthSecret = "0dwRwB8V2QmJTM9NbKtWfqlys91LwZguvE67oS1f", BasePath = "https://fedup.firebaseio.com/" }; //initialize new firebase client IFirebaseClient client = new FirebaseClient(config); bool hasNext = true; int counter = 1; do { try { //pull current row FirebaseResponse response = await client.GetAsync(counter.ToString()); //parse our json object incident jsonObject = JsonConvert.DeserializeObject<incident>(response.Body); System.DateTime dtDateTime = new DateTime(1970,1,1,0,0,0,0,System.DateTimeKind.Utc); dtDateTime = dtDateTime.AddSeconds(jsonObject.timestamp).ToLocalTime(); jsonObject.newTimeStamp = dtDateTime; Incidents.Add(jsonObject); } catch { hasNext = false; break; } counter++; } while (hasNext); ViewBag.Incidents = Incidents; return View(); }
protected override async void FinalizeSetUp() { IFirebaseConfig config = new FirebaseConfig(); _client = new FirebaseClient(config); //Uses RestSharp JsonSerializer as default await _client.DeleteAsync("todos"); }
public HttpResponseMessage Get(string AuthSecret, string BasePath, string command) { try { IFirebaseConfig config = new FirebaseConfig { AuthSecret = AuthSecret, BasePath = BasePath }; IFirebaseClient client = new FirebaseClient(config); FirebaseResponse response; if (String.IsNullOrWhiteSpace(command)) response = client.Get("/"); else response = client.Get("/"+command.ToString()); return Request.CreateResponse(HttpStatusCode.OK, response); ; } catch (KeyNotFoundException) { string mensagem = string.Format("Não foi possível criptografar a entrada: ", command); HttpError error = new HttpError(mensagem); return Request.CreateResponse(HttpStatusCode.NotFound, error); } }