Orchestra-orm (aka Orchestra Object REST Mapper or Orchestra Object Resource Mapper) is a high level Python library for easily interacting with django-orchestra REST API using object oriented concepts.
pip install orchestra-orm
The main goal of this library is to provide fast and easy access to Orchestra REST API: Open a Python interpreter and start interacting right away.
To achieve this goal we have borrowed some ideas from traditional SQL object relational mappers and applied them to an hypermedia-driven resource-oriented architecture (Orchestra).
This library has been heavily inspired by Django's ORM implementation; also using an Active Record like pattern, plus concurrency based on asynchronous non-blocking I/O and caching based on Identity Mapping.
Orchestra-orm leverages the HATEOAS discoverability of Orchestra's API; rather than relying on a predefined knowledge, resources and methods are autodiscovered on the fly, while browsing the API.
Our hope is that you can use this library to produce brief, readable and efficient code in a fun and effortless way :)
The following diagram illustrates the classes used to model Orchestra REST API and how they relate to each other.
Apiis a good starting point for browsing. It represents theBaseresource of an API and it haslinkstoManagerandAction. These relations are discovered from the Link header of the HTTP response.Manageris used for accessing linkedCollectionsandResources.Actionsare used to represent action-like endpoints (i.e.get-auth-token). Actions are special methods that are not expressed using HTTP verbs (POST,GET, etc).Collectionis a list of uniform resources; all resources share the same media type (i.e. all registered nodes). For convinience it maintains alinkback to its manager in order to proxy its methods.Resourceis a local representation of a remote resource (i.e. a node), basically aResourceis an object with a URI. It may contain nested resources, orRelatedCollections.RelatedCollectionis a subcollection that all its resources are related to the sameparent(i.e. all slivers of a particular node). ARelatedCollectionis able to construct alookupfor discovering its relatedManager, therefore it is able to proxy its methods.ResourceSetis a set container that can be used to perform concurrent operations over a set of non-uniform resources.
