]> git.notmuchmail.org Git - notmuch/blob - bindings/python/docs/source/index.rst
e9f39eb03428269bf037b1255095dc885d29d162
[notmuch] / bindings / python / docs / source / index.rst
1 .. notmuch documentation master file, created by
2    sphinx-quickstart on Tue Feb  2 10:00:47 2010.
3
4 .. currentmodule:: notmuch
5
6 Welcome to :mod:`notmuch`'s documentation
7 ===========================================
8
9 The :mod:`notmuch` module provides an interface to the `notmuch <http://notmuchmail.org>`_ functionality, directly interfacing to a shared notmuch library.
10 Within :mod:`notmuch`, the classes :class:`Database`, :class:`Query` provide most of the core functionality, returning :class:`Threads`, :class:`Messages` and :class:`Tags`.
11
12 .. moduleauthor:: Sebastian Spaeth <Sebastian@SSpaeth.de>
13
14 :License: This module is covered under the GNU GPL v3 (or later).
15
16 This page contains the main API overview of notmuch |release|. 
17
18 Notmuch can be imported as::
19
20  import notmuch
21
22 or::
23
24  from notmuch import Query,Database
25
26 More information on specific topics can be found on the following pages:
27
28 .. toctree::
29    :maxdepth: 1
30
31    status_and_errors
32    notmuch   
33
34 :mod:`notmuch` -- The Notmuch interface
35 =================================================
36
37 .. automodule:: notmuch
38
39 :todo: Document nmlib,STATUS
40
41 :class:`notmuch.Database` -- The underlying notmuch database
42 ---------------------------------------------------------------------
43
44 .. autoclass:: notmuch.Database([path=None[, create=False[, mode=MODE.READ_ONLY]]])
45
46    .. automethod:: create
47
48    .. automethod:: open(path, status=MODE.READ_ONLY)
49
50    .. automethod:: get_path
51
52    .. automethod:: get_version
53
54    .. automethod:: needs_upgrade
55
56    .. automethod:: upgrade
57
58    .. automethod:: get_directory
59
60    .. automethod:: add_message
61
62    .. automethod:: remove_message
63
64    .. automethod:: find_message
65
66    .. automethod:: get_all_tags
67
68    .. automethod:: create_query
69
70    .. note:: :meth:`create_query` was broken in release
71              0.1 and is fixed since 0.1.1.
72
73    .. attribute:: Database.MODE
74
75      Defines constants that are used as the mode in which to open a database.
76
77      MODE.READ_ONLY
78        Open the database in read-only mode
79
80      MODE.READ_WRITE
81        Open the database in read-write mode
82
83    .. autoattribute:: db_p
84
85 :class:`notmuch.Query` -- A search query
86 -------------------------------------------------
87
88 .. autoclass:: notmuch.Query
89
90    .. automethod:: create
91
92    .. attribute:: Query.SORT
93
94      Defines constants that are used as the mode in which to open a database.
95
96      SORT.OLDEST_FIRST
97        Sort by message date, oldest first.
98
99      SORT.NEWEST_FIRST
100        Sort by message date, newest first.
101
102      SORT.MESSAGE_ID
103        Sort by email message ID.
104
105      SORT.UNSORTED
106        Do not apply a special sort order (returns results in document id     
107        order). 
108
109    .. automethod:: set_sort
110
111    .. attribute::  sort
112
113       Instance attribute :attr:`sort` contains the sort order (see
114       :attr:`Query.SORT`) if explicitely specified via
115       :meth:`set_sort`. By default it is set to `None`.
116
117    .. automethod:: search_threads
118
119    .. automethod:: search_messages
120
121    .. automethod:: count_messages
122
123
124 :class:`Messages` -- A bunch of messages
125 ----------------------------------------
126
127 .. autoclass:: Messages
128
129    .. automethod:: collect_tags
130
131    .. method:: __len__()
132
133    .. note:: :meth:`__len__` was removed in version 0.6 as it exhausted
134        the iterator and broke list(Messages()). Use the
135        :meth:`Query.count_messages` function or use
136        `len(list(msgs))`.
137
138 :class:`Message` -- A single message
139 ----------------------------------------
140
141 .. autoclass:: Message
142
143    .. automethod:: get_message_id
144
145    .. automethod:: get_thread_id
146
147    .. automethod:: get_replies
148
149    .. automethod:: get_filename
150
151    .. automethod:: get_filenames
152
153    .. attribute:: FLAG
154
155         FLAG.MATCH 
156           This flag is automatically set by a
157           Query.search_threads on those messages that match the
158           query. This allows us to distinguish matches from the rest
159           of the messages in that thread.
160
161    .. automethod:: get_flag
162
163    .. automethod:: set_flag
164    
165    .. automethod:: get_date
166
167    .. automethod:: get_header
168
169    .. automethod:: get_tags
170
171    .. automethod:: maildir_flags_to_tags
172
173    .. automethod:: tags_to_maildir_flags
174
175    .. automethod:: remove_tag
176
177    .. automethod:: add_tag
178
179    .. automethod:: remove_all_tags
180
181    .. automethod:: freeze
182
183    .. automethod:: thaw
184
185    .. automethod:: format_message_as_json
186
187    .. automethod:: format_message_as_text
188
189    .. automethod:: __str__
190
191
192 :class:`Tags` -- Notmuch tags
193 -----------------------------
194
195 .. autoclass:: Tags
196    :members:
197
198    .. automethod:: __len__
199
200    .. automethod:: __str__
201
202
203 :class:`notmuch.Threads` -- Threads iterator
204 -----------------------------------------------------
205
206 .. autoclass:: notmuch.Threads
207
208    .. automethod:: __len__
209
210    .. automethod:: __str__
211
212 :class:`Thread` -- A single thread
213 ------------------------------------
214
215 .. autoclass:: Thread
216
217   .. automethod:: get_thread_id
218
219   .. automethod:: get_total_messages
220
221   .. automethod:: get_toplevel_messages
222
223   .. automethod:: get_matched_messages
224
225   .. automethod:: get_authors
226
227   .. automethod:: get_subject
228
229   .. automethod:: get_oldest_date
230
231   .. automethod:: get_newest_date
232
233   .. automethod:: get_tags
234
235   .. automethod:: __str__
236
237
238 :class:`Filenames` -- An iterator over filenames
239 ------------------------------------------------
240
241 .. autoclass:: notmuch.database.Filenames
242
243    .. automethod:: notmuch.database.Filenames.__len__
244
245 :class:`notmuch.database.Directoy` -- A directory entry in the database
246 ------------------------------------------------------------------------
247
248 .. autoclass:: notmuch.database.Directory
249
250    .. automethod:: notmuch.database.Directory.get_child_files
251
252    .. automethod:: notmuch.database.Directory.get_child_directories
253
254    .. automethod:: notmuch.database.Directory.get_mtime
255
256    .. automethod:: notmuch.database.Directory.set_mtime
257
258    .. autoattribute:: notmuch.database.Directory.mtime
259
260    .. autoattribute:: notmuch.database.Directory.path
261
262
263 The `next page <status_and_errors.html>`_ contains information on possible Status and Error values.
264
265 Indices and tables
266 ==================
267
268 * :ref:`genindex`
269 * :ref:`search`
270