pgns 0.1.4__tar.gz

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.
pgns-0.1.4/.gitignore ADDED
@@ -0,0 +1,450 @@
1
+ # File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig
2
+ # Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,macos,dotenv,go,node,python,rust
3
+ # Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,macos,dotenv,go,node,python,rust
4
+
5
+ ### dotenv ###
6
+ .env
7
+ .env.local
8
+
9
+ ### Go ###
10
+ # If you prefer the allow list template instead of the deny list, see community template:
11
+ # https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
12
+ #
13
+ # Binaries for programs and plugins
14
+ *.exe
15
+ *.exe~
16
+ *.dll
17
+ *.so
18
+ *.dylib
19
+
20
+ # Test binary, built with `go test -c`
21
+ *.test
22
+
23
+ # Output of the go coverage tool, specifically when used with LiteIDE
24
+ *.out
25
+
26
+ # Dependency directories (remove the comment below to include it)
27
+ # vendor/
28
+
29
+ # Go workspace file
30
+ go.work
31
+
32
+ ### macOS ###
33
+ # General
34
+ .DS_Store
35
+ .AppleDouble
36
+ .LSOverride
37
+
38
+ # Icon must end with two \r
39
+ Icon
40
+
41
+
42
+ # Thumbnails
43
+ ._*
44
+
45
+ # Files that might appear in the root of a volume
46
+ .DocumentRevisions-V100
47
+ .fseventsd
48
+ .Spotlight-V100
49
+ .TemporaryItems
50
+ .Trashes
51
+ .VolumeIcon.icns
52
+ .com.apple.timemachine.donotpresent
53
+
54
+ # Directories potentially created on remote AFP share
55
+ .AppleDB
56
+ .AppleDesktop
57
+ Network Trash Folder
58
+ Temporary Items
59
+ .apdisk
60
+
61
+ ### macOS Patch ###
62
+ # iCloud generated files
63
+ *.icloud
64
+
65
+ ### Node ###
66
+ # Logs
67
+ logs
68
+ *.log
69
+ npm-debug.log*
70
+ yarn-debug.log*
71
+ yarn-error.log*
72
+ lerna-debug.log*
73
+ .pnpm-debug.log*
74
+
75
+ # Diagnostic reports (https://nodejs.org/api/report.html)
76
+ report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
77
+
78
+ # Runtime data
79
+ pids
80
+ *.pid
81
+ *.seed
82
+ *.pid.lock
83
+
84
+ # Directory for instrumented libs generated by jscoverage/JSCover
85
+ lib-cov
86
+
87
+ # Coverage directory used by tools like istanbul
88
+ coverage
89
+ *.lcov
90
+
91
+ # nyc test coverage
92
+ .nyc_output
93
+
94
+ # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
95
+ .grunt
96
+
97
+ # Bower dependency directory (https://bower.io/)
98
+ bower_components
99
+
100
+ # node-waf configuration
101
+ .lock-wscript
102
+
103
+ # Compiled binary addons (https://nodejs.org/api/addons.html)
104
+ build/Release
105
+
106
+ # Dependency directories
107
+ node_modules/
108
+ jspm_packages/
109
+
110
+ # Snowpack dependency directory (https://snowpack.dev/)
111
+ web_modules/
112
+
113
+ # TypeScript cache
114
+ *.tsbuildinfo
115
+
116
+ # Optional npm cache directory
117
+ .npm
118
+
119
+ # Optional eslint cache
120
+ .eslintcache
121
+
122
+ # Optional stylelint cache
123
+ .stylelintcache
124
+
125
+ # Microbundle cache
126
+ .rpt2_cache/
127
+ .rts2_cache_cjs/
128
+ .rts2_cache_es/
129
+ .rts2_cache_umd/
130
+
131
+ # Optional REPL history
132
+ .node_repl_history
133
+
134
+ # Output of 'npm pack'
135
+ *.tgz
136
+
137
+ # Yarn Integrity file
138
+ .yarn-integrity
139
+
140
+ # dotenv environment variable files
141
+ .env.development.local
142
+ .env.test.local
143
+ .env.production.local
144
+ .env.local
145
+
146
+ # parcel-bundler cache (https://parceljs.org/)
147
+ .cache
148
+ .parcel-cache
149
+
150
+ # Next.js build output
151
+ .next
152
+ out
153
+
154
+ # Nuxt.js build / generate output
155
+ .nuxt
156
+ dist
157
+
158
+ # Gatsby files
159
+ .cache/
160
+ # Comment in the public line in if your project uses Gatsby and not Next.js
161
+ # https://nextjs.org/blog/next-9-1#public-directory-support
162
+ # public
163
+
164
+ # vuepress build output
165
+ .vuepress/dist
166
+
167
+ # vuepress v2.x temp and cache directory
168
+ .temp
169
+
170
+ # Docusaurus cache and generated files
171
+ .docusaurus
172
+
173
+ # Serverless directories
174
+ .serverless/
175
+
176
+ # FuseBox cache
177
+ .fusebox/
178
+
179
+ # DynamoDB Local files
180
+ .dynamodb/
181
+
182
+ # TernJS port file
183
+ .tern-port
184
+
185
+ # Stores VSCode versions used for testing VSCode extensions
186
+ .vscode-test
187
+
188
+ # yarn v2
189
+ .yarn/cache
190
+ .yarn/unplugged
191
+ .yarn/build-state.yml
192
+ .yarn/install-state.gz
193
+ .pnp.*
194
+
195
+ ### Node Patch ###
196
+ # Serverless Webpack directories
197
+ .webpack/
198
+
199
+ # Optional stylelint cache
200
+
201
+ # SvelteKit build / generate output
202
+ .svelte-kit
203
+
204
+ ### Python ###
205
+ # Byte-compiled / optimized / DLL files
206
+ __pycache__/
207
+ *.py[cod]
208
+ *$py.class
209
+
210
+ # C extensions
211
+
212
+ # Distribution / packaging
213
+ .Python
214
+ # Note: build/ is NOT ignored - it contains Bazel macros (build/*.bzl)
215
+ # Python build artifacts go in dist/ instead
216
+ develop-eggs/
217
+ dist/
218
+ downloads/
219
+ eggs/
220
+ .eggs/
221
+ lib/
222
+ lib64/
223
+ parts/
224
+ sdist/
225
+ var/
226
+ wheels/
227
+ share/python-wheels/
228
+ *.egg-info/
229
+ .installed.cfg
230
+ *.egg
231
+ MANIFEST
232
+
233
+ # PyInstaller
234
+ # Usually these files are written by a python script from a template
235
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
236
+ *.manifest
237
+ *.spec
238
+
239
+ # Installer logs
240
+ pip-log.txt
241
+ pip-delete-this-directory.txt
242
+
243
+ # Unit test / coverage reports
244
+ htmlcov/
245
+ .tox/
246
+ .nox/
247
+ .coverage
248
+ .coverage.*
249
+ nosetests.xml
250
+ coverage.xml
251
+ *.cover
252
+ *.py,cover
253
+ .hypothesis/
254
+ .pytest_cache/
255
+ cover/
256
+
257
+ # Translations
258
+ *.mo
259
+ *.pot
260
+
261
+ # Django stuff:
262
+ local_settings.py
263
+ db.sqlite3
264
+ db.sqlite3-journal
265
+
266
+ # Flask stuff:
267
+ instance/
268
+ .webassets-cache
269
+
270
+ # Scrapy stuff:
271
+ .scrapy
272
+
273
+ # Sphinx documentation
274
+ docs/_build/
275
+
276
+ # PyBuilder
277
+ .pybuilder/
278
+ target/
279
+
280
+ # Jupyter Notebook
281
+ .ipynb_checkpoints
282
+
283
+ # IPython
284
+ profile_default/
285
+ ipython_config.py
286
+
287
+ # pyenv
288
+ # For a library or package, you might want to ignore these files since the code is
289
+ # intended to run in multiple environments; otherwise, check them in:
290
+ # .python-version
291
+
292
+ # pipenv
293
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
294
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
295
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
296
+ # install all needed dependencies.
297
+ #Pipfile.lock
298
+
299
+ # poetry
300
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
301
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
302
+ # commonly ignored for libraries.
303
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
304
+ #poetry.lock
305
+
306
+ # pdm
307
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
308
+ #pdm.lock
309
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
310
+ # in version control.
311
+ # https://pdm.fming.dev/#use-with-ide
312
+ .pdm.toml
313
+
314
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
315
+ __pypackages__/
316
+
317
+ # Celery stuff
318
+ celerybeat-schedule
319
+ celerybeat.pid
320
+
321
+ # SageMath parsed files
322
+ *.sage.py
323
+
324
+ # Environments
325
+ .venv
326
+ env/
327
+ venv/
328
+ ENV/
329
+ env.bak/
330
+ venv.bak/
331
+
332
+ # Spyder project settings
333
+ .spyderproject
334
+ .spyproject
335
+
336
+ # Rope project settings
337
+ .ropeproject
338
+
339
+ # mkdocs documentation
340
+ /site
341
+
342
+ # mypy
343
+ .mypy_cache/
344
+ .dmypy.json
345
+ dmypy.json
346
+
347
+ # Pyre type checker
348
+ .pyre/
349
+
350
+ # pytype static type analyzer
351
+ .pytype/
352
+
353
+ # Cython debug symbols
354
+ cython_debug/
355
+
356
+ # PyCharm
357
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
358
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
359
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
360
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
361
+ #.idea/
362
+
363
+ ### Python Patch ###
364
+ # Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
365
+ poetry.toml
366
+
367
+ # ruff
368
+ .ruff_cache/
369
+
370
+ # LSP config files
371
+ pyrightconfig.json
372
+
373
+ ### Rust ###
374
+ # Generated by Cargo
375
+ # will have compiled files and executables
376
+ debug/
377
+
378
+ # Cargo.lock is committed because this workspace contains binaries (server, cli)
379
+ # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
380
+ # Cargo.lock
381
+
382
+ # These are backup files generated by rustfmt
383
+ **/*.rs.bk
384
+
385
+ # MSVC Windows builds of rustc generate these, which store debugging information
386
+ *.pdb
387
+
388
+ ### VisualStudioCode ###
389
+ .vscode/*
390
+ !.vscode/settings.json
391
+ !.vscode/tasks.json
392
+ !.vscode/launch.json
393
+ !.vscode/extensions.json
394
+ !.vscode/*.code-snippets
395
+
396
+ # Local History for Visual Studio Code
397
+ .history/
398
+
399
+ # Built Visual Studio Code Extensions
400
+ *.vsix
401
+
402
+ ### VisualStudioCode Patch ###
403
+ # Ignore all local history of files
404
+ .history
405
+ .ionide
406
+
407
+ # End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,macos,dotenv,go,node,python,rust
408
+
409
+ # Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
410
+
411
+ # Bazel
412
+ /bazel-*
413
+ /.ijwb/
414
+ /.aswb/
415
+ /.clwb/
416
+ .bazelrc.user
417
+
418
+ !/build/
419
+ !/**/lib/
420
+
421
+ # Project-local binaries (sqlx-cli, etc.)
422
+ .local/
423
+
424
+ # Pulumi
425
+ .pulumi/
426
+
427
+ # env
428
+ .env.*
429
+ !.env.*.example
430
+ !.env.development
431
+
432
+ # Beads
433
+ .beads/dolt/
434
+ .beads/.jsonl.lock
435
+ .beads/dolt-access.lock
436
+
437
+ # Legal
438
+ docs/corp/
439
+
440
+ # Playwright
441
+ .playwright-cli/*.yml
442
+ .playwright-cli/*.png
443
+
444
+ # Lefthook
445
+ lefthook-local.yml
446
+
447
+ # MaxMind GeoIP databases (licensed, not committed)
448
+ data/*.mmdb
449
+ data/*.csv
450
+ data/GeoLite2-*
pgns-0.1.4/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 PGNS LLC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
pgns-0.1.4/PKG-INFO ADDED
@@ -0,0 +1,68 @@
1
+ Metadata-Version: 2.4
2
+ Name: pgns
3
+ Version: 0.1.4
4
+ Summary: Python SDK for the pgns webhook relay API
5
+ Project-URL: Homepage, https://pgns.io
6
+ Project-URL: Documentation, https://docs.pgns.io/sdks/python
7
+ Project-URL: Repository, https://github.com/pgns-io/sdk-python
8
+ Author: pgns
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: api-client,pgns,sdk,webhooks
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: >=3.10
22
+ Requires-Dist: httpx>=0.27
23
+ Requires-Dist: pydantic>=2.0
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
26
+ Requires-Dist: pytest>=8.0; extra == 'dev'
27
+ Description-Content-Type: text/markdown
28
+
29
+ # pgns Python SDK
30
+
31
+ Python client library for the [pgns](https://pgns.io) webhook relay API.
32
+
33
+ ## Installation
34
+
35
+ ```bash
36
+ pip install pgns
37
+ ```
38
+
39
+ ## Quick Start
40
+
41
+ ```python
42
+ from pgns import PgnsClient
43
+
44
+ client = PgnsClient(api_key="your-api-key")
45
+
46
+ # List roosts
47
+ roosts = client.roosts.list()
48
+
49
+ # Send a pigeon
50
+ client.pigeons.send("rst_abc123", payload={"event": "user.created", "data": {"id": 1}})
51
+ ```
52
+
53
+ ## Async Usage
54
+
55
+ ```python
56
+ from pgns import AsyncPgnsClient
57
+
58
+ async with AsyncPgnsClient(api_key="your-api-key") as client:
59
+ roosts = await client.roosts.list()
60
+ ```
61
+
62
+ ## Documentation
63
+
64
+ Full documentation is available at [docs.pgns.io/sdks/python](https://docs.pgns.io/sdks/python).
65
+
66
+ ## License
67
+
68
+ MIT
pgns-0.1.4/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # pgns Python SDK
2
+
3
+ Python client library for the [pgns](https://pgns.io) webhook relay API.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install pgns
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```python
14
+ from pgns import PgnsClient
15
+
16
+ client = PgnsClient(api_key="your-api-key")
17
+
18
+ # List roosts
19
+ roosts = client.roosts.list()
20
+
21
+ # Send a pigeon
22
+ client.pigeons.send("rst_abc123", payload={"event": "user.created", "data": {"id": 1}})
23
+ ```
24
+
25
+ ## Async Usage
26
+
27
+ ```python
28
+ from pgns import AsyncPgnsClient
29
+
30
+ async with AsyncPgnsClient(api_key="your-api-key") as client:
31
+ roosts = await client.roosts.list()
32
+ ```
33
+
34
+ ## Documentation
35
+
36
+ Full documentation is available at [docs.pgns.io/sdks/python](https://docs.pgns.io/sdks/python).
37
+
38
+ ## License
39
+
40
+ MIT
@@ -0,0 +1,105 @@
1
+ """pgns SDK — Python client for the pgns webhook relay API."""
2
+
3
+ from pgns.sdk._version import __version__
4
+ from pgns.sdk.async_client import AsyncPigeonsClient
5
+ from pgns.sdk.client import PigeonsClient
6
+ from pgns.sdk.errors import PigeonsAuthError, PigeonsError
7
+ from pgns.sdk.events import async_event_stream, event_stream
8
+ from pgns.sdk.models import (
9
+ ApiKeyCreatedResponse,
10
+ ApiKeyResponse,
11
+ AuthTokens,
12
+ BillingLimits,
13
+ BillingStatus,
14
+ CheckoutRequest,
15
+ CheckoutResponse,
16
+ CreateApiKeyRequest,
17
+ CreateDestination,
18
+ CreateRoost,
19
+ CreateTemplate,
20
+ DashboardStats,
21
+ DeliveryAttempt,
22
+ DeliveryStatus,
23
+ Destination,
24
+ DestinationType,
25
+ LoginRequest,
26
+ MagicLinkRequest,
27
+ MagicLinkResponse,
28
+ MagicLinkVerifyRequest,
29
+ PaginatedDeliveryAttempts,
30
+ PaginatedPigeons,
31
+ PauseResponse,
32
+ Pigeon,
33
+ PortalRequest,
34
+ PortalResponse,
35
+ PreviewTemplateRequest,
36
+ PreviewTemplateResponse,
37
+ ReplayResponse,
38
+ Roost,
39
+ SignupRequest,
40
+ Template,
41
+ UpdateApiKeyRequest,
42
+ UpdateProfileRequest,
43
+ UpdateRoost,
44
+ UpdateTemplate,
45
+ User,
46
+ )
47
+
48
+ __all__ = [
49
+ "__version__",
50
+ # Clients
51
+ "PigeonsClient",
52
+ "AsyncPigeonsClient",
53
+ # Errors
54
+ "PigeonsError",
55
+ "PigeonsAuthError",
56
+ # Events
57
+ "event_stream",
58
+ "async_event_stream",
59
+ # Enums
60
+ "DestinationType",
61
+ "DeliveryStatus",
62
+ # Auth
63
+ "AuthTokens",
64
+ "SignupRequest",
65
+ "LoginRequest",
66
+ "MagicLinkRequest",
67
+ "MagicLinkVerifyRequest",
68
+ "MagicLinkResponse",
69
+ # Domain models
70
+ "User",
71
+ "Roost",
72
+ "Pigeon",
73
+ "Destination",
74
+ "DeliveryAttempt",
75
+ # API Keys
76
+ "ApiKeyResponse",
77
+ "ApiKeyCreatedResponse",
78
+ # Mutations
79
+ "CreateRoost",
80
+ "UpdateRoost",
81
+ "CreateDestination",
82
+ "UpdateProfileRequest",
83
+ "CreateApiKeyRequest",
84
+ "UpdateApiKeyRequest",
85
+ # Responses
86
+ "ReplayResponse",
87
+ "DashboardStats",
88
+ "PauseResponse",
89
+ # Pagination
90
+ "PaginatedPigeons",
91
+ "PaginatedDeliveryAttempts",
92
+ # Templates
93
+ "Template",
94
+ "CreateTemplate",
95
+ "UpdateTemplate",
96
+ "PreviewTemplateRequest",
97
+ "PreviewTemplateResponse",
98
+ # Billing
99
+ "BillingLimits",
100
+ "BillingStatus",
101
+ "CheckoutRequest",
102
+ "CheckoutResponse",
103
+ "PortalRequest",
104
+ "PortalResponse",
105
+ ]
@@ -0,0 +1,32 @@
1
+ """Shared helpers for sync and async clients."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+
7
+ import httpx
8
+
9
+ from pgns.sdk.errors import PigeonsError
10
+
11
+
12
+ def _auth_headers(api_key: str | None, access_token: str | None) -> dict[str, str]:
13
+ """Build the Authorization header dict."""
14
+ if api_key:
15
+ return {"Authorization": f"Bearer {api_key}"}
16
+ if access_token:
17
+ return {"Authorization": f"Bearer {access_token}"}
18
+ return {}
19
+
20
+
21
+ def _handle_response(response: httpx.Response) -> Any:
22
+ """Parse an httpx response, raising PigeonsError on non-2xx."""
23
+ if response.status_code == 204:
24
+ return None
25
+ if not response.is_success:
26
+ try:
27
+ body = response.json()
28
+ message = body.get("error", response.reason_phrase or "Unknown error")
29
+ except Exception:
30
+ message = response.reason_phrase or "Unknown error"
31
+ raise PigeonsError(message, response.status_code)
32
+ return response.json()
@@ -0,0 +1,3 @@
1
+ """Version of the pgns SDK."""
2
+
3
+ __version__ = "0.1.4"