Metadata-Version: 2.4
Name: tryton-naiad
Version: 8.0.0
Summary: Library to access Tryton's REST API
Project-URL: homepage, https://www.tryton.org/
Project-URL: documentation, https://docs.tryton.org/client-rest/
Project-URL: changelog, https://docs.tryton.org/client-library/releases.html
Project-URL: forum, https://discuss.tryton.org/tags/naiad
Project-URL: issues, https://bugs.tryton.org/tryton
Project-URL: repository, https://code.tryton.org/tryton
Project-URL: funding, https://www.tryton.org/donate
Author: B2CK SRL
Author-email: Cédric Krier <cedric.krier@b2ck.com>
Maintainer-email: Tryton <foundation@tryton.org>
License-Expression: LGPL-3.0-or-later
License-File: COPYRIGHT
License-File: LICENSE
Keywords: REST,cli,tryton
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Plugins
Classifier: Framework :: Tryton
Classifier: Intended Audience :: Developers
Classifier: Topic :: Office/Business
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: httpx
Provides-Extra: test
Requires-Dist: respx; extra == 'test'
Requires-Dist: trytond<8.1,>=8.0; extra == 'test'
Description-Content-Type: text/x-rst

==================
Tryton REST Client
==================

A library to access Tryton's REST API.

Example of usage
----------------

   >>> from naiad import Client, Record

Configuration
~~~~~~~~~~~~~

   >>> import os
   >>> url = os.environ.get('NAIAD_URL', 'https://localhost:8000/:memory:')
   >>> client = Client(url, os.getenv('NAIAD_KEY'))

Creating a new group
~~~~~~~~~~~~~~~~~~~~

   >>> group = Record('res.group')
   >>> group.name = "New Group"
   >>> group = client.store(group)
   >>> group.id >= 0
   True

Searching a user
~~~~~~~~~~~~~~~~

   >>> admin, = client.search(
   ...      'res.user', [('login', '=', 'admin')], fields=['login'])
   >>> admin.login
   'admin'

Modifying a user
~~~~~~~~~~~~~~~~

   >>> admin.signature = "Administrator"
   >>> admin.groups = [group]
   >>> admin = client.store(admin, fields=['signature', 'groups.id'])
   >>> admin.signature
   'Administrator'
   >>> group in admin.groups
   True

Calling an action
~~~~~~~~~~~~~~~~~

   >>> _ = client.action(admin, 'reset_password')

Fetching a report
~~~~~~~~~~~~~~~~~

   >>> filename, content = client.report('res.user.email_reset_password', admin.id)

