Spaces:
Sleeping
Sleeping
File size: 679 Bytes
9575051 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import json
from model.bulletpoint import BulletPoint
class Headline:
def __init__(self, id: int, title: str, bulletpoints: [BulletPoint]):
self.id = id
self.title = title
self.bulletpoints = bulletpoints
def serialize(self):
return {
"id": self.id,
"title": self.title,
"bulletpoints": [bulletpoint.serialize() for bulletpoint in self.bulletpoints]
}
class HeadlineResponse:
def __init__(self, headlines: [Headline]):
self.headlines = headlines
def serialize(self):
return {
"headlines": [headline.serialize() for headline in self.headlines]
}
|