Skip to content

Commit dae8ffd

Browse files
author
AJ
committed
docs: simplify setup and add practical usage examples
1 parent fc718ca commit dae8ffd

1 file changed

Lines changed: 114 additions & 39 deletions

File tree

README.md

Lines changed: 114 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,142 @@
1-
# bild-python
1+
# Bild-Python
22

3-
Python SDK for the Bild External API.
3+
Python library for interacting with the Bild External API.
44

5-
## Install
5+
> This repo is currently intended to be used directly from source (not from PyPI yet).
6+
7+
## 1) Clone and set up
8+
9+
```bash
10+
git clone https://github.com/AJFrio/Bild-Python.git
11+
cd Bild-Python
12+
python3 -m venv .venv
13+
source .venv/bin/activate
14+
pip install requests
15+
```
16+
17+
## 2) Set your API token
618

719
```bash
8-
pip install -e .
20+
export BILD_API_KEY="YOUR_JWT_TOKEN"
921
```
1022

11-
## Quick start
23+
Or pass token directly in code.
24+
25+
## 3) Basic usage
1226

1327
```python
1428
from bild import BildClient
1529

16-
client = BildClient(token="YOUR_JWT_TOKEN")
30+
client = BildClient() # uses BILD_API_KEY from env
31+
# or: client = BildClient(token="YOUR_JWT_TOKEN")
32+
1733
projects = client.api.projects.list()
34+
print(projects)
35+
```
36+
37+
---
38+
39+
## Common examples
40+
41+
### List users and projects
42+
43+
```python
44+
from bild import BildClient
45+
46+
client = BildClient()
47+
1848
users = client.api.users.list()
49+
projects = client.api.projects.list()
50+
51+
print("Users:", users)
52+
print("Projects:", projects)
1953
```
2054

21-
Or set `BILD_API_KEY`.
55+
### Add users to your account
2256

23-
## Base URL
57+
```python
58+
client.api.users.add(
59+
emails=["person@example.com"],
60+
role="Member",
61+
projects=[{"id": "project-id", "projectAccess": "Editor"}]
62+
)
63+
```
2464

25-
Default: `https://api.portle.io/api`
65+
### List files in a project
2666

2767
```python
28-
client = BildClient(token="...", base_url="https://api.portle.io/api")
68+
files = client.api.files.list("project-id")
69+
print(files)
2970
```
3071

31-
## Resource coverage
32-
33-
- `api.users`
34-
- `api.projects`
35-
- `api.project_users`
36-
- `api.branches_commits`
37-
- `api.files`
38-
- `api.file_upload`
39-
- `api.file_checkin_checkout`
40-
- `api.shared_links`
41-
- `api.files_move_delete`
42-
- `api.files_metadata`
43-
- `api.feedback_items`
44-
- `api.packages`
45-
- `api.revisions`
46-
- `api.approvals`
47-
- `api.boms`
48-
- `api.search`
49-
50-
## Escape hatch
72+
### Convert a file to STL (auto-default branch + latest version)
5173

5274
```python
53-
client.get("projects")
54-
client.post("custom/path", json={"x": 1})
75+
result = client.api.files.universal_format(
76+
project_id="project-id",
77+
branch_id=None, # auto-resolves main/default branch
78+
file_id="file-id",
79+
file_version=None, # auto-resolves latest file version
80+
output_format="stl"
81+
)
82+
print(result)
5583
```
5684

57-
## Smart defaults
85+
### Shared links
86+
87+
```python
88+
links = client.api.shared_links.list("project-id")
89+
print(links)
90+
91+
new_link = client.api.shared_links.create("project-id", {
92+
"name": "Review Link",
93+
"fileIds": ["file-id"]
94+
})
95+
print(new_link)
96+
```
97+
98+
### Search
99+
100+
```python
101+
search_result = client.api.search.query({"query": "bolt"})
102+
print(search_result)
103+
```
58104

59-
For methods that require `branch_id` and/or `file_version`, you can pass `None` and the SDK will auto-resolve:
105+
---
60106

61-
- default branch: prefers `isMain`/`isDefault`, then `main`/`master`, then first branch
62-
- file version: resolves from `latestFileVersion`
107+
## API groups available
63108

64-
## Notes
109+
- `client.api.users`
110+
- `client.api.projects`
111+
- `client.api.project_users`
112+
- `client.api.branches_commits`
113+
- `client.api.files`
114+
- `client.api.file_upload`
115+
- `client.api.file_checkin_checkout`
116+
- `client.api.shared_links`
117+
- `client.api.files_move_delete`
118+
- `client.api.files_metadata`
119+
- `client.api.feedback_items`
120+
- `client.api.packages`
121+
- `client.api.revisions`
122+
- `client.api.approvals`
123+
- `client.api.boms`
124+
- `client.api.search`
65125

66-
The SDK is intentionally modular and easy to extend.
67-
If a tenant/version uses slightly different route names, use low-level methods and add/adjust a resource method quickly.
126+
---
127+
128+
## Advanced: custom base URL
129+
130+
```python
131+
client = BildClient(
132+
token="YOUR_JWT_TOKEN",
133+
base_url="https://api.portle.io/api"
134+
)
135+
```
136+
137+
## Escape hatch for unwrapped endpoints
138+
139+
```python
140+
raw = client.get("projects")
141+
print(raw)
142+
```

0 commit comments

Comments
 (0)