Skip to content

bsubio/bsubio-go

Repository files navigation

Go SDK for bsub.io (BETA)

[we're early project; anything here can change withtout a warning until we push v1]

Official Golang SDK for the BSUB.IO API.

You can use it to build Golang apps for data processing.

Features

  • Simple API: Easy-to-use client with helper methods for common workflows
  • Type-safe: Generated from OpenAPI spec with full type safety
  • Complete: Access to all BSUB.IO API endpoints
  • Flexible: Use high-level helpers or low-level API methods

Installation

    go get github.com/bsubio/bsubio-go

Quick Start

Getting an API Key

Our CLI will create you ~/.config/bsubio/config.json automatically. Visit https://www.bsub.io and follow the installation steps to get bsubio to work for you. Then bsubio register should give you new account with API key created.

Simple Example

package main

import (
    "context"
    "fmt"
    "log"

    "github.com/bsubio/bsubio-go"
)

func main() {
    // Load configuration (reads from ~/.config/bsubio/config.json or BSUBIO_API_KEY env var)
    config := bsubio.LoadConfig()

    // Create client
    client, err := bsubio.NewBsubClient(config)
    if err != nil {
        log.Fatal(err)
    }

    ctx := context.Background()

    // Process a file (one-liner)
    result, err := client.ProcessFile(ctx, "pandoc_md", "document.pdf")
    if err != nil {
        log.Fatal(err)
    }

    fmt.Printf("Job completed: %s\n", *result.Job.Id)
    fmt.Printf("Output: %s\n", string(result.Output))
}

For more examples, see examples/ directory:

You should be able to build them all by:

make ex

Binaries will be in bin/.

Development

You must have Go 1.24+ installed. Most Linux/macOS distributions have this. Go to https://go.dev/doc/install to learn more. You need OpenAPI compiler: https://github.com/oapi-codegen/oapi-codegen

Then:

make
make test

This SDK is based on bsubio.io OpenAPI specification available at:

https://app.bsub.io/static/openapi.yaml

License

MIT

Support

About

bsub.io Golang SDK

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •