Skip to main content

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 Boards

Get All Boards

response = client.get_boards()

Get a Single Board

response = client.get_board("board_id")
board = response.payload["board"]

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

  1. Create and activate a virtual environment:
python3 -m venv venv
source venv/bin/activate  # On Windows use: venv\Scripts\activate
  1. Install the package in development mode:
pip install -e .

Testing

Setup

  1. Install test dependencies:
pip install pytest pytest-mock python-dotenv
  1. Create a .env file 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:

  1. 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
  1. 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
  1. Test both success and error cases
  2. 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

  1. Fork the repository
  2. Create a feature branch
  3. Write tests for your changes
  4. Ensure all tests pass
  5. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vaiz_sdk-0.1.0.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vaiz_sdk-0.1.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file vaiz_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: vaiz_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for vaiz_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3a8da79f146b677c02f8468773571c0c486981b79087db295d943a1972857347
MD5 6bb0ddb1f0071dbc2e67e7831b79ac2c
BLAKE2b-256 7a711370d6918818cbfc3f9a5f12505636f45e18362692284ecde63936005004

See more details on using hashes here.

File details

Details for the file vaiz_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: vaiz_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for vaiz_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 676273136e603c27c22048f1f54e3963ef435b44bd80aaac0597c6781072772b
MD5 b2f6b633af5f663841b0cb5c3be4d68e
BLAKE2b-256 54c45bd0107cde1b1f3030518864c2b2a842900f3112b4fefe95aa7d7fd1f248

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page