branddrive-python-sdk 0.1.0__tar.gz → 0.1.1__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.
Files changed (65) hide show
  1. branddrive_python_sdk-0.1.1/PKG-INFO +208 -0
  2. branddrive_python_sdk-0.1.1/README.md +188 -0
  3. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/pyproject.toml +1 -1
  4. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/__init__.py +1 -1
  5. branddrive_python_sdk-0.1.1/src/branddrive_python_sdk.egg-info/PKG-INFO +208 -0
  6. branddrive_python_sdk-0.1.0/PKG-INFO +0 -132
  7. branddrive_python_sdk-0.1.0/README.md +0 -112
  8. branddrive_python_sdk-0.1.0/src/branddrive_python_sdk.egg-info/PKG-INFO +0 -132
  9. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/setup.cfg +0 -0
  10. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/client.py +0 -0
  11. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/config.py +0 -0
  12. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/dataclasses/__init__.py +0 -0
  13. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/dataclasses/_utils.py +0 -0
  14. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/dataclasses/customers.py +0 -0
  15. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/dataclasses/expenses.py +0 -0
  16. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/dataclasses/invoices.py +0 -0
  17. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/dataclasses/payment_links.py +0 -0
  18. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/dataclasses/pos.py +0 -0
  19. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/dataclasses/products.py +0 -0
  20. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/dataclasses/purchase_orders.py +0 -0
  21. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/dataclasses/services.py +0 -0
  22. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/dataclasses/vendors.py +0 -0
  23. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/dataclasses/wallets.py +0 -0
  24. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/exceptions.py +0 -0
  25. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/protocols/__init__.py +0 -0
  26. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/protocols/analytics.py +0 -0
  27. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/protocols/customers.py +0 -0
  28. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/protocols/expenses.py +0 -0
  29. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/protocols/invoices.py +0 -0
  30. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/protocols/payment_links.py +0 -0
  31. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/protocols/pos.py +0 -0
  32. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/protocols/products.py +0 -0
  33. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/protocols/purchase_orders.py +0 -0
  34. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/protocols/services.py +0 -0
  35. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/protocols/vendors.py +0 -0
  36. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/protocols/wallets.py +0 -0
  37. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/resources/__init__.py +0 -0
  38. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/resources/_utils.py +0 -0
  39. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/resources/analytics.py +0 -0
  40. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/resources/customers.py +0 -0
  41. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/resources/expenses.py +0 -0
  42. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/resources/invoices.py +0 -0
  43. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/resources/payment_links.py +0 -0
  44. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/resources/pos.py +0 -0
  45. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/resources/products.py +0 -0
  46. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/resources/purchase_orders.py +0 -0
  47. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/resources/services.py +0 -0
  48. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/resources/vendors.py +0 -0
  49. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive/resources/wallets.py +0 -0
  50. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive_python_sdk.egg-info/SOURCES.txt +0 -0
  51. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive_python_sdk.egg-info/dependency_links.txt +0 -0
  52. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive_python_sdk.egg-info/requires.txt +0 -0
  53. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/src/branddrive_python_sdk.egg-info/top_level.txt +0 -0
  54. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/tests/test_analytics.py +0 -0
  55. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/tests/test_client.py +0 -0
  56. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/tests/test_customers.py +0 -0
  57. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/tests/test_expenses.py +0 -0
  58. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/tests/test_invoices.py +0 -0
  59. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/tests/test_payment_links.py +0 -0
  60. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/tests/test_pos.py +0 -0
  61. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/tests/test_products.py +0 -0
  62. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/tests/test_purchase_orders.py +0 -0
  63. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/tests/test_services.py +0 -0
  64. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/tests/test_vendors.py +0 -0
  65. {branddrive_python_sdk-0.1.0 → branddrive_python_sdk-0.1.1}/tests/test_wallets.py +0 -0
