Skip to main content

BriskStack Platform API

Project description

BriskStack Platform SDK (Python)

Official Python SDK for the BriskStack Platform. Access all BriskStack services through a single unified SDK.

PyPI version License: MIT Python Versions

Installation

pip install briskstack-platform-sdk

Or with poetry:

poetry add briskstack-platform-sdk

Or with pipenv:

pipenv install briskstack-platform-sdk

Quick Start

from briskstack_platform_sdk import (
    Configuration,
    ApiClient,
    HelloWorldMessagesApi,
    AiGatewayChatApi
)

# Configure once for all services
config = Configuration(
    host='https://api.briskstack.com',
    access_token='your-jwt-token'
)

client = ApiClient(config)

# Use different services
hello_world_api = HelloWorldMessagesApi(client)
message = hello_world_api.hello_world_v1_messages_post(
    hello_world_create_message_request={'content': 'Hello!'}
)

ai_gateway_api = AiGatewayChatApi(client)
completion = ai_gateway_api.ai_gateway_v1_chat_completions_post(
    ai_gateway_chat_completion_request={
        'model': 'gpt-4',
        'messages': [{'role': 'user', 'content': 'Hello AI'}]
    }
)

Features

  • 🚀 Unified SDK - Access all BriskStack services through a single package
  • 🔐 Multiple Auth Methods - Support for JWT tokens and API keys
  • 🌐 Environment URLs - Predefined configs for dev, staging, and production
  • 📝 Type Hints - Full type annotations for better IDE support
  • 🔄 Auto-generated - Always up-to-date with the latest API changes
  • 🐍 Python 3.8+ - Modern Python support

Authentication

Bearer Token (JWT)

For user authentication via Supabase:

from briskstack_platform_sdk import Configuration, ApiClient

config = Configuration(
    host='https://api.briskstack.com',
    access_token='your-jwt-token'
)

client = ApiClient(config)

API Key

For BYOK (Bring Your Own Key) scenarios:

from briskstack_platform_sdk import Configuration, ApiClient

config = Configuration(
    host='https://api.briskstack.com',
    api_key={'X-API-Key': 'your-api-key'}
)

client = ApiClient(config)

Environment URLs

The SDK supports multiple environments:

# Development
config = Configuration(
    host='https://api-dev.briskstack.com',
    access_token='your-token'
)

# Staging
config = Configuration(
    host='https://api-staging.briskstack.com',
    access_token='your-token'
)

# Production
config = Configuration(
    host='https://api.briskstack.com',
    access_token='your-token'
)

Available Services

This SDK includes all BriskStack platform services:

  • Hello World - Example service
  • AI Gateway - AI model integrations
  • (More services added automatically)

See the API documentation for complete service details.

Usage Examples

Hello World Service

from briskstack_platform_sdk import Configuration, ApiClient, HelloWorldMessagesApi

config = Configuration(
    host='https://api.briskstack.com',
    access_token='your-jwt-token'
)

client = ApiClient(config)
api = HelloWorldMessagesApi(client)

# Create a message
message = api.hello_world_v1_messages_post(
    hello_world_create_message_request={
        'content': 'Hello, World!'
    }
)

print(message.id, message.content)

AI Gateway Service

from briskstack_platform_sdk import Configuration, ApiClient, AiGatewayChatApi

config = Configuration(
    host='https://api.briskstack.com',
    api_key={'X-API-Key': 'your-api-key'}  # Use API key for BYOK
)

client = ApiClient(config)
api = AiGatewayChatApi(client)

# Create a chat completion
completion = api.ai_gateway_v1_chat_completions_post(
    ai_gateway_chat_completion_request={
        'model': 'gpt-4',
        'messages': [
            {'role': 'system', 'content': 'You are a helpful assistant.'},
            {'role': 'user', 'content': 'Tell me a joke about programming.'}
        ]
    }
)

print(completion.choices[0].message.content)

Error Handling

from briskstack_platform_sdk.exceptions import ApiException

try:
    message = api.hello_world_v1_messages_post(
        hello_world_create_message_request={'content': 'Hello!'}
    )
except ApiException as e:
    print(f"Error: {e.status} {e.reason}")
    print(f"Response body: {e.body}")

Async Support

The SDK supports asynchronous operations:

import asyncio
from briskstack_platform_sdk import Configuration, ApiClient, HelloWorldMessagesApi

async def main():
    config = Configuration(
        host='https://api.briskstack.com',
        access_token='your-jwt-token'
    )

    async with ApiClient(config) as client:
        api = HelloWorldMessagesApi(client)
        message = await api.hello_world_v1_messages_post(
            hello_world_create_message_request={'content': 'Hello!'}
        )
        print(message.content)

