billkit 0.1.dev21__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.
- billkit-0.1.dev21/.gitignore +222 -0
- billkit-0.1.dev21/.pre-commit-config.yaml +7 -0
- billkit-0.1.dev21/LICENSE +21 -0
- billkit-0.1.dev21/PKG-INFO +26 -0
- billkit-0.1.dev21/README.md +1 -0
- billkit-0.1.dev21/examples/basic_usage.py +5 -0
- billkit-0.1.dev21/examples/customers_example.py +5 -0
- billkit-0.1.dev21/examples/invoices_example.py +5 -0
- billkit-0.1.dev21/examples/pdf_download_example.py +5 -0
- billkit-0.1.dev21/examples/quotes_example.py +5 -0
- billkit-0.1.dev21/pyproject.toml +56 -0
- billkit-0.1.dev21/setup.cfg +4 -0
- billkit-0.1.dev21/src/billkit/__init__.py +0 -0
- billkit-0.1.dev21/src/billkit/_version.py +34 -0
- billkit-0.1.dev21/src/billkit/api/__init__.py +0 -0
- billkit-0.1.dev21/src/billkit/api/account.py +0 -0
- billkit-0.1.dev21/src/billkit/api/customers.py +0 -0
- billkit-0.1.dev21/src/billkit/api/invoices.py +0 -0
- billkit-0.1.dev21/src/billkit/api/quotes.py +0 -0
- billkit-0.1.dev21/src/billkit/client.py +44 -0
- billkit-0.1.dev21/src/billkit/exceptions.py +0 -0
- billkit-0.1.dev21/src/billkit/models/__init__.py +0 -0
- billkit-0.1.dev21/src/billkit/models/enums.py +30 -0
- billkit-0.1.dev21/src/billkit/models/header.py +19 -0
- billkit-0.1.dev21/src/billkit/models/invoices.py +77 -0
- billkit-0.1.dev21/src/billkit/models/items.py +23 -0
- billkit-0.1.dev21/src/billkit/models/sender.py +13 -0
- billkit-0.1.dev21/src/billkit/utils/__init__.py +0 -0
- billkit-0.1.dev21/src/billkit/utils/pdf_downloader.py +0 -0
- billkit-0.1.dev21/src/billkit/version.py +34 -0
- billkit-0.1.dev21/src/billkit.egg-info/PKG-INFO +26 -0
- billkit-0.1.dev21/src/billkit.egg-info/SOURCES.txt +34 -0
- billkit-0.1.dev21/src/billkit.egg-info/dependency_links.txt +1 -0
- billkit-0.1.dev21/src/billkit.egg-info/requires.txt +9 -0
- billkit-0.1.dev21/src/billkit.egg-info/top_level.txt +1 -0
- billkit-0.1.dev21/tests/conftest.py +0 -0
|
@@ -0,0 +1,222 @@
|
|
|
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
|
+
# Redis
|
|
135
|
+
*.rdb
|
|
136
|
+
*.aof
|
|
137
|
+
*.pid
|
|
138
|
+
|
|
139
|
+
# RabbitMQ
|
|
140
|
+
mnesia/
|
|
141
|
+
rabbitmq/
|
|
142
|
+
rabbitmq-data/
|
|
143
|
+
|
|
144
|
+
# ActiveMQ
|
|
145
|
+
activemq-data/
|
|
146
|
+
|
|
147
|
+
# SageMath parsed files
|
|
148
|
+
*.sage.py
|
|
149
|
+
|
|
150
|
+
# Environments
|
|
151
|
+
.env
|
|
152
|
+
.envrc
|
|
153
|
+
.venv
|
|
154
|
+
env/
|
|
155
|
+
venv/
|
|
156
|
+
ENV/
|
|
157
|
+
env.bak/
|
|
158
|
+
venv.bak/
|
|
159
|
+
|
|
160
|
+
# Spyder project settings
|
|
161
|
+
.spyderproject
|
|
162
|
+
.spyproject
|
|
163
|
+
|
|
164
|
+
# Rope project settings
|
|
165
|
+
.ropeproject
|
|
166
|
+
|
|
167
|
+
# mkdocs documentation
|
|
168
|
+
/site
|
|
169
|
+
|
|
170
|
+
# mypy
|
|
171
|
+
.mypy_cache/
|
|
172
|
+
.dmypy.json
|
|
173
|
+
dmypy.json
|
|
174
|
+
|
|
175
|
+
# Pyre type checker
|
|
176
|
+
.pyre/
|
|
177
|
+
|
|
178
|
+
# pytype static type analyzer
|
|
179
|
+
.pytype/
|
|
180
|
+
|
|
181
|
+
# Cython debug symbols
|
|
182
|
+
cython_debug/
|
|
183
|
+
|
|
184
|
+
# PyCharm
|
|
185
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
186
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
188
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
189
|
+
# .idea/
|
|
190
|
+
|
|
191
|
+
# Abstra
|
|
192
|
+
# Abstra is an AI-powered process automation framework.
|
|
193
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
194
|
+
# Learn more at https://abstra.io/docs
|
|
195
|
+
.abstra/
|
|
196
|
+
|
|
197
|
+
# Visual Studio Code
|
|
198
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
199
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
200
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
201
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
202
|
+
# .vscode/
|
|
203
|
+
|
|
204
|
+
# Ruff stuff:
|
|
205
|
+
.ruff_cache/
|
|
206
|
+
|
|
207
|
+
# PyPI configuration file
|
|
208
|
+
.pypirc
|
|
209
|
+
|
|
210
|
+
# Marimo
|
|
211
|
+
marimo/_static/
|
|
212
|
+
marimo/_lsp/
|
|
213
|
+
__marimo__/
|
|
214
|
+
|
|
215
|
+
# Streamlit
|
|
216
|
+
.streamlit/secrets.toml
|
|
217
|
+
|
|
218
|
+
# Generated files
|
|
219
|
+
src/billkit/_version.py
|
|
220
|
+
src/billkit/version.py
|
|
221
|
+
*_version.py
|
|
222
|
+
version.py
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 billkitco
|
|
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,26 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: billkit
|
|
3
|
+
Version: 0.1.dev21
|
|
4
|
+
Summary: Python client for Billkitco API
|
|
5
|
+
Author-email: Billkit <billkitco@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://billkit.co
|
|
8
|
+
Project-URL: Repository, https://github.com/billkitco/billkit-python
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/billkitco/billkit-python/issues
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Requires-Python: >=3.11
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: httpx>=0.27.0
|
|
17
|
+
Requires-Dist: pydantic>=2.0
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: pre-commit>=3.8.0; extra == "dev"
|
|
20
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
21
|
+
Requires-Dist: ruff>=0.5.0; extra == "dev"
|
|
22
|
+
Requires-Dist: black>=24.0.0; extra == "dev"
|
|
23
|
+
Requires-Dist: mypy>=1.10; extra == "dev"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# billkit-python
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# billkit-python
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61", "setuptools_scm>=7"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "billkit"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Python client for Billkitco API"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {text = "MIT"}
|
|
11
|
+
authors = [{name = "Billkit", email = "billkitco@gmail.com"}]
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Programming Language :: Python :: 3",
|
|
14
|
+
"License :: OSI Approved :: MIT License",
|
|
15
|
+
"Operating System :: OS Independent",
|
|
16
|
+
]
|
|
17
|
+
requires-python = ">=3.11"
|
|
18
|
+
dependencies = [
|
|
19
|
+
"httpx>=0.27.0",
|
|
20
|
+
"pydantic>=2.0",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[project.optional-dependencies]
|
|
24
|
+
dev = [
|
|
25
|
+
"pre-commit>=3.8.0",
|
|
26
|
+
"pytest>=8.0.0",
|
|
27
|
+
"ruff>=0.5.0",
|
|
28
|
+
"black>=24.0.0",
|
|
29
|
+
"mypy>=1.10",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.urls]
|
|
33
|
+
Homepage = "https://billkit.co"
|
|
34
|
+
Repository = "https://github.com/billkitco/billkit-python"
|
|
35
|
+
"Bug Tracker" = "https://github.com/billkitco/billkit-python/issues"
|
|
36
|
+
|
|
37
|
+
[tool.setuptools.packages.find]
|
|
38
|
+
where = ["src"]
|
|
39
|
+
|
|
40
|
+
[tool.setuptools_scm]
|
|
41
|
+
write_to = "src/billkit/_version.py"
|
|
42
|
+
version_scheme = "guess-next-dev"
|
|
43
|
+
local_scheme = "no-local-version" # ← this removes +... suffix
|
|
44
|
+
root = "."
|
|
45
|
+
|
|
46
|
+
[tool.ruff]
|
|
47
|
+
line-length = 88
|
|
48
|
+
target-version = "py310"
|
|
49
|
+
|
|
50
|
+
[tool.black]
|
|
51
|
+
line-length = 88
|
|
52
|
+
|
|
53
|
+
[tool.mypy]
|
|
54
|
+
python_version = "3.10"
|
|
55
|
+
warn_return_any = true
|
|
56
|
+
warn_unused_configs = true
|
|
File without changes
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# file generated by setuptools-scm
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
|
|
4
|
+
__all__ = [
|
|
5
|
+
"__version__",
|
|
6
|
+
"__version_tuple__",
|
|
7
|
+
"version",
|
|
8
|
+
"version_tuple",
|
|
9
|
+
"__commit_id__",
|
|
10
|
+
"commit_id",
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
TYPE_CHECKING = False
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from typing import Tuple
|
|
16
|
+
from typing import Union
|
|
17
|
+
|
|
18
|
+
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
19
|
+
COMMIT_ID = Union[str, None]
|
|
20
|
+
else:
|
|
21
|
+
VERSION_TUPLE = object
|
|
22
|
+
COMMIT_ID = object
|
|
23
|
+
|
|
24
|
+
version: str
|
|
25
|
+
__version__: str
|
|
26
|
+
__version_tuple__: VERSION_TUPLE
|
|
27
|
+
version_tuple: VERSION_TUPLE
|
|
28
|
+
commit_id: COMMIT_ID
|
|
29
|
+
__commit_id__: COMMIT_ID
|
|
30
|
+
|
|
31
|
+
__version__ = version = '0.1.dev21'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 1, 'dev21')
|
|
33
|
+
|
|
34
|
+
__commit_id__ = commit_id = 'g2213f9e2a'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import httpx
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class BillkitClient:
|
|
7
|
+
"""
|
|
8
|
+
client for Billkitco invoicing API.
|
|
9
|
+
|
|
10
|
+
Usage:
|
|
11
|
+
client = BillkitClient() # Uses BILLKITCO_API_KEY env var
|
|
12
|
+
client = BillkitClient(api_key="sk_...")
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def __init__(
|
|
16
|
+
self, api_key: str | None = None, base_url: str = "https://api.billkit.co/v1"
|
|
17
|
+
) -> None:
|
|
18
|
+
# Check env var first if no param
|
|
19
|
+
if api_key is None:
|
|
20
|
+
api_key = os.getenv("BILLKITCO_API_KEY")
|
|
21
|
+
|
|
22
|
+
if not api_key:
|
|
23
|
+
raise ValueError(
|
|
24
|
+
"API key required. Pass to BillkitClient(api_key='sk_...') "
|
|
25
|
+
"or set BILLKITCO_API_KEY environment variable."
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
self.api_key = api_key
|
|
29
|
+
self.base_url = base_url.rstrip("/")
|
|
30
|
+
self._client = httpx.Client(
|
|
31
|
+
base_url=self.base_url,
|
|
32
|
+
headers={"Authorization": f"Bearer {self.api_key}"},
|
|
33
|
+
timeout=30.0,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
def _request(self, method: str, endpoint: str, **kwargs: Any) -> dict:
|
|
37
|
+
"""Internal proxy to backend API endpoints."""
|
|
38
|
+
url: str = f"{self.base_url}/{endpoint.lstrip('/')}"
|
|
39
|
+
resp: httpx.Response = self._client.request(method, url, **kwargs)
|
|
40
|
+
resp.raise_for_status()
|
|
41
|
+
try:
|
|
42
|
+
return resp.json()
|
|
43
|
+
except ValueError:
|
|
44
|
+
return resp.text
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from enum import StrEnum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class _DocumentStyle(StrEnum):
|
|
5
|
+
ClassicLeftLogo = "Classic Left Logo"
|
|
6
|
+
ModernCenteredLogo = "Modern Centered Logo"
|
|
7
|
+
CompactSingleColumn = "Compact Single-Column"
|
|
8
|
+
DetailedBusinessVatTaxHeavy = "Detailed Business (VAT/Tax Heavy)"
|
|
9
|
+
ServicesTimeTrackingInvoice = "Services / Time-Tracking Invoice"
|
|
10
|
+
ProductItemisedInvoice = "Product / Itemised Invoice"
|
|
11
|
+
CreativeAgencyStyle = "Creative / Agency Style"
|
|
12
|
+
RetainerSubscriptionInvoice = "Retainer / Subscription Invoice"
|
|
13
|
+
MinimalMonochrome = "Minimal Monochrome"
|
|
14
|
+
BoldRightLogoLayout = "Bold Right-Logo Layout"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@classmethod
|
|
18
|
+
def as_invoice_style(cls) -> type[StrEnum]:
|
|
19
|
+
return StrEnum('InvoiceStyle', {name: value for name, value in cls.__members__.items()})
|
|
20
|
+
|
|
21
|
+
@classmethod
|
|
22
|
+
def as_quote_style(cls) -> type[StrEnum]:
|
|
23
|
+
return StrEnum('QuoteStyle', {name: value for name, value in cls.__members__.items()})
|
|
24
|
+
|
|
25
|
+
InvoiceStyle = _DocumentStyle.as_invoice_style()
|
|
26
|
+
QuoteStyle = _DocumentStyle.as_quote_style()
|
|
27
|
+
|
|
28
|
+
class DiscountType(StrEnum):
|
|
29
|
+
Percentage = "percentage"
|
|
30
|
+
Fixed = "fixed"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from pydantic import BaseModel
|
|
3
|
+
|
|
4
|
+
class _BaseHeader(BaseModel):
|
|
5
|
+
client_name: str
|
|
6
|
+
client_email: str
|
|
7
|
+
client_address: str
|
|
8
|
+
invoice_number: str
|
|
9
|
+
reference_number: str
|
|
10
|
+
po_number: str
|
|
11
|
+
invoice_date: str
|
|
12
|
+
due_date: datetime
|
|
13
|
+
currency_code: str | None = None
|
|
14
|
+
currency_symbol: str | None = None
|
|
15
|
+
invoice_type: str | None = None
|
|
16
|
+
|
|
17
|
+
class QuoteHeader(_BaseHeader): ...
|
|
18
|
+
|
|
19
|
+
class InvoiceHeader(_BaseHeader): ...
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from pydantic import BaseModel
|
|
3
|
+
|
|
4
|
+
from .client import ClientDetails
|
|
5
|
+
from .enums import InvoiceStyle
|
|
6
|
+
from .items import ItemsBase, DiscountType
|
|
7
|
+
from .sender import SenderDetails
|
|
8
|
+
|
|
9
|
+
class InvoiceItem(ItemsBase): ...
|
|
10
|
+
|
|
11
|
+
class InvoiceCreate(BaseModel):
|
|
12
|
+
"""
|
|
13
|
+
Schema for creating a new invoice.
|
|
14
|
+
|
|
15
|
+
Defines all required and optional fields for an invoice, including client and sender
|
|
16
|
+
information, line items, dates, styling, and monetary details such as currency
|
|
17
|
+
and discount.
|
|
18
|
+
|
|
19
|
+
Attributes:
|
|
20
|
+
client_name: Full name of the client.
|
|
21
|
+
client_email: Email address of the client.
|
|
22
|
+
invoice_number: Unique identifier of the invoice.
|
|
23
|
+
due_date: Deadline by which the invoice must be paid.
|
|
24
|
+
item: List of line-item details for the invoice.
|
|
25
|
+
|
|
26
|
+
from_name: Name of the sender / issuing entity.
|
|
27
|
+
from_email: Email of the sender / issuing entity.
|
|
28
|
+
from_address: Physical or mailing address of the sender.
|
|
29
|
+
|
|
30
|
+
client_address: Optional physical or mailing address of the client.
|
|
31
|
+
reference_number: Optional external invoice or account reference.
|
|
32
|
+
po_number: Optional purchase order number.
|
|
33
|
+
_save_client: Whether to persist client details for reuse (internal flag).
|
|
34
|
+
invoice_date: Optional date when the invoice is issued; defaults to now.
|
|
35
|
+
style: Layout style for the rendered invoice (e.g., logo position etc.).
|
|
36
|
+
logo_url: Optional URL to the logo image to display on the invoice.
|
|
37
|
+
currency_code: ISO currency code (e.g., 'GBP', 'USD').
|
|
38
|
+
currency_symbol: Display symbol for the currency (e.g., '£', '$').
|
|
39
|
+
|
|
40
|
+
notes: Optional notes included on the invoice.
|
|
41
|
+
terms: Optional terms and conditions text.
|
|
42
|
+
discount_types: Type of discount applied (e.g., percentage vs fixed).
|
|
43
|
+
discount_value: Numeric value of the discount (default 0.0).
|
|
44
|
+
"""
|
|
45
|
+
client_details: ClientDetails
|
|
46
|
+
invoice_number: str
|
|
47
|
+
due_date: datetime
|
|
48
|
+
items: list[InvoiceItem]
|
|
49
|
+
|
|
50
|
+
sender_details: SenderDetails | None = None
|
|
51
|
+
|
|
52
|
+
reference_number: str | None = None
|
|
53
|
+
po_number: str | None = None
|
|
54
|
+
invoice_date: datetime | None = None
|
|
55
|
+
style: InvoiceStyle = InvoiceStyle.ClassicLeftLogo
|
|
56
|
+
logo_url: str | None = None
|
|
57
|
+
"""
|
|
58
|
+
Optional URL of a logo image to display on this invoice.
|
|
59
|
+
If omitted or None, the invoice will fall back to the logo saved in the client's account.
|
|
60
|
+
"""
|
|
61
|
+
currency_code: str | None = None
|
|
62
|
+
currency_symbol: str | None = None
|
|
63
|
+
|
|
64
|
+
notes: str | None = None
|
|
65
|
+
terms: str | None = None
|
|
66
|
+
discount_types: DiscountType | None = None
|
|
67
|
+
"""
|
|
68
|
+
Document level discount. This applies the discount to all items before tax
|
|
69
|
+
"""
|
|
70
|
+
discount_value: float = 0.0
|
|
71
|
+
"""
|
|
72
|
+
Document level discount. This applies the discount to all items before tax
|
|
73
|
+
"""
|
|
74
|
+
_save_client: bool = False
|
|
75
|
+
"""
|
|
76
|
+
Whether to add client information to gui for autofill function. Largely irrelevant for programmatic access
|
|
77
|
+
"""
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from decimal import Decimal
|
|
2
|
+
|
|
3
|
+
from .enums import DiscountType
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel, Field, model_validator
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ItemsBase(BaseModel):
|
|
9
|
+
description: str = Field(..., min_length=1)
|
|
10
|
+
qty: int = Field(..., gt=0)
|
|
11
|
+
price: Decimal = Field(..., gt=0)
|
|
12
|
+
tax: Decimal = Field(default=Decimal("0.00"), ge=0)
|
|
13
|
+
discount_type: DiscountType | None = None
|
|
14
|
+
discount_value: Decimal = Field(default=Decimal("0.00"), ge=0)
|
|
15
|
+
|
|
16
|
+
@model_validator(mode="after")
|
|
17
|
+
def validate_discount(self) -> "ItemsBase":
|
|
18
|
+
if self.discount_type is None:
|
|
19
|
+
self.discount_value = Decimal("0.00")
|
|
20
|
+
return self
|
|
21
|
+
if self.discount_type == DiscountType.Percentage and self.discount_value > 100:
|
|
22
|
+
raise ValueError("Percentage discount must be 100 or less")
|
|
23
|
+
return self
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from pydantic import BaseModel
|
|
2
|
+
|
|
3
|
+
class SenderDetails(BaseModel):
|
|
4
|
+
"""
|
|
5
|
+
Sender (your business) details for invoices/quotes.
|
|
6
|
+
|
|
7
|
+
All fields are optional and default to your account settings if omitted.
|
|
8
|
+
If no account defaults exist, invoices will lack sender information.
|
|
9
|
+
Explicitly setting fields is recommended for reliability.
|
|
10
|
+
"""
|
|
11
|
+
from_name: str | None = None
|
|
12
|
+
from_email: str | None = None
|
|
13
|
+
from_address: str | None = None
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# file generated by setuptools-scm
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
|
|
4
|
+
__all__ = [
|
|
5
|
+
"__version__",
|
|
6
|
+
"__version_tuple__",
|
|
7
|
+
"version",
|
|
8
|
+
"version_tuple",
|
|
9
|
+
"__commit_id__",
|
|
10
|
+
"commit_id",
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
TYPE_CHECKING = False
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from typing import Tuple
|
|
16
|
+
from typing import Union
|
|
17
|
+
|
|
18
|
+
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
19
|
+
COMMIT_ID = Union[str, None]
|
|
20
|
+
else:
|
|
21
|
+
VERSION_TUPLE = object
|
|
22
|
+
COMMIT_ID = object
|
|
23
|
+
|
|
24
|
+
version: str
|
|
25
|
+
__version__: str
|
|
26
|
+
__version_tuple__: VERSION_TUPLE
|
|
27
|
+
version_tuple: VERSION_TUPLE
|
|
28
|
+
commit_id: COMMIT_ID
|
|
29
|
+
__commit_id__: COMMIT_ID
|
|
30
|
+
|
|
31
|
+
__version__ = version = '0.1.dev20+g5a4ac962c'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 1, 'dev20', 'g5a4ac962c')
|
|
33
|
+
|
|
34
|
+
__commit_id__ = commit_id = 'g5a4ac962c'
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: billkit
|
|
3
|
+
Version: 0.1.dev21
|
|
4
|
+
Summary: Python client for Billkitco API
|
|
5
|
+
Author-email: Billkit <billkitco@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://billkit.co
|
|
8
|
+
Project-URL: Repository, https://github.com/billkitco/billkit-python
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/billkitco/billkit-python/issues
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Requires-Python: >=3.11
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: httpx>=0.27.0
|
|
17
|
+
Requires-Dist: pydantic>=2.0
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: pre-commit>=3.8.0; extra == "dev"
|
|
20
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
21
|
+
Requires-Dist: ruff>=0.5.0; extra == "dev"
|
|
22
|
+
Requires-Dist: black>=24.0.0; extra == "dev"
|
|
23
|
+
Requires-Dist: mypy>=1.10; extra == "dev"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# billkit-python
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
.gitignore
|
|
2
|
+
.pre-commit-config.yaml
|
|
3
|
+
LICENSE
|
|
4
|
+
README.md
|
|
5
|
+
pyproject.toml
|
|
6
|
+
examples/basic_usage.py
|
|
7
|
+
examples/customers_example.py
|
|
8
|
+
examples/invoices_example.py
|
|
9
|
+
examples/pdf_download_example.py
|
|
10
|
+
examples/quotes_example.py
|
|
11
|
+
src/billkit/__init__.py
|
|
12
|
+
src/billkit/_version.py
|
|
13
|
+
src/billkit/client.py
|
|
14
|
+
src/billkit/exceptions.py
|
|
15
|
+
src/billkit/version.py
|
|
16
|
+
src/billkit.egg-info/PKG-INFO
|
|
17
|
+
src/billkit.egg-info/SOURCES.txt
|
|
18
|
+
src/billkit.egg-info/dependency_links.txt
|
|
19
|
+
src/billkit.egg-info/requires.txt
|
|
20
|
+
src/billkit.egg-info/top_level.txt
|
|
21
|
+
src/billkit/api/__init__.py
|
|
22
|
+
src/billkit/api/account.py
|
|
23
|
+
src/billkit/api/customers.py
|
|
24
|
+
src/billkit/api/invoices.py
|
|
25
|
+
src/billkit/api/quotes.py
|
|
26
|
+
src/billkit/models/__init__.py
|
|
27
|
+
src/billkit/models/enums.py
|
|
28
|
+
src/billkit/models/header.py
|
|
29
|
+
src/billkit/models/invoices.py
|
|
30
|
+
src/billkit/models/items.py
|
|
31
|
+
src/billkit/models/sender.py
|
|
32
|
+
src/billkit/utils/__init__.py
|
|
33
|
+
src/billkit/utils/pdf_downloader.py
|
|
34
|
+
tests/conftest.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
billkit
|
|
File without changes
|