@@ -0,0 +1,208 @@
1
+ Metadata-Version: 2.4
2
+ Name: branddrive-python-sdk
3
+ Version: 0.1.1
4
+ Summary: Official Python SDK for the BrandDrive API
5
+ Author: Ogenna Israel
6
+ License-Expression: LicenseRef-Proprietary
7
+ Keywords: branddrive,sdk,api,business
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Requires-Python: >=3.12
14
+ Description-Content-Type: text/markdown
15
+ Requires-Dist: httpx>=0.29.0
16
+ Requires-Dist: python-dotenv>=1.0.0
17
+ Provides-Extra: dev
18
+ Requires-Dist: build>=1.2; extra == "dev"
19
+ Requires-Dist: pytest>=9.2.0; extra == "dev"
20
+
21
+ # BrandDrive Python SDK
22
+
23
+ The BrandDrive Python SDK provides a synchronous Python client for the BrandDrive
24
+ API. It groups API operations into resource objects, handles authentication and
25
+ HTTP requests, and provides dataclasses for constructing request payloads.
26
+
27
+ The SDK supports customers, invoices, products, point of sale (POS), services,
28
+ vendors, purchase orders, expenses, wallets, payment links, and analytics.
29
+
30
+ ## Requirements
31
+
32
+ - Python 3.12 or newer
33
+ - A BrandDrive API key with access to the API operations you intend to use
34
+
35
+ ## Install
36
+
37
+ Install the published package from PyPI:
38
+
39
+ ```bash
40
+ python -m pip install branddrive-python-sdk
41
+ ```
42
+
43
+ To upgrade to the latest version:
44
+
45
+ ```bash
46
+ pip install --upgrade branddrive-python-sdk
47
+ ```
48
+
49
+ In a project using a dependency file, add `branddrive-python-sdk` to that file
50
+ and pin the version your application has tested.
51
+
52
+ ## Configure credentials
53
+
54
+ The client reads its default credentials from environment variables:
55
+
56
+ | Variable | Required | Default | Description |
57
+ | --- | --- | --- | --- |
58
+ | `BRANDDRIVE_API_KEY` | Yes | None | API key sent as a Bearer token |
59
+ | `BRANDDRIVE_BASE_URL` | No | `https://api.branddrive.com` | API base URL |
60
+
61
+ Set them in your shell or your deployment platform's secret manager. For local
62
+ development, the package also loads a `.env` file from the current working
63
+ directory if `python-dotenv` can find one. Never commit real API keys.
64
+
65
+ PowerShell:
66
+
67
+ ```powershell
68
+ $env:BRANDDRIVE_API_KEY = "your-api-key"
69
+ $env:BRANDDRIVE_BASE_URL = "https://api.branddrive.com"
70
+ ```
71
+
72
+ Linux or macOS:
73
+
74
+ ```bash
75
+ export BRANDDRIVE_API_KEY="your-api-key"
76
+ export BRANDDRIVE_BASE_URL="https://api.branddrive.com"
77
+ ```
78
+
79
+ You can also pass credentials directly to the client constructor. Explicit
80
+ arguments override the environment-derived defaults.
81
+
82
+ ## Quick start
83
+
84
+ ```python
85
+ from branddrive import BrandDriveClient
86
+ from branddrive.dataclasses import CustomerData
87
+
88
+ customer_data = CustomerData(
89
+ first_name="Amina",
90
+ branch_id=2,
91
+ birth_day=3,
92
+ birth_month=6,
93
+ email="amina@example.com",
94
+ )
95
+
96
+ # The client closes its HTTP connection pool when the block exits.
97
+ with BrandDriveClient() as client:
98
+ result = client.customers.create_customer(customer_data)
99
+ print(result)
100
+ ```
101
+
102
+ The response is the decoded JSON body returned by the BrandDrive API. The SDK
103
+ does not convert responses into response dataclasses.
104
+
105
+ ## Creating and configuring the client
106
+
107
+ ```python
108
+ from branddrive import BrandDriveClient
109
+
110
+ client = BrandDriveClient(
111
+ api_key="your-api-key",
112
+ base_url="https://api.branddrive.com",
113
+ timeout=10,
114
+ max_retries=3,
115
+ )
116
+ try:
117
+ overview = client.analytics.get_performance_overview()
118
+ print(overview)
119
+ finally:
120
+ client.close()
121
+ ```
122
+
123
+ `timeout` is the HTTP request timeout in seconds. The generic
124
+ `client.request(method, path, ...)` helper retries transport errors and HTTP 500
125
+ responses using exponential backoff. `max_retries` is the number of retry
126
+ attempts after the initial request. Resource methods use the underlying HTTPX
127
+ client directly, so they do not currently use this retry helper.
128
+
129
+ Prefer the context-manager form for normal application code so the underlying
130
+ HTTP connection pool is always closed.
131
+
132
+ ## Available resources
133
+
134
+ Use the corresponding property on a `BrandDriveClient` instance:
135
+
136
+ | Property | Area |
137
+ | --- | --- |
138
+ | `client.customers` | Customer records, CSV import/export |
139
+ | `client.invoices` | Invoices, procurements, recurring schedules |
140
+ | `client.products` | Products, categories, variations, distributions |
141
+ | `client.pos` | POS orders, payments, and procurements |
142
+ | `client.services` | Services and service categories |
143
+ | `client.vendors` | Vendors, CSV import/export |
144
+ | `client.purchase_orders` | Purchase orders, procurements, payments |
145
+ | `client.expenses` | Expenses, procurements, and payments |
146
+ | `client.wallets` | Wallet details, transfers, funding, transactions |
147
+ | `client.payment_links` | Payment links, categories, and payments |
148
+ | `client.analytics` | Sales, performance, payment, and other analytics |
149
+
150
+ Resource methods generally return dictionaries containing the API's JSON
151
+ response. Methods that download a file, such as exports and invoice previews,
152
+ return `bytes`. CSV imports accept a filesystem path to a `.csv` file.
153
+
154
+ For example, product methods are grouped by operation:
155
+
156
+ ```python
157
+ from branddrive import BrandDriveClient
158
+ from branddrive.dataclasses import SingleProductCreate
159
+
160
+ product_data = SingleProductCreate(
161
+ name="Laptop",
162
+ category_id=12,
163
+ selling_price=500,
164
+ cost_price=350,
165
+ branch_id=3,
166
+ )
167
+
168
+ with BrandDriveClient() as client:
169
+ result = client.products.single.create_product(product_data)
170
+ ```
171
+
172
+ Payload dataclasses are available from `branddrive.dataclasses`. Resource
173
+ classes can be imported from `branddrive.resources` or their resource modules
174
+ when needed.
175
+
176
+ ## Errors
177
+
178
+ ```python
179
+ from branddrive import APIException, BrandDriveClient
180
+
181
+ try:
182
+ with BrandDriveClient() as client:
183
+ result = client.customers.retrieve_customer(customer_id=123)
184
+ except APIException as exc:
185
+ # API errors include the HTTP status code and, when provided, request ID.
186
+ print(exc.status_code, exc.request_id, str(exc))
187
+ ```
188
+
189
+ Missing credentials raise `InvalidAPIKeyException`; an empty API base URL raises
190
+ `InvalidBaseURLException`. Resource methods may also raise `TypeError` or
191
+ `ValueError` when their arguments fail local validation. If
192
+ `client.request()` exhausts retries after a network failure, it re-raises the
193
+ underlying `httpx` transport exception.
194
+
195
+ ## API reference and development
196
+
197
+ See the [API usage guide](https://github.com/ogennaisrael01/branddrive-python-sdk/blob/main/docs/api.md)
198
+ for more examples. The SDK source and tests are available in the
199
+ [GitHub repository](https://github.com/ogennaisrael01/branddrive-python-sdk).
200
+
201
+ To run tests or build the package from a checkout, first clone the repository
202
+ and change to its directory, then install its development dependencies:
203
+
204
+ ```bash
205
+ python -m pip install -e ".[dev]"
206
+ python -m pytest
207
+ python -m build
208
+ ```
@@ -0,0 +1,188 @@
1
+ # BrandDrive Python SDK
2
+
3
+ The BrandDrive Python SDK provides a synchronous Python client for the BrandDrive
4
+ API. It groups API operations into resource objects, handles authentication and
5
+ HTTP requests, and provides dataclasses for constructing request payloads.
6
+
7
+ The SDK supports customers, invoices, products, point of sale (POS), services,
8
+ vendors, purchase orders, expenses, wallets, payment links, and analytics.
9
+
10
+ ## Requirements
11
+
12
+ - Python 3.12 or newer
13
+ - A BrandDrive API key with access to the API operations you intend to use
14
+
15
+ ## Install
16
+
17
+ Install the published package from PyPI:
18
+
19
+ ```bash
20
+ python -m pip install branddrive-python-sdk
21
+ ```
22
+
23
+ To upgrade to the latest version:
24
+
25
+ ```bash
26
+ pip install --upgrade branddrive-python-sdk
27
+ ```
28
+
29
+ In a project using a dependency file, add `branddrive-python-sdk` to that file
30
+ and pin the version your application has tested.
31
+
32
+ ## Configure credentials
33
+
34
+ The client reads its default credentials from environment variables:
35
+
36
+ | Variable | Required | Default | Description |
37
+ | --- | --- | --- | --- |
38
+ | `BRANDDRIVE_API_KEY` | Yes | None | API key sent as a Bearer token |
39
+ | `BRANDDRIVE_BASE_URL` | No | `https://api.branddrive.com` | API base URL |
40
+
41
+ Set them in your shell or your deployment platform's secret manager. For local
42
+ development, the package also loads a `.env` file from the current working
43
+ directory if `python-dotenv` can find one. Never commit real API keys.
44
+
45
+ PowerShell:
46
+
47
+ ```powershell
48
+ $env:BRANDDRIVE_API_KEY = "your-api-key"
49
+ $env:BRANDDRIVE_BASE_URL = "https://api.branddrive.com"
50
+ ```
51
+
52
+ Linux or macOS:
53
+
54
+ ```bash
55
+ export BRANDDRIVE_API_KEY="your-api-key"
56
+ export BRANDDRIVE_BASE_URL="https://api.branddrive.com"
57
+ ```
58
+
59
+ You can also pass credentials directly to the client constructor. Explicit
60
+ arguments override the environment-derived defaults.
61
+
62
+ ## Quick start
63
+
64
+ ```python
65
+ from branddrive import BrandDriveClient
66
+ from branddrive.dataclasses import CustomerData
67
+
68
+ customer_data = CustomerData(
69
+ first_name="Amina",
70
+ branch_id=2,
71
+ birth_day=3,
72
+ birth_month=6,
73
+ email="amina@example.com",
74
+ )
75
+
76
+ # The client closes its HTTP connection pool when the block exits.
77
+ with BrandDriveClient() as client:
78
+ result = client.customers.create_customer(customer_data)
79
+ print(result)
80
+ ```
81
+
82
+ The response is the decoded JSON body returned by the BrandDrive API. The SDK
83
+ does not convert responses into response dataclasses.
84
+
85
+ ## Creating and configuring the client
86
+
87
+ ```python
88
+ from branddrive import BrandDriveClient
89
+
90
+ client = BrandDriveClient(
91
+ api_key="your-api-key",
92
+ base_url="https://api.branddrive.com",
93
+ timeout=10,
94
+ max_retries=3,
95
+ )
96
+ try:
97
+ overview = client.analytics.get_performance_overview()
98
+ print(overview)
99
+ finally:
100
+ client.close()
101
+ ```
102
+
103
+ `timeout` is the HTTP request timeout in seconds. The generic
104
+ `client.request(method, path, ...)` helper retries transport errors and HTTP 500
105
+ responses using exponential backoff. `max_retries` is the number of retry
106
+ attempts after the initial request. Resource methods use the underlying HTTPX
107
+ client directly, so they do not currently use this retry helper.
108
+
109
+ Prefer the context-manager form for normal application code so the underlying
110
+ HTTP connection pool is always closed.
111
+
112
+ ## Available resources
113
+
114
+ Use the corresponding property on a `BrandDriveClient` instance:
115
+
116
+ | Property | Area |
117
+ | --- | --- |
118
+ | `client.customers` | Customer records, CSV import/export |
119
+ | `client.invoices` | Invoices, procurements, recurring schedules |
120
+ | `client.products` | Products, categories, variations, distributions |
121
+ | `client.pos` | POS orders, payments, and procurements |
122
+ | `client.services` | Services and service categories |
123
+ | `client.vendors` | Vendors, CSV import/export |
124
+ | `client.purchase_orders` | Purchase orders, procurements, payments |
125
+ | `client.expenses` | Expenses, procurements, and payments |
126
+ | `client.wallets` | Wallet details, transfers, funding, transactions |
127
+ | `client.payment_links` | Payment links, categories, and payments |
128
+ | `client.analytics` | Sales, performance, payment, and other analytics |
129
+
130
+ Resource methods generally return dictionaries containing the API's JSON
131
+ response. Methods that download a file, such as exports and invoice previews,
132
+ return `bytes`. CSV imports accept a filesystem path to a `.csv` file.
133
+
134
+ For example, product methods are grouped by operation:
135
+
136
+ ```python
137
+ from branddrive import BrandDriveClient
138
+ from branddrive.dataclasses import SingleProductCreate
139
+
140
+ product_data = SingleProductCreate(
141
+ name="Laptop",
142
+ category_id=12,
143
+ selling_price=500,
144
+ cost_price=350,
145
+ branch_id=3,
146
+ )
147
+
148
+ with BrandDriveClient() as client:
149
+ result = client.products.single.create_product(product_data)
150
+ ```
151
+
152
+ Payload dataclasses are available from `branddrive.dataclasses`. Resource
153
+ classes can be imported from `branddrive.resources` or their resource modules
154
+ when needed.
155
+
156
+ ## Errors
157
+
158
+ ```python
159
+ from branddrive import APIException, BrandDriveClient
160
+
161
+ try:
162
+ with BrandDriveClient() as client:
163
+ result = client.customers.retrieve_customer(customer_id=123)
164
+ except APIException as exc:
165
+ # API errors include the HTTP status code and, when provided, request ID.
166
+ print(exc.status_code, exc.request_id, str(exc))
167
+ ```
168
+
169
+ Missing credentials raise `InvalidAPIKeyException`; an empty API base URL raises
170
+ `InvalidBaseURLException`. Resource methods may also raise `TypeError` or
171
+ `ValueError` when their arguments fail local validation. If
172
+ `client.request()` exhausts retries after a network failure, it re-raises the
173
+ underlying `httpx` transport exception.
174
+
175
+ ## API reference and development
176
+
177
+ See the [API usage guide](https://github.com/ogennaisrael01/branddrive-python-sdk/blob/main/docs/api.md)
178
+ for more examples. The SDK source and tests are available in the
179
+ [GitHub repository](https://github.com/ogennaisrael01/branddrive-python-sdk).
180
+
181
+ To run tests or build the package from a checkout, first clone the repository
182
+ and change to its directory, then install its development dependencies:
183
+
184
+ ```bash
185
+ python -m pip install -e ".[dev]"
186
+ python -m pytest
187
+ python -m build
188
+ ```
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "branddrive-python-sdk"
3
- version = "0.1.0"
3
+ version = "0.1.1"
4
4
  description = "Official Python SDK for the BrandDrive API"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -1,6 +1,6 @@
1
1
  from typing import TYPE_CHECKING, Any
2
2
 
3
- version = '0.1.0'
3
+ version = '0.1.1'
4
4
  if TYPE_CHECKING:
5
5
  from .client import BrandDriveClient
6
6
  from .exceptions import APIException, InvalidAPIKeyException, InvalidBaseURLException
@@ -0,0 +1,208 @@
1
+ Metadata-Version: 2.4
2
+ Name: branddrive-python-sdk
3
+ Version: 0.1.1
4
+ Summary: Official Python SDK for the BrandDrive API
5
+ Author: Ogenna Israel
6
+ License-Expression: LicenseRef-Proprietary
7
+ Keywords: branddrive,sdk,api,business
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Requires-Python: >=3.12
14
+ Description-Content-Type: text/markdown
15
+ Requires-Dist: httpx>=0.29.0
16
+ Requires-Dist: python-dotenv>=1.0.0
17
+ Provides-Extra: dev
18
+ Requires-Dist: build>=1.2; extra == "dev"
19
+ Requires-Dist: pytest>=9.2.0; extra == "dev"
20
+
21
+ # BrandDrive Python SDK
22
+
23
+ The BrandDrive Python SDK provides a synchronous Python client for the BrandDrive
24
+ API. It groups API operations into resource objects, handles authentication and
25
+ HTTP requests, and provides dataclasses for constructing request payloads.
26
+
27
+ The SDK supports customers, invoices, products, point of sale (POS), services,
28
+ vendors, purchase orders, expenses, wallets, payment links, and analytics.
29
+
30
+ ## Requirements
31
+
32
+ - Python 3.12 or newer
33
+ - A BrandDrive API key with access to the API operations you intend to use
34
+
35
+ ## Install
36
+
37
+ Install the published package from PyPI:
38
+
39
+ ```bash
40
+ python -m pip install branddrive-python-sdk
41
+ ```
42
+
43
+ To upgrade to the latest version:
44
+
45
+ ```bash
46
+ pip install --upgrade branddrive-python-sdk
47
+ ```
48
+
49
+ In a project using a dependency file, add `branddrive-python-sdk` to that file
50
+ and pin the version your application has tested.
51
+
52
+ ## Configure credentials
53
+
54
+ The client reads its default credentials from environment variables:
55
+
56
+ | Variable | Required | Default | Description |
57
+ | --- | --- | --- | --- |
58
+ | `BRANDDRIVE_API_KEY` | Yes | None | API key sent as a Bearer token |
59
+ | `BRANDDRIVE_BASE_URL` | No | `https://api.branddrive.com` | API base URL |
60
+
61
+ Set them in your shell or your deployment platform's secret manager. For local
62
+ development, the package also loads a `.env` file from the current working
63
+ directory if `python-dotenv` can find one. Never commit real API keys.
64
+
65
+ PowerShell:
66
+
67
+ ```powershell
68
+ $env:BRANDDRIVE_API_KEY = "your-api-key"
69
+ $env:BRANDDRIVE_BASE_URL = "https://api.branddrive.com"
70
+ ```
71
+
72
+ Linux or macOS:
73
+
74
+ ```bash
75
+ export BRANDDRIVE_API_KEY="your-api-key"
76
+ export BRANDDRIVE_BASE_URL="https://api.branddrive.com"
77
+ ```
78
+
79
+ You can also pass credentials directly to the client constructor. Explicit
80
+ arguments override the environment-derived defaults.
81
+
82
+ ## Quick start
83
+
84
+ ```python
85
+ from branddrive import BrandDriveClient
86
+ from branddrive.dataclasses import CustomerData
87
+
88
+ customer_data = CustomerData(
89
+ first_name="Amina",
90
+ branch_id=2,
91
+ birth_day=3,
92
+ birth_month=6,
93
+ email="amina@example.com",
94
+ )
95
+
96
+ # The client closes its HTTP connection pool when the block exits.
97
+ with BrandDriveClient() as client:
98
+ result = client.customers.create_customer(customer_data)
99
+ print(result)
100
+ ```
101
+
102
+ The response is the decoded JSON body returned by the BrandDrive API. The SDK
103
+ does not convert responses into response dataclasses.
104
+
105
+ ## Creating and configuring the client
106
+
107
+ ```python
108
+ from branddrive import BrandDriveClient
109
+
110
+ client = BrandDriveClient(
111
+ api_key="your-api-key",
112
+ base_url="https://api.branddrive.com",
113
+ timeout=10,
114
+ max_retries=3,
115
+ )
116
+ try:
117
+ overview = client.analytics.get_performance_overview()
118
+ print(overview)
119
+ finally:
120
+ client.close()
121
+ ```
122
+
123
+ `timeout` is the HTTP request timeout in seconds. The generic
124
+ `client.request(method, path, ...)` helper retries transport errors and HTTP 500
125
+ responses using exponential backoff. `max_retries` is the number of retry
126
+ attempts after the initial request. Resource methods use the underlying HTTPX
127
+ client directly, so they do not currently use this retry helper.
128
+
129
+ Prefer the context-manager form for normal application code so the underlying
130
+ HTTP connection pool is always closed.
131
+
132
+ ## Available resources
133
+
134
+ Use the corresponding property on a `BrandDriveClient` instance:
135
+
136
+ | Property | Area |
137
+ | --- | --- |
138
+ | `client.customers` | Customer records, CSV import/export |
139
+ | `client.invoices` | Invoices, procurements, recurring schedules |
140
+ | `client.products` | Products, categories, variations, distributions |
141
+ | `client.pos` | POS orders, payments, and procurements |
142
+ | `client.services` | Services and service categories |
143
+ | `client.vendors` | Vendors, CSV import/export |
144
+ | `client.purchase_orders` | Purchase orders, procurements, payments |
145
+ | `client.expenses` | Expenses, procurements, and payments |
146
+ | `client.wallets` | Wallet details, transfers, funding, transactions |
147
+ | `client.payment_links` | Payment links, categories, and payments |
148
+ | `client.analytics` | Sales, performance, payment, and other analytics |
149
+
150
+ Resource methods generally return dictionaries containing the API's JSON
151
+ response. Methods that download a file, such as exports and invoice previews,
152
+ return `bytes`. CSV imports accept a filesystem path to a `.csv` file.
153
+
154
+ For example, product methods are grouped by operation:
155
+
156
+ ```python
157
+ from branddrive import BrandDriveClient
158
+ from branddrive.dataclasses import SingleProductCreate
159
+
160
+ product_data = SingleProductCreate(
161
+ name="Laptop",
162
+ category_id=12,
163
+ selling_price=500,
164
+ cost_price=350,
165
+ branch_id=3,
166
+ )
167
+
168
+ with BrandDriveClient() as client:
169
+ result = client.products.single.create_product(product_data)
170
+ ```
171
+
172
+ Payload dataclasses are available from `branddrive.dataclasses`. Resource
173
+ classes can be imported from `branddrive.resources` or their resource modules
174
+ when needed.
175
+
176
+ ## Errors
177
+
178
+ ```python
179
+ from branddrive import APIException, BrandDriveClient
180
+
181
+ try:
182
+ with BrandDriveClient() as client:
183
+ result = client.customers.retrieve_customer(customer_id=123)
184
+ except APIException as exc:
185
+ # API errors include the HTTP status code and, when provided, request ID.
186
+ print(exc.status_code, exc.request_id, str(exc))
187
+ ```
188
+
189
+ Missing credentials raise `InvalidAPIKeyException`; an empty API base URL raises
190
+ `InvalidBaseURLException`. Resource methods may also raise `TypeError` or
191
+ `ValueError` when their arguments fail local validation. If
192
+ `client.request()` exhausts retries after a network failure, it re-raises the
193
+ underlying `httpx` transport exception.
194
+
195
+ ## API reference and development
196
+
197
+ See the [API usage guide](https://github.com/ogennaisrael01/branddrive-python-sdk/blob/main/docs/api.md)
198
+ for more examples. The SDK source and tests are available in the
199
+ [GitHub repository](https://github.com/ogennaisrael01/branddrive-python-sdk).
200
+
201
+ To run tests or build the package from a checkout, first clone the repository
202
+ and change to its directory, then install its development dependencies:
203
+
204
+ ```bash
205
+ python -m pip install -e ".[dev]"
206
+ python -m pytest
207
+ python -m build
208
+ ```
@@ -1,132 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: branddrive-python-sdk
3
- Version: 0.1.0
4
- Summary: Official Python SDK for the BrandDrive API
5
- Author: Ogenna Israel
6
- License-Expression: LicenseRef-Proprietary
7
- Keywords: branddrive,sdk,api,business
8
- Classifier: Development Status :: 4 - Beta
9
- Classifier: Intended Audience :: Developers
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.12
12
- Classifier: Programming Language :: Python :: 3.13
13
- Requires-Python: >=3.12
14
- Description-Content-Type: text/markdown
15
- Requires-Dist: httpx>=0.29.0
16
- Requires-Dist: python-dotenv>=1.0.0
17
- Provides-Extra: dev
18
- Requires-Dist: build>=1.2; extra == "dev"
19
- Requires-Dist: pytest>=9.2.0; extra == "dev"
20
-
21
- # BrandDrive Python SDK
22
-
23
- A Python client for BrandDrive business resources, including customers, products,
24
- invoices, POS, services, vendors, purchase orders, expenses, wallets, payment
25
- links, and analytics.
26
-
27
- ## Requirements
28
-
29
- - Python 3.12 or newer
30
- - A BrandDrive API key
31
-
32
- ## Installation
33
-
34
- Install the package from the repository:
35
-
36
- ```bash
37
- python -m pip install .
38
- ```
39
-
40
- For local development:
41
-
42
- ```bash
43
- python -m pip install -e ".[dev]"
44
- ```
45
-
46
- ## Configuration
47
-
48
- Set credentials in environment variables or pass them directly:
49
-
50
- ```bash
51
- BRANDDRIVE_API_KEY=your-api-key
52
- BRANDDRIVE_BASE_URL=https://api.branddrive.com
53
- ```
54
-
55
- Copy `.env.example` to `.env` for local development. `.env` is ignored by Git.
56
-
57
- ## Quick start
58
-
59
- ```python
60
- from branddrive import BrandDriveClient
61
- from branddrive.dataclasses import CustomerData
62
-
63
- with BrandDriveClient() as client:
64
- customer = CustomerData(
65
- first_name="Amina",
66
- branch_id=2,
67
- birth_day=3,
68
- birth_month=6,
69
- email="amina@example.com",
70
- )
71
- created = client.customers.create_customer(customer)
72
- print(created)
73
- ```
74
-
75
- Credentials can also be supplied explicitly:
76
-
77
- ```python
78
- client = BrandDriveClient(
79
- api_key="your-api-key",
80
- base_url="https://api.branddrive.com",
81
- timeout=10,
82
- max_retries=3,
83
- )
84
- ```
85
-
86
- Always close a client that is not used as a context manager:
87
-
88
- ```python
89
- client.close()
90
- ```
91
-
92
- ## Resources
93
-
94
- - `client.customers`
95
- - `client.invoices`
96
- - `client.products`
97
- - `client.pos`
98
- - `client.services`
99
- - `client.vendors`
100
- - `client.purchase_orders`
101
- - `client.expenses`
102
- - `client.wallets`
103
- - `client.payment_links`
104
- - `client.analytics`
105
-
106
- Payload dataclasses are available under `branddrive.dataclasses`, for example
107
- `from branddrive.dataclasses import CustomerData`.
108
-
109
- ## Error handling
110
-
111
- ```python
112
- from branddrive.exceptions import APIException
113
-
114
- try:
115
- client.customers.list_cusotmers(limit=10)
116
- except APIException as exc:
117
- print(exc.status_code, exc.request_id, exc)
118
- ```
119
-
120
- API methods return decoded JSON dictionaries. Export and download methods may
121
- return `bytes`.
122
-
123
- ## Development
124
-
125
- ```bash
126
- python -m pytest
127
- python -m build
128
- ```
129
-
130
- The build produces an installable wheel and source distribution in `dist/`.
131
-
132
- See [deployment notes](docs/deployment.md) and [API usage](docs/api.md).
@@ -1,112 +0,0 @@
1
- # BrandDrive Python SDK
2
-
3
- A Python client for BrandDrive business resources, including customers, products,
4
- invoices, POS, services, vendors, purchase orders, expenses, wallets, payment
5
- links, and analytics.
6
-
7
- ## Requirements
8
-
9
- - Python 3.12 or newer
10
- - A BrandDrive API key
11
-
12
- ## Installation
13
-
14
- Install the package from the repository:
15
-
16
- ```bash
17
- python -m pip install .
18
- ```
19
-
20
- For local development:
21
-
22
- ```bash
23
- python -m pip install -e ".[dev]"
24
- ```
25
-
26
- ## Configuration
27
-
28
- Set credentials in environment variables or pass them directly:
29
-
30
- ```bash
31
- BRANDDRIVE_API_KEY=your-api-key
32
- BRANDDRIVE_BASE_URL=https://api.branddrive.com
33
- ```
34
-
35
- Copy `.env.example` to `.env` for local development. `.env` is ignored by Git.
36
-
37
- ## Quick start
38
-
39
- ```python
40
- from branddrive import BrandDriveClient
41
- from branddrive.dataclasses import CustomerData
42
-
43
- with BrandDriveClient() as client:
44
- customer = CustomerData(
45
- first_name="Amina",
46
- branch_id=2,
47
- birth_day=3,
48
- birth_month=6,
49
- email="amina@example.com",
50
- )
51
- created = client.customers.create_customer(customer)
52
- print(created)
53
- ```
54
-
55
- Credentials can also be supplied explicitly:
56
-
57
- ```python
58
- client = BrandDriveClient(
59
- api_key="your-api-key",
60
- base_url="https://api.branddrive.com",
61
- timeout=10,
62
- max_retries=3,
63
- )
64
- ```
65
-
66
- Always close a client that is not used as a context manager:
67
-
68
- ```python
69
- client.close()
70
- ```
71
-
72
- ## Resources
73
-
74
- - `client.customers`
75
- - `client.invoices`
76
- - `client.products`
77
- - `client.pos`
78
- - `client.services`
79
- - `client.vendors`
80
- - `client.purchase_orders`
81
- - `client.expenses`
82
- - `client.wallets`
83
- - `client.payment_links`
84
- - `client.analytics`
85
-
86
- Payload dataclasses are available under `branddrive.dataclasses`, for example
87
- `from branddrive.dataclasses import CustomerData`.
88
-
89
- ## Error handling
90
-
91
- ```python
92
- from branddrive.exceptions import APIException
93
-
94
- try:
95
- client.customers.list_cusotmers(limit=10)
96
- except APIException as exc:
97
- print(exc.status_code, exc.request_id, exc)
98
- ```
99
-
100
- API methods return decoded JSON dictionaries. Export and download methods may
101
- return `bytes`.
102
-
103
- ## Development
104
-
105
- ```bash
106
- python -m pytest
107
- python -m build
108
- ```
109
-
110
- The build produces an installable wheel and source distribution in `dist/`.
111
-
112
- See [deployment notes](docs/deployment.md) and [API usage](docs/api.md).
@@ -1,132 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: branddrive-python-sdk
3
- Version: 0.1.0
4
- Summary: Official Python SDK for the BrandDrive API
5
- Author: Ogenna Israel
6
- License-Expression: LicenseRef-Proprietary
7
- Keywords: branddrive,sdk,api,business
8
- Classifier: Development Status :: 4 - Beta
9
- Classifier: Intended Audience :: Developers
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.12
12
- Classifier: Programming Language :: Python :: 3.13
13
- Requires-Python: >=3.12
14
- Description-Content-Type: text/markdown
15
- Requires-Dist: httpx>=0.29.0
16
- Requires-Dist: python-dotenv>=1.0.0
17
- Provides-Extra: dev
18
- Requires-Dist: build>=1.2; extra == "dev"
19
- Requires-Dist: pytest>=9.2.0; extra == "dev"
20
-
21
- # BrandDrive Python SDK
22
-
23
- A Python client for BrandDrive business resources, including customers, products,
24
- invoices, POS, services, vendors, purchase orders, expenses, wallets, payment
25
- links, and analytics.
26
-
27
- ## Requirements
28
-
29
- - Python 3.12 or newer
30
- - A BrandDrive API key
31
-
32
- ## Installation
33
-
34
- Install the package from the repository:
35
-
36
- ```bash
37
- python -m pip install .
38
- ```
39
-
40
- For local development:
41
-
42
- ```bash
43
- python -m pip install -e ".[dev]"
44
- ```
45
-
46
- ## Configuration
47
-
48
- Set credentials in environment variables or pass them directly:
49
-
50
- ```bash
51
- BRANDDRIVE_API_KEY=your-api-key
52
- BRANDDRIVE_BASE_URL=https://api.branddrive.com
53
- ```
54
-
55
- Copy `.env.example` to `.env` for local development. `.env` is ignored by Git.
56
-
57
- ## Quick start
58
-
59
- ```python
60
- from branddrive import BrandDriveClient
61
- from branddrive.dataclasses import CustomerData
62
-
63
- with BrandDriveClient() as client:
64
- customer = CustomerData(
65
- first_name="Amina",
66
- branch_id=2,
67
- birth_day=3,
68
- birth_month=6,
69
- email="amina@example.com",
70
- )
71
- created = client.customers.create_customer(customer)
72
- print(created)
73
- ```
74
-
75
- Credentials can also be supplied explicitly:
76
-
77
- ```python
78
- client = BrandDriveClient(
79
- api_key="your-api-key",
80
- base_url="https://api.branddrive.com",
81
- timeout=10,
82
- max_retries=3,
83
- )
84
- ```
85
-
86
- Always close a client that is not used as a context manager:
87
-
88
- ```python
89
- client.close()
90
- ```
91
-
92
- ## Resources
93
-
94
- - `client.customers`
95
- - `client.invoices`
96
- - `client.products`
97
- - `client.pos`
98
- - `client.services`
99
- - `client.vendors`
100
- - `client.purchase_orders`
101
- - `client.expenses`
102
- - `client.wallets`
103
- - `client.payment_links`
104
- - `client.analytics`
105
-
106
- Payload dataclasses are available under `branddrive.dataclasses`, for example
107
- `from branddrive.dataclasses import CustomerData`.
108
-
109
- ## Error handling
110
-
111
- ```python
112
- from branddrive.exceptions import APIException
113
-
114
- try:
115
- client.customers.list_cusotmers(limit=10)
116
- except APIException as exc:
117
- print(exc.status_code, exc.request_id, exc)
118
- ```
119
-
120
- API methods return decoded JSON dictionaries. Export and download methods may
121
- return `bytes`.
122
-
123
- ## Development
124
-
125
- ```bash
126
- python -m pytest
127
- python -m build
128
- ```
129
-
130
- The build produces an installable wheel and source distribution in `dist/`.
131
-
132
- See [deployment notes](docs/deployment.md) and [API usage](docs/api.md).