Official SDK for interacting with the Vaiz API
Project description
Vaiz SDK for Python
Python SDK for accessing the Vaiz platform.
Installation
pip install vaiz-sdk
Usage
Basic Setup
First, you need to set up your environment variables. Create a .env file in your project root with the following variables:
VAIZ_API_KEY=your_api_key
VAIZ_SPACE_ID=your_space_id
Creating a Client
from vaiz import VaizClient
client = VaizClient(
api_key="your_api_key",
space_id="your_space_id",
verify_ssl=False, # Set to True in production
base_url="https://api.vaiz.local:10000/v4" # Use appropriate base URL for your environment
)
Working with Projects
Get All Projects
response = client.get_projects()
Working with Boards
Get All Boards
response = client.get_boards()
Get a Single Board
response = client.get_board("board_id")
board = response.payload["board"]
Create a Board Type
from vaiz.models import CreateBoardTypeRequest
request = CreateBoardTypeRequest(
boardId="board_id",
label="New Type",
icon="Cursor",
color="silver"
)
response = client.create_board_type(request)
board_type = response.board_type
Edit a Board Type
from vaiz.models import EditBoardTypeRequest
request = EditBoardTypeRequest(
boardTypeId="board_type_id",
boardId="board_id",
label="Updated Type",
icon="Cursor",
color="silver",
description="Updated description",
hidden=True
)
response = client.edit_board_type(request)
board_type = response.board_type
Create a Board Custom Field
from vaiz import VaizClient, CreateBoardCustomFieldRequest, CustomFieldType
client = VaizClient(api_key="your-api-key", space_id="your-space-id")
# Create a new custom field
request = CreateBoardCustomFieldRequest(
name="Date",
type=CustomFieldType.DATE,
boardId="your-board-id",
description="Date field for tracking deadlines",
hidden=False
)
response = client.create_board_custom_field(request)
custom_field = response.custom_field
print(f"Created custom field: {custom_field.name} (ID: {custom_field.id})")
Edit a Board Custom Field
from vaiz import VaizClient, EditBoardCustomFieldRequest
client = VaizClient(api_key="your-api-key", space_id="your-space-id")
# Edit an existing custom field
request = EditBoardCustomFieldRequest(
fieldId="your-field-id",
boardId="your-board-id",
hidden=True,
description="Updated field description"
)
response = client.edit_board_custom_field(request)
custom_field = response.custom_field
print(f"Updated custom field: {custom_field.name} (ID: {custom_field.id})")
print(f"Hidden: {custom_field.hidden}")
print(f"Description: {custom_field.description}")
Available custom field types:
CustomFieldType.TEXT- Text fieldCustomFieldType.NUMBER- Number fieldCustomFieldType.CHECKBOX- Checkbox fieldCustomFieldType.DATE- Date fieldCustomFieldType.MEMBER- Member fieldCustomFieldType.TASK_RELATIONS- Task relations fieldCustomFieldType.SELECT- Select field
Working with Profile
Get User Profile
response = client.get_profile()
profile = response.payload["profile"]
Working with Tasks
Create a Task
from vaiz.models import CreateTaskRequest, TaskPriority
task = CreateTaskRequest(
name="My Task",
group="group_id",
board="board_id",
project="project_id",
priority=TaskPriority.High,
completed=False,
types=["type_id"],
subtasks=[],
milestones=[],
rightConnectors=[],
leftConnectors=[]
)
response = client.create_task(task)
Edit a Task
from vaiz.models import EditTaskRequest
edit_task = EditTaskRequest(
taskId="task_id",
name="Updated Task Name",
assignees=["assignee_id"]
)
response = client.edit_task(edit_task)
Get Task Information
response = client.get_task("task_id")
Development
Setting Up Development Environment
- Create and activate a virtual environment:
python3 -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate
- Install the package in development mode:
pip install -e .
Testing
Setup
- Install test dependencies:
pip install pytest pytest-mock python-dotenv
- Create a
.envfile in the project root with your test credentials:
VAIZ_API_KEY=your_test_api_key
VAIZ_SPACE_ID=your_test_space_id
The test configuration (tests/test_config.py) will automatically load these credentials.
Running Tests
Run all tests:
PYTHONPATH=. pytest
Run specific test file:
PYTHONPATH=. pytest tests/test_client.py
Run with verbose output:
PYTHONPATH=. pytest -v
Note: Setting PYTHONPATH=. is required to ensure Python can find the package modules during testing.
Writing Tests
When writing tests for the SDK:
- Use the test configuration from
tests/test_config.py:
from tests.test_config import get_test_client, TEST_BOARD_ID, TEST_GROUP_ID
def test_create_task(mocker):
client = get_test_client()
# Your test code here
- Mock external API calls using
pytest-mock:
def test_create_task(mocker):
# Mock the API response
mock_response = mocker.Mock()
mock_response.json.return_value = {
"type": "success",
"payload": {"task": {"_id": "test_task_id"}}
}
mocker.patch('requests.post', return_value=mock_response)
# Test implementation
client = get_test_client()
# ... rest of the test
- Test both success and error cases
- Include proper assertions for response data
Examples
The examples/ directory contains working examples of SDK usage. You can run any example using the following command:
python -m examples.<example_file_name>
Contributing
- Fork the repository
- Create a feature branch
- Write tests for your changes
- Ensure all tests pass
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vaiz_sdk-0.1.6.tar.gz.
File metadata
- Download URL: vaiz_sdk-0.1.6.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2dcd1ad61bd7046a555e2c06bfaa6246c238ef2eb4829b4b505cb066ee5ec43a
|
|
| MD5 |
36b3f4d1eac79de1aa0fc18c229cb0ae
|
|
| BLAKE2b-256 |
d9c3c47ac0a87af2f8ff79e0357c6eff16e65d5c9ea4eb6b0048accc4131ec23
|
File details
Details for the file vaiz_sdk-0.1.6-py3-none-any.whl.
File metadata
- Download URL: vaiz_sdk-0.1.6-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7481378f819eb62b29f939564883bf7639cabf6b5ffc9428f6f6054545b55ba3
|
|
| MD5 |
26c1d4bb63d68f7eb3bcf175dd777394
|
|
| BLAKE2b-256 |
cccf564ce8f3f6bccce7cbc3e21e910aedf1261922861763f037cde82bf24a5a
|