pinbridge-sdk 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.
- pinbridge_sdk-0.1.4/.coveragerc +14 -0
- pinbridge_sdk-0.1.4/.github/workflows/ci.yml +43 -0
- pinbridge_sdk-0.1.4/.github/workflows/publish.yml +89 -0
- pinbridge_sdk-0.1.4/.gitignore +207 -0
- pinbridge_sdk-0.1.4/LICENSE +21 -0
- pinbridge_sdk-0.1.4/PKG-INFO +324 -0
- pinbridge_sdk-0.1.4/README.md +270 -0
- pinbridge_sdk-0.1.4/RELEASING.md +43 -0
- pinbridge_sdk-0.1.4/pyproject.toml +58 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/__init__.py +27 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/_client_base.py +69 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/_types.py +11 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/async_client.py +150 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/client.py +175 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/errors.py +94 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/models/__init__.py +92 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/models/api_keys.py +32 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/models/auth.py +79 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/models/base.py +11 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/models/billing.py +63 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/models/common.py +54 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/models/pins.py +49 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/models/pinterest.py +44 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/models/schedules.py +33 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/models/system.py +35 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/models/webhooks.py +48 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/py.typed +0 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/resources/__init__.py +38 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/resources/api_keys.py +76 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/resources/auth.py +92 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/resources/base.py +109 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/resources/billing.py +79 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/resources/pins.py +66 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/resources/pinterest.py +138 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/resources/schedules.py +80 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/resources/system.py +48 -0
- pinbridge_sdk-0.1.4/src/pinbridge_sdk/resources/webhooks.py +104 -0
- pinbridge_sdk-0.1.4/tests/_payloads.py +221 -0
- pinbridge_sdk-0.1.4/tests/conftest.py +11 -0
- pinbridge_sdk-0.1.4/tests/test_client_async.py +26 -0
- pinbridge_sdk-0.1.4/tests/test_client_async_extended.py +35 -0
- pinbridge_sdk-0.1.4/tests/test_client_core.py +94 -0
- pinbridge_sdk-0.1.4/tests/test_client_sync.py +119 -0
- pinbridge_sdk-0.1.4/tests/test_errors.py +57 -0
- pinbridge_sdk-0.1.4/tests/test_resources_async.py +277 -0
- pinbridge_sdk-0.1.4/tests/test_resources_sync.py +343 -0
- pinbridge_sdk-0.1.4/tests/test_version_sync.py +16 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches:
|
|
7
|
+
- main
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
fail-fast: false
|
|
14
|
+
matrix:
|
|
15
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Set up Python
|
|
21
|
+
uses: actions/setup-python@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: ${{ matrix.python-version }}
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: |
|
|
27
|
+
python -m pip install --upgrade pip
|
|
28
|
+
pip install -e .[dev]
|
|
29
|
+
pip install build twine
|
|
30
|
+
|
|
31
|
+
- name: Lint
|
|
32
|
+
run: |
|
|
33
|
+
ruff check .
|
|
34
|
+
black --check .
|
|
35
|
+
|
|
36
|
+
- name: Test with coverage
|
|
37
|
+
run: pytest --cov=pinbridge_sdk --cov-config=.coveragerc --cov-report=xml --cov-report=term-missing
|
|
38
|
+
|
|
39
|
+
- name: Build package
|
|
40
|
+
run: python -m build
|
|
41
|
+
|
|
42
|
+
- name: Validate package metadata
|
|
43
|
+
run: twine check dist/*
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
inputs:
|
|
9
|
+
version:
|
|
10
|
+
description: "Version to publish (e.g. 0.1.0). Must match pyproject version."
|
|
11
|
+
required: true
|
|
12
|
+
type: string
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
build:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Set up Python
|
|
21
|
+
uses: actions/setup-python@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: "3.12"
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: |
|
|
27
|
+
python -m pip install --upgrade pip
|
|
28
|
+
pip install -e .[dev]
|
|
29
|
+
pip install build twine
|
|
30
|
+
|
|
31
|
+
- name: Lint
|
|
32
|
+
run: |
|
|
33
|
+
ruff check .
|
|
34
|
+
black --check .
|
|
35
|
+
|
|
36
|
+
- name: Test with coverage
|
|
37
|
+
run: pytest --cov=pinbridge_sdk --cov-config=.coveragerc --cov-report=xml --cov-report=term-missing
|
|
38
|
+
|
|
39
|
+
- name: Build distributions
|
|
40
|
+
run: python -m build
|
|
41
|
+
|
|
42
|
+
- name: Check distributions
|
|
43
|
+
run: twine check dist/*
|
|
44
|
+
|
|
45
|
+
- name: Upload dist artifact
|
|
46
|
+
uses: actions/upload-artifact@v4
|
|
47
|
+
with:
|
|
48
|
+
name: dist
|
|
49
|
+
path: dist/
|
|
50
|
+
|
|
51
|
+
- name: Verify version matches pyproject on tag push
|
|
52
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
53
|
+
run: |
|
|
54
|
+
TAG_VERSION="${GITHUB_REF_NAME#v}"
|
|
55
|
+
PYPROJECT_VERSION="$(python -c "import pathlib,tomllib;print(tomllib.loads(pathlib.Path('pyproject.toml').read_text())['project']['version'])")"
|
|
56
|
+
if [ "$TAG_VERSION" != "$PYPROJECT_VERSION" ]; then
|
|
57
|
+
echo "Tag version ($TAG_VERSION) does not match pyproject version ($PYPROJECT_VERSION)."
|
|
58
|
+
exit 1
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
- name: Verify manual version matches pyproject
|
|
62
|
+
if: github.event_name == 'workflow_dispatch'
|
|
63
|
+
run: |
|
|
64
|
+
INPUT_VERSION="${{ github.event.inputs.version }}"
|
|
65
|
+
PYPROJECT_VERSION="$(python -c "import pathlib,tomllib;print(tomllib.loads(pathlib.Path('pyproject.toml').read_text())['project']['version'])")"
|
|
66
|
+
if [ "$INPUT_VERSION" != "$PYPROJECT_VERSION" ]; then
|
|
67
|
+
echo "Manual version input ($INPUT_VERSION) does not match pyproject version ($PYPROJECT_VERSION)."
|
|
68
|
+
exit 1
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
publish:
|
|
72
|
+
needs: build
|
|
73
|
+
runs-on: ubuntu-latest
|
|
74
|
+
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
|
|
75
|
+
permissions:
|
|
76
|
+
id-token: write
|
|
77
|
+
contents: read
|
|
78
|
+
environment:
|
|
79
|
+
name: pypi
|
|
80
|
+
url: https://pypi.org/p/pinbridge-sdk
|
|
81
|
+
steps:
|
|
82
|
+
- name: Download dist artifact
|
|
83
|
+
uses: actions/download-artifact@v4
|
|
84
|
+
with:
|
|
85
|
+
name: dist
|
|
86
|
+
path: dist/
|
|
87
|
+
|
|
88
|
+
- name: Publish to PyPI
|
|
89
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
#poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
#pdm.lock
|
|
116
|
+
#pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
#pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# SageMath parsed files
|
|
135
|
+
*.sage.py
|
|
136
|
+
|
|
137
|
+
# Environments
|
|
138
|
+
.env
|
|
139
|
+
.envrc
|
|
140
|
+
.venv
|
|
141
|
+
env/
|
|
142
|
+
venv/
|
|
143
|
+
ENV/
|
|
144
|
+
env.bak/
|
|
145
|
+
venv.bak/
|
|
146
|
+
|
|
147
|
+
# Spyder project settings
|
|
148
|
+
.spyderproject
|
|
149
|
+
.spyproject
|
|
150
|
+
|
|
151
|
+
# Rope project settings
|
|
152
|
+
.ropeproject
|
|
153
|
+
|
|
154
|
+
# mkdocs documentation
|
|
155
|
+
/site
|
|
156
|
+
|
|
157
|
+
# mypy
|
|
158
|
+
.mypy_cache/
|
|
159
|
+
.dmypy.json
|
|
160
|
+
dmypy.json
|
|
161
|
+
|
|
162
|
+
# Pyre type checker
|
|
163
|
+
.pyre/
|
|
164
|
+
|
|
165
|
+
# pytype static type analyzer
|
|
166
|
+
.pytype/
|
|
167
|
+
|
|
168
|
+
# Cython debug symbols
|
|
169
|
+
cython_debug/
|
|
170
|
+
|
|
171
|
+
# PyCharm
|
|
172
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
173
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
174
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
175
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
176
|
+
#.idea/
|
|
177
|
+
|
|
178
|
+
# Abstra
|
|
179
|
+
# Abstra is an AI-powered process automation framework.
|
|
180
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
181
|
+
# Learn more at https://abstra.io/docs
|
|
182
|
+
.abstra/
|
|
183
|
+
|
|
184
|
+
# Visual Studio Code
|
|
185
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
186
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
188
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
189
|
+
# .vscode/
|
|
190
|
+
|
|
191
|
+
# Ruff stuff:
|
|
192
|
+
.ruff_cache/
|
|
193
|
+
|
|
194
|
+
# PyPI configuration file
|
|
195
|
+
.pypirc
|
|
196
|
+
|
|
197
|
+
# Cursor
|
|
198
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
199
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
200
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
201
|
+
.cursorignore
|
|
202
|
+
.cursorindexingignore
|
|
203
|
+
|
|
204
|
+
# Marimo
|
|
205
|
+
marimo/_static/
|
|
206
|
+
marimo/_lsp/
|
|
207
|
+
__marimo__/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 pinbridge
|
|
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.
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pinbridge-sdk
|
|
3
|
+
Version: 0.1.4
|
|
4
|
+
Summary: Official Python SDK for the PinBridge API
|
|
5
|
+
Project-URL: Homepage, https://pinbridge.io
|
|
6
|
+
Project-URL: Documentation, https://docs.pinbridge.io
|
|
7
|
+
Project-URL: Repository, https://github.com/pinbridge/python-sdk
|
|
8
|
+
Project-URL: Issues, https://github.com/pinbridge/python-sdk/issues
|
|
9
|
+
Author: PinBridge
|
|
10
|
+
License: MIT License
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2026 pinbridge
|
|
13
|
+
|
|
14
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
16
|
+
in the Software without restriction, including without limitation the rights
|
|
17
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
18
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
19
|
+
furnished to do so, subject to the following conditions:
|
|
20
|
+
|
|
21
|
+
The above copyright notice and this permission notice shall be included in all
|
|
22
|
+
copies or substantial portions of the Software.
|
|
23
|
+
|
|
24
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
26
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
27
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
28
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
29
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
30
|
+
SOFTWARE.
|
|
31
|
+
License-File: LICENSE
|
|
32
|
+
Keywords: api,pinbridge,pinterest,sdk
|
|
33
|
+
Classifier: Development Status :: 3 - Alpha
|
|
34
|
+
Classifier: Intended Audience :: Developers
|
|
35
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
36
|
+
Classifier: Programming Language :: Python :: 3
|
|
37
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
41
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
42
|
+
Requires-Python: >=3.10
|
|
43
|
+
Requires-Dist: httpx<1,>=0.27.0
|
|
44
|
+
Requires-Dist: pydantic<3,>=2.6.0
|
|
45
|
+
Provides-Extra: dev
|
|
46
|
+
Requires-Dist: black<25,>=24.0.0; extra == 'dev'
|
|
47
|
+
Requires-Dist: coverage[toml]<8,>=7.0.0; extra == 'dev'
|
|
48
|
+
Requires-Dist: pytest-asyncio<1,>=0.23.0; extra == 'dev'
|
|
49
|
+
Requires-Dist: pytest-cov<6,>=5.0.0; extra == 'dev'
|
|
50
|
+
Requires-Dist: pytest<9,>=8.0.0; extra == 'dev'
|
|
51
|
+
Requires-Dist: ruff<1,>=0.5.0; extra == 'dev'
|
|
52
|
+
Requires-Dist: tomli<3,>=2.0.0; (python_version < '3.11') and extra == 'dev'
|
|
53
|
+
Description-Content-Type: text/markdown
|
|
54
|
+
|
|
55
|
+
# PinBridge Python SDK
|
|
56
|
+
|
|
57
|
+
Official Python SDK for the PinBridge API.
|
|
58
|
+
|
|
59
|
+
## Installation
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install pinbridge-sdk
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
For local development from this monorepo:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pip install -e .[dev]
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Requirements
|
|
72
|
+
|
|
73
|
+
- Python `>=3.10`
|
|
74
|
+
- PinBridge API URL (default: `https://api.pinbridge.io`)
|
|
75
|
+
- Authentication via API key and/or bearer token
|
|
76
|
+
|
|
77
|
+
## Client Initialization
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
from pinbridge_sdk import PinbridgeClient
|
|
81
|
+
|
|
82
|
+
client = PinbridgeClient(
|
|
83
|
+
base_url="https://api.pinbridge.io", # optional
|
|
84
|
+
api_key="pb_live_...", # optional
|
|
85
|
+
bearer_token=None, # optional
|
|
86
|
+
timeout=30.0, # optional
|
|
87
|
+
headers={"x-request-source": "my-app"},
|
|
88
|
+
)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Use as a context manager to close internal HTTP resources automatically:
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
with PinbridgeClient(api_key="pb_live_...") as client:
|
|
95
|
+
print(client.system.health().status)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Authentication Patterns
|
|
99
|
+
|
|
100
|
+
### 1. API key auth
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
from pinbridge_sdk import PinbridgeClient
|
|
104
|
+
|
|
105
|
+
with PinbridgeClient(api_key="pb_live_...") as client:
|
|
106
|
+
keys = client.api_keys.list()
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### 2. Login to bearer token
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
from pinbridge_sdk import PinbridgeClient
|
|
113
|
+
from pinbridge_sdk.models import LoginRequest
|
|
114
|
+
|
|
115
|
+
with PinbridgeClient() as client:
|
|
116
|
+
auth = client.auth.login(LoginRequest(email="you@example.com", password="super-secret"))
|
|
117
|
+
client.set_bearer_token(auth.access_token)
|
|
118
|
+
print(client.auth.me().workspace.name)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 3. Switching auth at runtime
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
client.set_api_key("pb_live_new")
|
|
125
|
+
client.set_bearer_token("new-jwt")
|
|
126
|
+
client.clear_auth() # removes both
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Async Client
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
from pinbridge_sdk import AsyncPinbridgeClient
|
|
133
|
+
|
|
134
|
+
async def run() -> None:
|
|
135
|
+
async with AsyncPinbridgeClient(api_key="pb_live_...") as client:
|
|
136
|
+
pricing = await client.billing.pricing()
|
|
137
|
+
print(pricing.source)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Resource Guide
|
|
141
|
+
|
|
142
|
+
All sync resources are available on `PinbridgeClient`; async equivalents have identical names on `AsyncPinbridgeClient`.
|
|
143
|
+
|
|
144
|
+
### System (`client.system`)
|
|
145
|
+
|
|
146
|
+
- `root()`
|
|
147
|
+
- `health()`
|
|
148
|
+
- `stripe_webhook(body, stripe_signature=...)`
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
health = client.system.health()
|
|
152
|
+
print(health.status, health.database)
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Auth (`client.auth`)
|
|
156
|
+
|
|
157
|
+
- `register(RegisterRequest | dict)`
|
|
158
|
+
- `login(LoginRequest | dict)`
|
|
159
|
+
- `me()`
|
|
160
|
+
- `get_profile()`
|
|
161
|
+
- `update_profile(ProfileUpdateRequest | dict)`
|
|
162
|
+
|
|
163
|
+
### API Keys (`client.api_keys`)
|
|
164
|
+
|
|
165
|
+
- `create(APIKeyCreate | dict)`
|
|
166
|
+
- `list()`
|
|
167
|
+
- `update(key_id, APIKeyUpdate | dict)`
|
|
168
|
+
- `revoke(key_id)`
|
|
169
|
+
|
|
170
|
+
### Pinterest (`client.pinterest`)
|
|
171
|
+
|
|
172
|
+
- `start_oauth()`
|
|
173
|
+
- `oauth_callback(code=..., state=..., follow_redirects=False)`
|
|
174
|
+
- `list_accounts()`
|
|
175
|
+
- `revoke_account(account_id)`
|
|
176
|
+
- `list_boards(account_id)`
|
|
177
|
+
- `create_board(BoardCreateRequest | dict)`
|
|
178
|
+
- `delete_board(board_id, account_id=...)`
|
|
179
|
+
|
|
180
|
+
```python
|
|
181
|
+
from pinbridge_sdk.models import BoardCreateRequest
|
|
182
|
+
|
|
183
|
+
accounts = client.pinterest.list_accounts()
|
|
184
|
+
boards = client.pinterest.list_boards(accounts[0].id)
|
|
185
|
+
created = client.pinterest.create_board(
|
|
186
|
+
BoardCreateRequest(account_id=accounts[0].id, name="SDK Board")
|
|
187
|
+
)
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Pins and Jobs (`client.pins`, `client.jobs`)
|
|
191
|
+
|
|
192
|
+
- `client.pins.create(PinCreate | dict)`
|
|
193
|
+
- `client.pins.get(pin_id)`
|
|
194
|
+
- `client.pins.list(limit=50, offset=0)`
|
|
195
|
+
- `client.pins.delete(pin_id)`
|
|
196
|
+
- `client.jobs.get(job_id)`
|
|
197
|
+
|
|
198
|
+
```python
|
|
199
|
+
from pinbridge_sdk.models import PinCreate
|
|
200
|
+
|
|
201
|
+
pin = client.pins.create(
|
|
202
|
+
PinCreate(
|
|
203
|
+
account_id="...",
|
|
204
|
+
board_id="...",
|
|
205
|
+
title="Hello",
|
|
206
|
+
description="From SDK",
|
|
207
|
+
image_url="https://example.com/image.jpg",
|
|
208
|
+
idempotency_key="my-idempotency-key",
|
|
209
|
+
)
|
|
210
|
+
)
|
|
211
|
+
status = client.jobs.get(pin.id)
|
|
212
|
+
print(status.status)
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Schedules (`client.schedules`)
|
|
216
|
+
|
|
217
|
+
- `create(ScheduleCreate | dict)`
|
|
218
|
+
- `get(schedule_id)`
|
|
219
|
+
- `list(limit=50, offset=0)`
|
|
220
|
+
- `cancel(schedule_id)`
|
|
221
|
+
|
|
222
|
+
### Webhooks (`client.webhooks`)
|
|
223
|
+
|
|
224
|
+
- `create(WebhookCreate | dict)`
|
|
225
|
+
- `list()`
|
|
226
|
+
- `get(webhook_id)`
|
|
227
|
+
- `update(webhook_id, WebhookUpdate | dict)`
|
|
228
|
+
- `delete(webhook_id)`
|
|
229
|
+
|
|
230
|
+
### Billing and Rate Meter (`client.billing`, `client.rate_meter`)
|
|
231
|
+
|
|
232
|
+
- `client.billing.pricing()`
|
|
233
|
+
- `client.billing.checkout(CheckoutRequest | dict)`
|
|
234
|
+
- `client.billing.portal()`
|
|
235
|
+
- `client.billing.status()`
|
|
236
|
+
- `client.rate_meter.get(account_id)`
|
|
237
|
+
|
|
238
|
+
## Typed Models
|
|
239
|
+
|
|
240
|
+
All methods return typed Pydantic models from `pinbridge_sdk.models`.
|
|
241
|
+
|
|
242
|
+
Use either model instances or plain dictionaries as method input.
|
|
243
|
+
|
|
244
|
+
```python
|
|
245
|
+
from pinbridge_sdk.models import WebhookCreate
|
|
246
|
+
|
|
247
|
+
created = client.webhooks.create(
|
|
248
|
+
WebhookCreate(
|
|
249
|
+
url="https://example.com/hook",
|
|
250
|
+
secret="0123456789012345",
|
|
251
|
+
events=["pin.published", "pin.failed"],
|
|
252
|
+
)
|
|
253
|
+
)
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## Error Handling
|
|
257
|
+
|
|
258
|
+
Raised exceptions:
|
|
259
|
+
|
|
260
|
+
- `pinbridge_sdk.AuthenticationError`
|
|
261
|
+
- `pinbridge_sdk.NotFoundError`
|
|
262
|
+
- `pinbridge_sdk.ValidationError`
|
|
263
|
+
- `pinbridge_sdk.RateLimitError`
|
|
264
|
+
- `pinbridge_sdk.APIError`
|
|
265
|
+
|
|
266
|
+
```python
|
|
267
|
+
from pinbridge_sdk import APIError, PinbridgeClient
|
|
268
|
+
|
|
269
|
+
try:
|
|
270
|
+
with PinbridgeClient(api_key="bad") as client:
|
|
271
|
+
client.auth.me()
|
|
272
|
+
except APIError as exc:
|
|
273
|
+
print(exc.status_code, exc.message, exc.code)
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Extending the SDK
|
|
277
|
+
|
|
278
|
+
You can register custom resources without changing core classes.
|
|
279
|
+
|
|
280
|
+
```python
|
|
281
|
+
from pinbridge_sdk import PinbridgeClient
|
|
282
|
+
from pinbridge_sdk.resources.base import SyncAPIResource
|
|
283
|
+
|
|
284
|
+
class DiagnosticsResource(SyncAPIResource):
|
|
285
|
+
def ping(self):
|
|
286
|
+
return self._request("GET", "/healthz").json()
|
|
287
|
+
|
|
288
|
+
with PinbridgeClient(api_key="pb_live_...") as client:
|
|
289
|
+
client.register_resource("diagnostics", DiagnosticsResource)
|
|
290
|
+
print(client.diagnostics.ping())
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
This keeps new API groups low-risk: add models + resource class and register/bind it.
|
|
294
|
+
|
|
295
|
+
## Testing, Formatting, Coverage
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
black .
|
|
299
|
+
ruff check .
|
|
300
|
+
pytest --cov=pinbridge_sdk --cov-config=.coveragerc --cov-report=term-missing --cov-report=xml
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
Coverage config file: `.coveragerc`
|
|
304
|
+
|
|
305
|
+
## CI
|
|
306
|
+
|
|
307
|
+
GitHub Actions CI runs on push to `main` and on pull requests.
|
|
308
|
+
|
|
309
|
+
- Lint: `ruff check .` + `black --check .`
|
|
310
|
+
- Test + coverage: `pytest --cov=pinbridge_sdk ...`
|
|
311
|
+
- Build verification: `python -m build` + `twine check dist/*`
|
|
312
|
+
|
|
313
|
+
Workflow file: `.github/workflows/ci.yml`
|
|
314
|
+
|
|
315
|
+
## Publish to PyPI
|
|
316
|
+
|
|
317
|
+
Release workflow file: `.github/workflows/publish.yml`
|
|
318
|
+
|
|
319
|
+
Trigger options:
|
|
320
|
+
|
|
321
|
+
- Push a version tag (for example: `v0.1.0`)
|
|
322
|
+
- Manual `workflow_dispatch` with explicit version input
|
|
323
|
+
|
|
324
|
+
Detailed release runbook: `RELEASING.md`
|