File: notifications.markdown

package info (click to toggle)
python-diaspy 0.6.0-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 352 kB
  • sloc: python: 1,600; makefile: 149
file content (61 lines) | stat: -rw-r--r-- 1,316 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#### `Notifications()` object

In order to get list of notifications use 
`diaspy.notifications.Notifications()` object. It support iteration and 
indexing.

When creating new instance of `Notifications` only `Connection` object 
is needed.

#### Methods

##### `last()`

This method will return you last five notifications.

##### `get()`

This is slightly more advanced then `last()`. It allows you to specify 
how many notifications per page you want to get and which page you want 
to recieve.

##### `update()`

This will insert new notifications to the object.

##### `more()`

This will append older notifications to the object.

 

----

#### `Notification()` model

Single notification (it should be obvious that it requires object of its
 own) is located in `diaspy.models.Notification()`. It has several 
methods you can use.

##### 1. `who()`

This method will return list of guids of the users who caused you to get
 this notification.

##### 2. `when()`

This method will return UTC time when you get the notification.

##### 3. `mark()`

To mark notification as `read` or `unread`. It has one parameter - 
`unread` which is boolean.

 

Also, you can use `str()` and `repr()` on the `Notification()` and you 
will get nice string.

----

###### Manual for `diaspy`, written by Marek Marecki