concordia-sdk-python 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
concordia_client.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
from typing import Any, Dict, Optional
|
|
3
|
+
import hmac
|
|
4
|
+
import hashlib
|
|
5
|
+
|
|
6
|
+
class ConcordiaClient:
|
|
7
|
+
def __init__(self, base_url: str = 'https://api.concordia.app/v1', token: Optional[str] = None):
|
|
8
|
+
self.base_url = base_url.rstrip('/')
|
|
9
|
+
self.token = token
|
|
10
|
+
|
|
11
|
+
def _headers(self):
|
|
12
|
+
h = {'Content-Type': 'application/json'}
|
|
13
|
+
if self.token:
|
|
14
|
+
h['Authorization'] = f'Bearer {self.token}'
|
|
15
|
+
return h
|
|
16
|
+
|
|
17
|
+
def adminLogin(self, payload: Dict[str, Any]) -> Dict[str, Any]:
|
|
18
|
+
resp = requests.post(f"{self.base_url}/api/auth/login", json=payload, headers=self._headers())
|
|
19
|
+
resp.raise_for_status()
|
|
20
|
+
return resp.json()
|
|
21
|
+
|
|
22
|
+
def requestMagicLink(self, payload: Dict[str, Any]) -> Dict[str, Any]:
|
|
23
|
+
resp = requests.post(f"{self.base_url}/api/auth/request-link", json=payload, headers=self._headers())
|
|
24
|
+
resp.raise_for_status()
|
|
25
|
+
return resp.json()
|
|
26
|
+
|
|
27
|
+
def verify_webhook_signature(signature: str, payload: bytes, secret: str) -> bool:
|
|
28
|
+
"""Verify HMAC-SHA256 signature. Signature may be hex or prefixed with 'sha256='."""
|
|
29
|
+
if not signature:
|
|
30
|
+
return False
|
|
31
|
+
sig = signature.split('=')[-1]
|
|
32
|
+
mac = hmac.new(secret.encode('utf8'), payload, hashlib.sha256).hexdigest()
|
|
33
|
+
try:
|
|
34
|
+
return hmac.compare_digest(mac, sig)
|
|
35
|
+
except Exception:
|
|
36
|
+
return False
|
|
37
|
+
|
|
38
|
+
# Additional methods can be added following operationId names.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: concordia-sdk-python
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Concordia Python SDK
|
|
5
|
+
Author: Concordia
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
|
|
8
|
+
# Concordia Python SDK (minimal)
|
|
9
|
+
|
|
10
|
+
Usage:
|
|
11
|
+
|
|
12
|
+
```py
|
|
13
|
+
from concordia_client import ConcordiaClient
|
|
14
|
+
c = ConcordiaClient(base_url='https://api.concordia.app/v1', token='TOKEN')
|
|
15
|
+
resp = c.adminLogin({'email':'a','password':'b'})
|
|
16
|
+
```
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
concordia_client.py,sha256=tRAZaEU-arzow1V-6Q5DsRSOi0GRK5oawXxB9vbxHwM,1459
|
|
2
|
+
models.py,sha256=4_0_iUTpPMTGwLfv_UCmna2GEbZJu581v9OVef5C7ZI,576
|
|
3
|
+
concordia_sdk_python-1.0.0.dist-info/METADATA,sha256=01pBjyXT5V81ck1Dv4910WV0jnpgh5Vs1bnPw7WQi6E,392
|
|
4
|
+
concordia_sdk_python-1.0.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
5
|
+
concordia_sdk_python-1.0.0.dist-info/top_level.txt,sha256=b5xeqtHaPS8QxBCJ_Ob6u1PeDgd3hfMsdU4kgzgaCGU,24
|
|
6
|
+
concordia_sdk_python-1.0.0.dist-info/RECORD,,
|
models.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import Any, Dict
|
|
3
|
+
|
|
4
|
+
@dataclass
|
|
5
|
+
class GenericModel:
|
|
6
|
+
data: Dict[str, Any]
|
|
7
|
+
|
|
8
|
+
# Minimal model placeholders for schemas
|
|
9
|
+
AdminLoginRequest = GenericModel
|
|
10
|
+
AuthResponse = GenericModel
|
|
11
|
+
ErrorResponse = GenericModel
|
|
12
|
+
RequestMagicLinkRequest = GenericModel
|
|
13
|
+
TokenResponse = GenericModel
|
|
14
|
+
VerifyOtpRequest = GenericModel
|
|
15
|
+
OrderItem = GenericModel
|
|
16
|
+
OrderCreateRequest = GenericModel
|
|
17
|
+
Order = GenericModel
|
|
18
|
+
Voucher = GenericModel
|
|
19
|
+
Category = GenericModel
|
|
20
|
+
MenuItem = GenericModel
|
|
21
|
+
Variant = GenericModel
|
|
22
|
+
VariantGroup = GenericModel
|