SDKs overview

Bruzu provides Software Development Kits (SDKs) and client libraries designed to facilitate interaction with its Dynamic Image API and Video API. These SDKs abstract much of the HTTP request and response handling, allowing developers to focus on integrating dynamic image and video generation capabilities into their applications. The primary function of Bruzu SDKs is to enable the creation of personalized visuals, such as marketing images, e-commerce product shots, and social media content, based on pre-defined templates.

The SDKs are developed and maintained by Bruzu to ensure compatibility with the latest API versions and features. They typically include methods for authenticating API requests, managing image templates, passing dynamic data to generate images, and retrieving the URLs of the generated assets. Bruzu's approach to dynamic image generation often involves defining templates using its online editor, then programmatically populating these templates with data via the API.

Developers can choose from a range of official SDKs that support various programming languages, enabling integration into diverse technology stacks. The consistent API design across languages aims to provide a unified developer experience, as noted in their developer experience documentation.

Official SDKs by language

Bruzu offers official SDKs for several popular programming languages, each designed to provide a native development experience. These SDKs are maintained by Bruzu and are the recommended method for integrating with the API. The following table outlines the available official SDKs, their package names, and typical installation commands.

Language Package/Library Name Maturity
Node.js @bruzu/sdk (npm) Stable
Python bruzu-python-sdk (PyPI) Stable
PHP bruzu/php-sdk (Packagist) Stable
Ruby bruzu-ruby (RubyGems) Stable
Java com.bruzu:bruzu-java-sdk (Maven) Stable
Go github.com/bruzu/bruzu-go-sdk Stable

Each SDK is designed to encapsulate the API's best practices, including authentication, error handling, and data serialization. For detailed API methods and parameters, developers should consult the official Bruzu API reference documentation.

Installation

Installing Bruzu SDKs is typically performed using the standard package manager for each respective programming language. Below are the common installation commands for the officially supported SDKs.

Node.js

To install the Node.js SDK, use npm:

npm install @bruzu/sdk

Or with yarn:

yarn add @bruzu/sdk

Python

For Python, install via pip:

pip install bruzu-python-sdk

PHP

PHP developers can install the SDK using Composer:

composer require bruzu/php-sdk

Ruby

Install the Ruby gem using Bundler or directly with gem:

gem install bruzu-ruby

Or add to your Gemfile:

gem 'bruzu-ruby'

Java

For Java projects, include the Maven dependency in your pom.xml:

<dependency>
    <groupId>com.bruzu</groupId>
    <artifactId>bruzu-java-sdk</artifactId>
    <version>1.0.0</version> <!-- Use the latest version -->
</dependency>

Or for Gradle, add to your build.gradle:

implementation 'com.bruzu:bruzu-java-sdk:1.0.0' // Use the latest version

Go

Go developers can retrieve the SDK using go get:

go get github.com/bruzu/bruzu-go-sdk

Always refer to the official Bruzu documentation for the most current installation instructions and specific version requirements.

Quickstart example

This quickstart example demonstrates how to use the Bruzu Node.js SDK to generate a dynamic image from a template. This example assumes you have a Bruzu template ID (e.g., 'your-template-id') and your API key.

First, ensure you have installed the Node.js SDK as described in the Installation section.

const Bruzu = require('@bruzu/sdk');

const BRUZU_API_KEY = process.env.BRUZU_API_KEY || 'YOUR_BRUZU_API_KEY'; // Replace with your actual Bruzu API Key
const BRUZU_TEMPLATE_ID = 'your-template-id'; // Replace with your actual Bruzu Template ID

const bruzu = new Bruzu({ apiKey: BRUZU_API_KEY });

async function generateDynamicImage() {
  try {
    const response = await bruzu.images.create({
      templateId: BRUZU_TEMPLATE_ID,
      data: {
        title: 'New Product Launch!',
        subtitle: 'Limited Time Offer',
        buttonText: 'Shop Now',
        image: 'https://example.com/product-image.jpg'
      },
      format: 'png' // or 'jpeg', 'webp', 'pdf'
    });

    console.log('Dynamic image generated successfully:');
    console.log('Image URL:', response.url);
    console.log('Preview URL:', response.preview_url);
  } catch (error) {
    console.error('Error generating dynamic image:', error.message);
    if (error.response) {
      console.error('API Response Data:', error.response.data);
    }
  }
}

generateDynamicImage();

In this example:

  • An instance of the Bruzu SDK is initialized with your API key. For security, API keys should be loaded from environment variables rather than hardcoded.
  • The images.create method is called with the template ID and a data object. This data object contains key-value pairs that correspond to the dynamic fields defined in your Bruzu template.
  • The desired output format (e.g., 'png') is specified.
  • Upon successful generation, the response will include a url to the final image and a preview_url.

This demonstrates a fundamental interaction with the Bruzu API for image generation. More complex operations, such as managing video templates or incorporating advanced effects, are also supported through the SDKs, as detailed in the comprehensive Bruzu developer documentation. For general API client best practices, consult resources like the Google API Client Library guide on performance.

Community libraries

While Bruzu provides official SDKs for major programming languages, the open nature of RESTful APIs means that community-contributed libraries may also exist. These libraries are typically developed and maintained independently by developers who find a need for an SDK in a language not officially supported, or who wish to implement specific features or wrappers.

As of the current date, Bruzu primarily promotes its official SDKs. Information about community-maintained libraries is best sourced from public code repositories like GitHub or relevant developer forums. Users considering community-developed libraries should evaluate their maintenance status, community support, and alignment with the official API specification. For the most reliable and up-to-date integration, the official Bruzu SDKs are always recommended.