Skip to content

Commit e3760de

Browse files
committed
Merge branch 'master' of github.com:KartikTalwar/Gmail.js
2 parents 14951bb + 2e801e5 commit e3760de

File tree

1 file changed

+170
-7
lines changed

1 file changed

+170
-7
lines changed

README.md

Lines changed: 170 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ var gmail = Gmail();
1919

2020
## Methods
2121

22+
### Summary
2223

23-
### GET
24+
#### GET
2425

2526

2627
- gmail.get **.visible_emails()**
@@ -29,7 +30,6 @@ var gmail = Gmail();
2930
- gmail.get **.storage_info()**
3031
- gmail.get **.current_page()**
3132
- gmail.get **.email_subject()**
32-
- gmail.get **.email_ids()**
3333
- gmail.get **.email_id()**
3434
- gmail.get **.search_query()**
3535
- gmail.get **.unread_emails()**
@@ -46,7 +46,7 @@ var gmail = Gmail();
4646

4747

4848

49-
### CHECK
49+
#### CHECK
5050

5151

5252
- gmail.check **.is_thread()**
@@ -66,7 +66,7 @@ var gmail = Gmail();
6666
- gmail.check **.is_signal_installed()**
6767

6868

69-
### OBSERVE
69+
#### OBSERVE
7070

7171
- gmail.observe **.http_requests()**
7272
- gmail.observe **.actions()**
@@ -101,7 +101,7 @@ var gmail = Gmail();
101101
- gmail.observe **.off(action)**
102102

103103

104-
### DOM
104+
#### DOM
105105

106106

107107
- gmail.dom **.inbox_content()**
@@ -112,7 +112,7 @@ var gmail = Gmail();
112112
- gmail.dom **.search_bar()**
113113

114114

115-
### TOOLS
115+
#### TOOLS
116116

117117
- gmail.tools **.xhr_watcher()**
118118
- gmail.tools **.parse_url()**
@@ -122,7 +122,7 @@ var gmail = Gmail();
122122
- gmail.tools **.make_request()**
123123

124124

125-
### TRACKER
125+
#### TRACKER
126126

127127
- gmail.tracker **.events**
128128
- gmail.tracker **.xhr_init**
@@ -133,3 +133,166 @@ var gmail = Gmail();
133133
- gmail.tracker **.email_data**
134134
- gmail.tracker **.ik**
135135
- gmail.tracker **.rid**
136+
137+
138+
139+
### Details
140+
141+
142+
#### gmail.get.visible_emails()
143+
144+
Returns a list of emails from the server that are currently visible in the inbox view. The data does not come from the DOM
145+
146+
```json
147+
[{"id": "1425a3693a4c45d0",
148+
"title": "<b>What if video games were real? On YouTube</b>",
149+
"excerpt": "View email in a web browser Header Super Mario Brothers Parkour by Warialasky Super Mario Brothers",
150+
"time": "Fri, Nov 15, 2013 at 12:23 AM",
151+
"sender": "noreply@youtube.com",
152+
"attachment": "",
153+
"labels": ["^all", "^i", "^smartlabel_social", "^unsub"]}]
154+
```
155+
156+
#### gmail.get.email_data()
157+
158+
Returns an object representation of the opened email contents and metadata
159+
160+
```json
161+
{
162+
"first_email": "141d44da39d6caf8",
163+
"last_email": "141d44da39d6caf8",
164+
"total_emails": 1,
165+
"total_threads": ["141d44da39d6caf8"],
166+
"people_involved": [
167+
["Kartik Talwar", "hi@kartikt.com"],
168+
["California", "california@gmail.com"]
169+
],
170+
"subject": "test",
171+
"threads": {
172+
"141d44da39d6caf8": {
173+
"reply_to_id": "",
174+
"from": "California",
175+
"from_email": "california@gmail.com",
176+
"timestamp": 1382246359000,
177+
"datetime": "Sun, Nov 20, 2013 at 1:19 AM",
178+
"content_plain": "another test",
179+
"subject": "test",
180+
"content_html": "<div dir=\"ltr\">another test</div>\n"
181+
}
182+
}
183+
}
184+
```
185+
186+
#### gmail.get.user_email()
187+
188+
Returns the current user's email address
189+
190+
```js
191+
"california@gmail.com"
192+
```
193+
194+
#### gmail.get.storage_info()
195+
196+
Returns current user's file storage stats
197+
198+
```json
199+
{
200+
"used": "0 GB",
201+
"total": "15 GB",
202+
"percent": 0
203+
}
204+
```
205+
206+
#### gmail.get.current_page()
207+
208+
Returns what page of gmail the user is currently on. These are the possible responses
209+
210+
```js
211+
['sent', 'inbox', 'starred', 'drafts', 'imp', 'chats', 'all', 'spam', 'trash'] // pages
212+
null // inside email conversation
213+
"/search/[.+]" // inside search view
214+
"/label/[.+]" // inside label view
215+
"/category/[.+]" // inside category view
216+
```
217+
218+
#### gmail.get.email_subject()
219+
220+
Returns the opened email's subject from the DOM
221+
222+
```js
223+
"test"
224+
```
225+
226+
227+
#### gmail.get.email_id()
228+
229+
Gets current email's ID
230+
231+
```js
232+
"141de25dc0b48e4f"
233+
```
234+
235+
#### gmail.get.search_query()
236+
237+
Returns the search bar data
238+
239+
```js
240+
"from:hi@kartikt.com is:unread"
241+
```
242+
243+
#### gmail.get.unread_emails()
244+
245+
Returns a count of total unread emails for the current account.
246+
247+
```json
248+
{
249+
"inbox": 2,
250+
"drafts": 0,
251+
"spam": 0,
252+
"forum": 0,
253+
"notifications": 0,
254+
"promotions": 0,
255+
"social": 0
256+
}
257+
```
258+
259+
You can also request the data individually
260+
261+
- **gmail.get.unread_inbox_emails()**
262+
- **gmail.get.unread_draft_emails()**
263+
- **gmail.get.unread_spam_emails()**
264+
- **gmail.get.unread_forum_emails()**
265+
- **gmail.get.unread_notification_emails()**
266+
- **gmail.get.unread_promotion_emails()**
267+
- **gmail.get.unread_social_emails()**
268+
269+
270+
#### gmail.get.last_active()
271+
272+
Gets user's account activity data
273+
274+
```json
275+
{
276+
"time": "9:41 pm",
277+
"ip": "54.234.192.48",
278+
"mac_address": "2620:101:f000:702:a966:ab42:4a46:195e",
279+
"time_relative": "31 minutes ago"
280+
}
281+
```
282+
283+
#### gmail.get.loggedin_accounts()
284+
285+
Returns a list of signed-in accounts (multiple user accounts setup in gmail)
286+
287+
```json
288+
[{"name":"California","email":"california@gmail.com"}]
289+
```
290+
291+
#### gmail.get.beta()
292+
293+
Although hand picked, this method returns the checks on beta features and deployments
294+
295+
```json
296+
{"new_nav_bar":true}
297+
```
298+

0 commit comments

Comments
 (0)