~kf5jwc/sms-printer

001bc477efa7f19caabd0709e22738bcb00bb077 — Kyle Jones 1 year, 9 months ago cdb5884
Create a namespace for parsers
1 files changed, 27 insertions(+), 0 deletions(-)

A sms_printer/parsers/README
A sms_printer/parsers/README => sms_printer/parsers/README +27 -0
@@ 0,0 1,27 @@
This is a namespace for providing parsers.

Adding a new parser is done by creating a new package within this namespace.

Each package is expected to have a a `validate` and a `parse` function.

```validate(data: str) -> bool```

`validate` is expected to parse and validate `data` using whichever format your parser is compatible with.


```parse(data: str) -> List[Message]```

`parse` is expected to accept the same `data`, parse it, and provide a list of messages with a `Message` specific interface.


```
Message:
    sender: str
    text: str
```

The `Message` interface must simply provide for access to information.
They currently only provide a list of messages with the sender number and message text.

- `message.sender`
- `message.text`