Skip to content

Commit dbbc4b4

Browse files
author
Michael Eden
committed
Linked to the official doc
1 parent 87442d5 commit dbbc4b4

File tree

1 file changed

+1
-115
lines changed

1 file changed

+1
-115
lines changed

README.md

Lines changed: 1 addition & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,118 +1,4 @@
1-
# API Docs can be found [here](http://icanteden.com/rust-firebase/firebase/)
2-
31
# Rust Firebase
4-
52
Rust based library for interacting with the Firebase REST API.
63

7-
## Load the crate!
8-
9-
Don't forget to include the library in your project:
10-
```Rust
11-
extern crate firebase;
12-
use firebase::Firebase;
13-
```
14-
15-
## Creating a Firebase reference
16-
17-
### Simple
18-
You can currently create a simple reference to your firebase server:
19-
20-
```Rust
21-
let firebase = Firebase::new("https://<your-firebase>.firebaseio.com");
22-
```
23-
24-
### Authenticated
25-
Or you can create an authenticated connection by supplying your [auth](https://www.firebase.com/docs/rest/guide/user-auth.html) token:
26-
27-
```Rust
28-
let firebase = Firebase::authed("https://<your-firebase>.firebaseio.com", "<token>");
29-
```
30-
31-
**NOTE:** You must send your requests through HTTPS or Firebase will reject it.
32-
Not specifying HTTPS will also result in an error: ParseError::UrlIsNotHTTPS
33-
34-
## Walking the database
35-
36-
Reference nested objects in your server like so:
37-
38-
```Rust
39-
let show = firebase.at("/shows/futurama"); // points to /shows/futurama
40-
let episode = show.at("s10/meanwhile"); // points to /shows/futurama/s10/meanwhile
41-
```
42-
43-
Slashes and .json extensions will be handled accordingly:
44-
45-
```Rust
46-
// All of the following are equivalent:
47-
let show = firebase.at("/shows/futurama.json");
48-
let show = firebase.at("shows/futurama/");
49-
let show = firebase.at("/shows/futurama/");
50-
```
51-
52-
## Working with data
53-
54-
### Reading data
55-
56-
Reading data can be done with a simple call to ```.get()```
57-
```Rust
58-
let response = show.get();
59-
```
60-
61-
### Writing data
62-
63-
```Rust
64-
let description = episode.at("description");
65-
let response = description.set("the last episode");
66-
```
67-
68-
### Pushing data
69-
70-
```Rust
71-
let episodes = firebase.at("/shows/futurama/episodes");
72-
let response = episodes.push("The Lost Episode!");
73-
```
74-
75-
### Updating data
76-
77-
```Rust
78-
let description = episode.at("description");
79-
let response = description.update("the penultimate episode");
80-
```
81-
82-
### Removing data
83-
84-
```Rust
85-
let episode = firebase.at("/shows/futurama/s10/meanwhile");
86-
let response = episode.remove();
87-
```
88-
89-
## Requests with parameters
90-
91-
```Rust
92-
let episodes = firebase.at("/shows/futurama/episodes");
93-
let top5 = episodes.order_by("\"imdb\"").limit_to_first(5).get();
94-
```
95-
96-
The full list of supported parameters are listed here:
97-
98-
- ```order_by```
99-
- ```limit_to_first```
100-
- ```limit_to_last```
101-
- ```start_at```
102-
- ```end_at```
103-
- ```equal_to```
104-
- ```shallow```
105-
106-
## Not yet there...
107-
108-
### Working with JSON values
109-
110-
For now JSON is sent and received as a string literal, an easier method is
111-
likely to be implemented in future versions
112-
113-
```Rust
114-
let json = "{ \"name\": \"David Smith\" }"
115-
116-
let people = firebase.at("/earth/us/indiana");
117-
let response = episodes.push(json);
118-
```
4+
## API Docs can be found [here](http://icanteden.com/rust-firebase/firebase/)

0 commit comments

Comments
 (0)