2022-02-07 13:22:43 +00:00
|
|
|
import json
|
|
|
|
from sqlite3 import Row
|
|
|
|
from typing import Optional
|
|
|
|
|
|
|
|
from fastapi import Request
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from pydantic.main import BaseModel
|
2022-02-08 13:13:36 +00:00
|
|
|
from fastapi.param_functions import Query
|
2022-02-08 10:35:20 +00:00
|
|
|
|
2022-02-07 13:22:43 +00:00
|
|
|
class nostrKeys(BaseModel):
|
|
|
|
pubkey: str
|
|
|
|
privkey: str
|
|
|
|
|
|
|
|
class nostrNotes(BaseModel):
|
|
|
|
id: str
|
|
|
|
pubkey: str
|
|
|
|
created_at: str
|
|
|
|
kind: int
|
|
|
|
tags: str
|
|
|
|
content: str
|
|
|
|
sig: str
|
|
|
|
|
2022-02-07 20:01:01 +00:00
|
|
|
class nostrCreateRelays(BaseModel):
|
2022-02-08 13:13:36 +00:00
|
|
|
relay: str = Query(None)
|
2022-02-07 20:01:01 +00:00
|
|
|
|
|
|
|
class nostrCreateConnections(BaseModel):
|
2022-02-08 13:13:36 +00:00
|
|
|
pubkey: str = Query(None)
|
|
|
|
relayid: str = Query(None)
|
2022-02-07 20:01:01 +00:00
|
|
|
|
2022-02-07 13:22:43 +00:00
|
|
|
class nostrRelays(BaseModel):
|
2022-02-08 13:13:36 +00:00
|
|
|
id: Optional[str]
|
|
|
|
relay: Optional[str]
|
2022-02-10 09:58:50 +00:00
|
|
|
status: Optional[bool] = False
|
2022-02-07 13:22:43 +00:00
|
|
|
|
2022-02-08 10:35:20 +00:00
|
|
|
class nostrRelayList(BaseModel):
|
|
|
|
id: str
|
2022-02-08 13:13:36 +00:00
|
|
|
allowlist: Optional[str]
|
|
|
|
denylist: Optional[str]
|
2022-02-08 10:35:20 +00:00
|
|
|
|
2022-02-08 13:13:36 +00:00
|
|
|
class nostrRelaySetList(BaseModel):
|
|
|
|
allowlist: Optional[str]
|
|
|
|
denylist: Optional[str]
|
2022-02-08 10:35:20 +00:00
|
|
|
|
2022-02-07 13:22:43 +00:00
|
|
|
class nostrConnections(BaseModel):
|
|
|
|
id: str
|
2022-02-08 13:13:36 +00:00
|
|
|
pubkey: Optional[str]
|
|
|
|
relayid: Optional[str]
|
|
|
|
|
|
|
|
class nostrSubscriptions(BaseModel):
|
|
|
|
id: str
|
|
|
|
userPubkey: Optional[str]
|
|
|
|
subscribedPubkey: Optional[str]
|