You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1.0 KiB
Python
31 lines
1.0 KiB
Python
import argparse
|
|
import json
|
|
|
|
from app.services.integrations.events import SUPPORTED_EVENT_TYPES
|
|
from app.services.integrations.service import upsert_email_integration_route
|
|
|
|
|
|
def main() -> None:
|
|
parser = argparse.ArgumentParser(description="Cria ou atualiza uma rota de integracao por email.")
|
|
parser.add_argument("--event", required=True, choices=SUPPORTED_EVENT_TYPES)
|
|
parser.add_argument("--recipient", required=True)
|
|
parser.add_argument("--name")
|
|
parser.add_argument("--subject-template")
|
|
parser.add_argument("--body-template")
|
|
parser.add_argument("--disabled", action="store_true")
|
|
args = parser.parse_args()
|
|
|
|
route = upsert_email_integration_route(
|
|
event_type=args.event,
|
|
recipient_email=args.recipient,
|
|
recipient_name=args.name,
|
|
subject_template=args.subject_template,
|
|
body_template=args.body_template,
|
|
enabled=not args.disabled,
|
|
)
|
|
print(json.dumps(route, ensure_ascii=True, indent=2, sort_keys=True))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|