File: MoreAPIs.rst

package info (click to toggle)
nc-py-api 0.19.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,320 kB
  • sloc: python: 12,415; makefile: 238; xml: 100; javascript: 56; sh: 14
file content (33 lines) | stat: -rw-r--r-- 1,147 bytes parent folder | download
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
.. _more-apis:

More APIs
=========

All provided APIs can be accessed using instance of `Nextcloud` or `NextcloudApp` class.

For example, let's print all Talk conversations for the current user:

.. code-block:: python

    from nc_py_api import Nextcloud


    nc = Nextcloud(nextcloud_url="http://nextcloud.local", nc_auth_user="admin", nc_auth_pass="admin")
    all_conversations = nc.talk.get_user_conversations()
    for conversation in all_conversations:
        print(conversation.conversation_type.name + ": " + conversation.display_name)

Or let's find only your favorite conversations and send them a sweet message containing only heart emoticons: "❤️❤️❤️"


.. code-block:: python

    from nc_py_api import Nextcloud


    nc = Nextcloud(nextcloud_url="http://nextcloud.local", nc_auth_user="admin", nc_auth_pass="admin")
    all_conversations = nc.talk.get_user_conversations()
    for conversation in all_conversations:
        if conversation.is_favorite:
            print(conversation.conversation_type.name + ": " + conversation.display_name)
            nc.talk.send_message("❤️❤️❤️️", conversation)