https://github.com/magenta-aps/os2mo-http-trigger-protocol
OS2mo HTTP trigger protocol interface library
https://github.com/magenta-aps/os2mo-http-trigger-protocol
managed-by-atlantis mirrored-repository
Last synced: 20 days ago
JSON representation
OS2mo HTTP trigger protocol interface library
- Host: GitHub
- URL: https://github.com/magenta-aps/os2mo-http-trigger-protocol
- Owner: magenta-aps
- License: other
- Created: 2022-12-08T13:13:04.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-04-04T10:41:05.000Z (about 2 years ago)
- Last Synced: 2025-02-17T15:47:08.862Z (4 months ago)
- Topics: managed-by-atlantis, mirrored-repository
- Language: Python
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OS2mo HTTP Trigger Protocol
This package contains the interfaces used for the OS2mo http trigger protocol.
## Usage
Install into your project using `pip`:
```
pip install os2mo-http-trigger-protocol
```Then import it inside a Python file:
```
from typing import Listfrom os2mo_http_trigger_protocol import (
EventType,
MOTriggerPayload,
MOTriggerRegister,
RequestType,
)
from fastapi import FastAPIapp = FastAPI()
@app.get(
"/triggers",
summary="List triggers to be registered.",
response_model=List[MOTriggerRegister],
)
def triggers():
"""List triggers to be registered."""
return [
{
"event_type": EventType.ON_BEFORE,
"request_type": RequestType.EDIT,
"role_type": "org_unit",
"url": "/triggers/ou/edit",
}
]@app.post(
"/triggers/ou/edit",
summary="Print that an organizational unit has been edited",
)
async def triggers_ou_create(payload: MOTriggerPayload):
"""Fired when an OU has been created."""
return {"Hello": "World"}
```