asyncio.run(main())

Type Hints

This SDK provides full type annotations:

from typing import Dict, Any
from briskstack_platform_sdk import (
    Configuration,
    ApiClient,
    HelloWorldMessagesApi,
    HelloWorldMessage,
    HelloWorldCreateMessageRequest
)

config: Configuration = Configuration(
    host='https://api.briskstack.com',
    access_token='your-jwt-token'
)

request: Dict[str, Any] = {
    'content': 'Hello!',
    'metadata': {'key': 'value'}
}

message: HelloWorldMessage = api.hello_world_v1_messages_post(
    hello_world_create_message_request=request
)

Framework Integration

FastAPI

from fastapi import FastAPI, Header
from briskstack_platform_sdk import Configuration, ApiClient, HelloWorldMessagesApi

app = FastAPI()

@app.post("/api/hello")
async def create_message(
    content: str,
    authorization: str = Header(...)
):
    config = Configuration(
        host="https://api.briskstack.com",
        access_token=authorization.replace("Bearer ", "")
    )

    async with ApiClient(config) as client:
        api = HelloWorldMessagesApi(client)
        message = await api.hello_world_v1_messages_post(
            hello_world_create_message_request={'content': content}
        )
        return message.to_dict()

Flask

from flask import Flask, request, jsonify
from briskstack_platform_sdk import Configuration, ApiClient, HelloWorldMessagesApi

app = Flask(__name__)

@app.route('/api/hello', methods=['POST'])
def create_message():
    config = Configuration(
        host="https://api.briskstack.com",
        access_token=request.headers.get('Authorization', '').replace('Bearer ', '')
    )

    with ApiClient(config) as client:
        api = HelloWorldMessagesApi(client)
        message = api.hello_world_v1_messages_post(
            hello_world_create_message_request=request.json
        )
        return jsonify(message.to_dict())

Django

from django.http import JsonResponse
from briskstack_platform_sdk import Configuration, ApiClient, HelloWorldMessagesApi
import json

def create_message(request):
    if request.method == 'POST':
        config = Configuration(
            host="https://api.briskstack.com",
            access_token=request.META.get('HTTP_AUTHORIZATION', '').replace('Bearer ', '')
        )

        with ApiClient(config) as client:
            api = HelloWorldMessagesApi(client)
            data = json.loads(request.body)
            message = api.hello_world_v1_messages_post(
                hello_world_create_message_request=data
            )
            return JsonResponse(message.to_dict())

Environment Variables

Best practice is to use environment variables for configuration:

import os
from briskstack_platform_sdk import Configuration, ApiClient

config = Configuration(
    host=os.getenv('BRISKSTACK_API_URL', 'https://api.briskstack.com'),
    access_token=os.getenv('BRISKSTACK_ACCESS_TOKEN')
)

client = ApiClient(config)

Requirements

  • Python 3.8+
  • urllib3 >= 1.25.3
  • python-dateutil

Contributing

This SDK is automatically generated from OpenAPI specifications. To contribute:

  1. Make changes to the platform services in briskstack-platform
  2. The SDK will be automatically regenerated and published

Documentation

License

MIT

Support

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

briskstackplatform-0.0.5.tar.gz (34.8 kB view details)

Uploaded Source

Built Distribution

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

briskstackplatform-0.0.5-py3-none-any.whl (58.3 kB view details)

Uploaded Python 3

File details

Details for the file briskstackplatform-0.0.5.tar.gz.

File metadata

  • Download URL: briskstackplatform-0.0.5.tar.gz
  • Upload date:
  • Size: 34.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for briskstackplatform-0.0.5.tar.gz
Algorithm Hash digest
SHA256 7af346c1536329e1a727f2db3b1f6e49f35fca0f8bde4d69b110e58541d7e420
MD5 35d66d525193d58ff350573fa937d745
BLAKE2b-256 e07a18d422b2cf8c31237076fe8cbc6b2d46c8b723bf7bf1ef1b73d49723df3b

See more details on using hashes here.

Provenance

The following attestation bundles were made for briskstackplatform-0.0.5.tar.gz:

Publisher: publish.yml on BriskStack/platform-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file briskstackplatform-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for briskstackplatform-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 66a5e0c730ab2d76060f28a722c842cbecb2a659feb478552a1ec9f8bd1f987e
MD5 2a33ebbe66de6f63c3f2cb114b7a53ab
BLAKE2b-256 b2e61bb47f08ff73e7f0d08b6ed3c3b641f3eca006260d452e98eab372255f0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for briskstackplatform-0.0.5-py3-none-any.whl:

Publisher: publish.yml on BriskStack/platform-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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