Lesson 8: Adapter with Wireframe
These code samples provide a basic introduction to building adapters with the wireframe pattern. This pattern declares the adapter interface which is registered in the mount entity, as well as auto-provisions an outlet for the current adapter.
You can find further examples here: <https://gitlab.com/ledr/core/dev-platform/python-adapter-wireframe>
For an in-depth description adapters, please visit our wiki: <https://docs.ledr.io/en/the-orchestra-platfrom/adapters>
At the moment lesson_8_adapters.py includes code both for the adapter as well as the driver logic that interacts with the adapter. This is for ease of running the example.
Note: For most usecases, you would run your adapter code separate from your driver/client code.
To run the lesson_8 code:
python src/module/lesson_8_adapters.py
Initializing Person Adapter
Main Driver for Adapter lesson
- module.lesson_8_adapters.create_number(name: str, auth: AvAuthorization) AvEntity [source]
This function shows how to connect an entity to an adapter. Note, the use of create_entity instead of create_object. This is because create_object automatically connects to the object adapter and we don’t want that.
- Parameters:
name – (str) The number entity name
auth – The Orchestra server authorization that allows entity operations.
- Returns:
(AvEntity) The number entity
- module.lesson_8_adapters.get_count(entity: AvEntity, auth: AvAuthorization) int [source]
This function is the driver/client code that calls the adapter routet to get_count
- Parameters:
entity – (AvEntity) of the number
auth – The orchestra server authorization that allows entity operations.
- module.lesson_8_adapters.set_count(entity: AvEntity, count: int, auth: AvAuthorization)[source]
This function is the driver/client code that calls the adapter route to set_count
- Parameters:
entity – (AvEntity) of the number
count – (int) count to be set
auth – The orchestra server authorization that allows entity operations.