hooksniff-python 0.4.1__py3-none-any.whl → 0.4.2__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.
- hooksniff/client.py +4 -0
- hooksniff/resources.py +40 -0
- {hooksniff_python-0.4.1.dist-info → hooksniff_python-0.4.2.dist-info}/METADATA +5 -5
- hooksniff_python-0.4.2.dist-info/RECORD +10 -0
- hooksniff_python-0.4.1.dist-info/RECORD +0 -10
- {hooksniff_python-0.4.1.dist-info → hooksniff_python-0.4.2.dist-info}/WHEEL +0 -0
- {hooksniff_python-0.4.1.dist-info → hooksniff_python-0.4.2.dist-info}/licenses/LICENSE +0 -0
hooksniff/client.py
CHANGED
|
@@ -23,6 +23,8 @@ Usage:
|
|
|
23
23
|
from typing import Any, Dict
|
|
24
24
|
from .http_client import HttpClient
|
|
25
25
|
from .resources import (
|
|
26
|
+
BroadcastResource,
|
|
27
|
+
TransformResource,
|
|
26
28
|
ApplicationResource,
|
|
27
29
|
EndpointResource,
|
|
28
30
|
WebhookResource,
|
|
@@ -102,6 +104,8 @@ class HookSniff:
|
|
|
102
104
|
self.sso = SsoResource(self.http)
|
|
103
105
|
self.custom_domain = CustomDomainResource(self.http)
|
|
104
106
|
self.environment = EnvironmentResource(self.http)
|
|
107
|
+
self.broadcast = BroadcastResource(self.http)
|
|
108
|
+
self.transform = TransformResource(self.http)
|
|
105
109
|
|
|
106
110
|
def me(self) -> Dict[str, Any]:
|
|
107
111
|
"""Get current user profile."""
|
hooksniff/resources.py
CHANGED
|
@@ -408,3 +408,43 @@ class EnvironmentResource:
|
|
|
408
408
|
|
|
409
409
|
def list(self) -> List[Dict[str, Any]]:
|
|
410
410
|
return self.http.request("GET", "/v1/environments")
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
class BroadcastResource:
|
|
414
|
+
def __init__(self, http: HttpClient):
|
|
415
|
+
self.http = http
|
|
416
|
+
|
|
417
|
+
def list(self) -> List[Dict[str, Any]]:
|
|
418
|
+
return self.http.request("GET", "/v1/broadcasts")
|
|
419
|
+
|
|
420
|
+
def create(self, title: str, message: str, scheduled_at: str = None) -> Dict[str, Any]:
|
|
421
|
+
body = {"title": title, "message": message}
|
|
422
|
+
if scheduled_at:
|
|
423
|
+
body["scheduled_at"] = scheduled_at
|
|
424
|
+
return self.http.request("POST", "/v1/broadcasts", body)
|
|
425
|
+
|
|
426
|
+
def get(self, broadcast_id: str) -> Dict[str, Any]:
|
|
427
|
+
return self.http.request("GET", f"/v1/broadcasts/{broadcast_id}")
|
|
428
|
+
|
|
429
|
+
def delete(self, broadcast_id: str) -> None:
|
|
430
|
+
self.http.request("DELETE", f"/v1/broadcasts/{broadcast_id}")
|
|
431
|
+
|
|
432
|
+
def send(self, broadcast_id: str) -> None:
|
|
433
|
+
self.http.request("POST", f"/v1/broadcasts/{broadcast_id}/send")
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
class TransformResource:
|
|
437
|
+
def __init__(self, http: HttpClient):
|
|
438
|
+
self.http = http
|
|
439
|
+
|
|
440
|
+
def list(self, endpoint_id: str) -> List[Dict[str, Any]]:
|
|
441
|
+
return self.http.request("GET", f"/v1/endpoints/{endpoint_id}/transforms")
|
|
442
|
+
|
|
443
|
+
def create(self, endpoint_id: str, name: str, code: str) -> Dict[str, Any]:
|
|
444
|
+
return self.http.request("POST", f"/v1/endpoints/{endpoint_id}/transforms", {"name": name, "code": code})
|
|
445
|
+
|
|
446
|
+
def get(self, endpoint_id: str, transform_id: str) -> Dict[str, Any]:
|
|
447
|
+
return self.http.request("GET", f"/v1/endpoints/{endpoint_id}/transforms/{transform_id}")
|
|
448
|
+
|
|
449
|
+
def delete(self, endpoint_id: str, transform_id: str) -> None:
|
|
450
|
+
self.http.request("DELETE", f"/v1/endpoints/{endpoint_id}/transforms/{transform_id}")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hooksniff-python
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: Official HookSniff SDK for Python - Webhook infrastructure for developers
|
|
5
5
|
Project-URL: Homepage, https://hooksniff.vercel.app
|
|
6
6
|
Project-URL: Repository, https://github.com/servetarslan02/hooksniff-python
|
|
@@ -28,13 +28,13 @@ Official Python SDK for [HookSniff](https://hooksniff.vercel.app) — the webhoo
|
|
|
28
28
|
## Installation
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
|
-
pip install hooksniff
|
|
31
|
+
pip install hooksniff-python
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
## Quick Start
|
|
35
35
|
|
|
36
36
|
```python
|
|
37
|
-
from
|
|
37
|
+
from hooksniff_python import HookSniff
|
|
38
38
|
|
|
39
39
|
hs = HookSniff("hr_live_...")
|
|
40
40
|
|
|
@@ -156,7 +156,7 @@ delivery = hs.webhook.replay("msg_123")
|
|
|
156
156
|
### Webhook Verification
|
|
157
157
|
|
|
158
158
|
```python
|
|
159
|
-
from
|
|
159
|
+
from hooksniff_python import Webhook, WebhookVerificationError
|
|
160
160
|
|
|
161
161
|
wh = Webhook("whsec_...")
|
|
162
162
|
|
|
@@ -173,7 +173,7 @@ def handle_webhook(request):
|
|
|
173
173
|
### Error Handling
|
|
174
174
|
|
|
175
175
|
```python
|
|
176
|
-
from
|
|
176
|
+
from hooksniff_python import AuthenticationError, NotFoundError, RateLimitError
|
|
177
177
|
|
|
178
178
|
try:
|
|
179
179
|
hs.endpoint.get("invalid_id")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
hooksniff/__init__.py,sha256=-umMsNLbD7dXy5F0lwRSdCGszw9DrsJUN9moD1puGug,917
|
|
2
|
+
hooksniff/client.py,sha256=D_h7IL68Zo24mpqwJ4G50wbDeknpgO7R15G1VnLfk9E,3446
|
|
3
|
+
hooksniff/exceptions.py,sha256=6gMV_z99GPo50eoQvTgJ4TMdKrijJsGdI6o6c2ZshdE,1857
|
|
4
|
+
hooksniff/http_client.py,sha256=PJjtnmbTLhP37dXmayn2notznqUr3J9LEMmJUa3akUc,5038
|
|
5
|
+
hooksniff/resources.py,sha256=qhj1IDkp2xkkdsuKZdlzpFfBhrOufHYtHsNe02zouvk,16270
|
|
6
|
+
hooksniff/webhook.py,sha256=fRiCwe7iO3VJCs5LMPuJqVg90ahiwP9x4Rfl8hX5uP4,2680
|
|
7
|
+
hooksniff_python-0.4.2.dist-info/METADATA,sha256=GKSqymJaLV3qqi5BhRf1hDIgYOMlqQg-GiHf9LRr5N0,6383
|
|
8
|
+
hooksniff_python-0.4.2.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
9
|
+
hooksniff_python-0.4.2.dist-info/licenses/LICENSE,sha256=vUMb56ZR5dltGS5hpFwKXc8P5mMh4E8S1zwf3MIVAZE,1066
|
|
10
|
+
hooksniff_python-0.4.2.dist-info/RECORD,,
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
hooksniff/__init__.py,sha256=-umMsNLbD7dXy5F0lwRSdCGszw9DrsJUN9moD1puGug,917
|
|
2
|
-
hooksniff/client.py,sha256=2fej_BEzzsMChLvpKZgu-yhuMXO_CfHEr6eUS1rATe8,3292
|
|
3
|
-
hooksniff/exceptions.py,sha256=6gMV_z99GPo50eoQvTgJ4TMdKrijJsGdI6o6c2ZshdE,1857
|
|
4
|
-
hooksniff/http_client.py,sha256=PJjtnmbTLhP37dXmayn2notznqUr3J9LEMmJUa3akUc,5038
|
|
5
|
-
hooksniff/resources.py,sha256=s72ROxldkvhqKvX8s7kiKkBymP_UXmAc1-HB1mEjGLU,14648
|
|
6
|
-
hooksniff/webhook.py,sha256=fRiCwe7iO3VJCs5LMPuJqVg90ahiwP9x4Rfl8hX5uP4,2680
|
|
7
|
-
hooksniff_python-0.4.1.dist-info/METADATA,sha256=1zSa9rZ6OgfcsvFCY8i3M_nyyPWBE82IGsVcd3-lojE,6355
|
|
8
|
-
hooksniff_python-0.4.1.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
9
|
-
hooksniff_python-0.4.1.dist-info/licenses/LICENSE,sha256=vUMb56ZR5dltGS5hpFwKXc8P5mMh4E8S1zwf3MIVAZE,1066
|
|
10
|
-
hooksniff_python-0.4.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|