Skip to content

Instantly share code, notes, and snippets.

@walkingpendulum
Created April 7, 2022 14:26
Show Gist options
  • Save walkingpendulum/29657aac15576d111e8dc59d68e1a01b to your computer and use it in GitHub Desktop.
Save walkingpendulum/29657aac15576d111e8dc59d68e1a01b to your computer and use it in GitHub Desktop.
contract suggestions
from enum import Enum
from pydantic import BaseModel, Field
from typing import Union
# Artur:
{
"boundary": "geojson",
"changedBy": "string",
"integrationId": "string"
}
# APHM old contract
class EventType(str, Enum):
cronjob_generation = 'cronjob_generation'
class Event(BaseModel):
version: str
created_at: str
event_type: EventType
source_component: str
payload: dict
# Oleg
#
# example:
# {
# "version": "1",
# "created_at": "2022-04-06T08:00:13.167421",
# "event_type": "cronjob_generation",
# "source_component": "amph-generation-trigger",
# "payload":
# {
# "period_to": "2022-04-30T00:00:00Z",
# "period_from": "2022-04-01T00:00:00Z"
# }
# }
# Headers:
# TraceAir-Integration-Id: e8a3f13b1ef568670c14492964cddd1e
#
# content_type: application/json
class EventType(str, Enum):
boundary_changed = 'boundary_changed'
class User(BaseModel):
email: str
class BoundaryChangedPayload(BaseModel):
boundary: dict
changed_by: User
class Event(BaseModel):
version: str
created_at: str
event_type: EventType
source_component: str
payload: Union[BoundaryChangedPayload]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment