qbcli

module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2025 License: MIT

README

qbcli - QuickBooks Online CLI

A command-line interface and Go SDK for managing QuickBooks Online accounts.

Overview

This project provides two main components:

  1. Go SDK (pkg/qbo) - A complete Go library for the QuickBooks Online API
  2. CLI Tool (qbcli) - A command-line interface built on the SDK

Features

  • OAuth2 authentication with automatic token refresh
  • Full CRUD operations for QuickBooks entities
  • Type-safe query builder
  • Multiple output formats (table, JSON, YAML, CSV)
  • Shell completion (bash, zsh, fish, powershell)
  • Batch operations support
  • Report generation

Requirements

  • Go 1.21 or later
  • QuickBooks Online developer account
  • OAuth2 credentials (Client ID and Client Secret)

Installation

From Source
git clone https://github.com/obay/qbcli.git
cd qbcli
make build
Go Install
go install github.com/obay/qbcli/cmd/qbcli@latest

Quick Start

1. Configure Credentials
qbcli config init
qbcli config set client_id YOUR_CLIENT_ID
qbcli config set client_secret YOUR_CLIENT_SECRET
2. Authenticate
qbcli auth login
3. Use the CLI
# List customers
qbcli customer list

# Get a specific invoice
qbcli invoice get 123

# Create a customer from JSON
qbcli customer create --from-file customer.json

# Generate a report
qbcli report profit-loss --start-date 2024-01-01 --end-date 2024-12-31

SDK Usage

package main

import (
    "context"
    "log"

    "github.com/obay/qbcli/pkg/qbo"
)

func main() {
    client, err := qbo.NewClient(qbo.Config{
        ClientID:     "your-client-id",
        ClientSecret: "your-client-secret",
        RealmID:      "your-realm-id",
        Environment:  qbo.Sandbox,
    })
    if err != nil {
        log.Fatal(err)
    }

    ctx := context.Background()

    // Query customers
    customers, err := client.Customer.Query(ctx, "SELECT * FROM Customer WHERE Active = true")
    if err != nil {
        log.Fatal(err)
    }

    for _, c := range customers {
        log.Printf("Customer: %s\n", c.DisplayName)
    }
}

Project Structure

qbcli/
├── cmd/qbcli/          # CLI entry point and commands
├── pkg/qbo/            # Public SDK package
│   ├── auth/           # OAuth2 authentication
│   ├── client/         # HTTP client and request handling
│   ├── entities/       # QuickBooks entity types
│   ├── services/       # Entity CRUD services
│   ├── query/          # Query builder
│   └── batch/          # Batch operations
├── internal/           # Private packages
├── docs/               # Documentation
└── examples/           # Usage examples

Development

Prerequisites
make setup  # Install development tools
Build
make build  # Build binary to bin/
make test   # Run tests
make lint   # Run linters
make fmt    # Format code
Running Tests
make test           # Run all tests
make test-coverage  # Generate coverage report

Documentation

Supported Entities

Entity Create Read Update Delete Query
Account -
Customer -
Vendor -
Item -
Invoice
Bill
Payment
Estimate

Contributing

See CONTRIBUTING.md for guidelines.

License

MIT License - see LICENSE for details.

Directories

Path Synopsis
cmd
qbcli command
Package main provides the entry point for the QuickBooks Online CLI.
Package main provides the entry point for the QuickBooks Online CLI.
qbcli/internal/cli
Package cli implements the command-line interface for qbcli.
Package cli implements the command-line interface for qbcli.
qbcli/internal/cli/account
Package account provides account management commands.
Package account provides account management commands.
qbcli/internal/cli/auth
Package auth implements authentication commands for qbcli.
Package auth implements authentication commands for qbcli.
qbcli/internal/cli/batch
Package batch provides CLI commands for batch operations.
Package batch provides CLI commands for batch operations.
qbcli/internal/cli/bill
Package bill provides bill management commands.
Package bill provides bill management commands.
qbcli/internal/cli/completion
Package completion provides shell completion commands.
Package completion provides shell completion commands.
qbcli/internal/cli/config
Package config implements configuration management commands.
Package config implements configuration management commands.
qbcli/internal/cli/customer
Package customer provides customer management commands.
Package customer provides customer management commands.
qbcli/internal/cli/entity
Package entity provides shared utilities for entity commands.
Package entity provides shared utilities for entity commands.
qbcli/internal/cli/invoice
Package invoice provides invoice management commands.
Package invoice provides invoice management commands.
qbcli/internal/cli/item
Package item provides item management commands.
Package item provides item management commands.
qbcli/internal/cli/output
Package output provides output formatting utilities for the CLI.
Package output provides output formatting utilities for the CLI.
qbcli/internal/cli/payment
Package payment provides payment management commands.
Package payment provides payment management commands.
qbcli/internal/cli/report
Package report provides CLI commands for financial reports.
Package report provides CLI commands for financial reports.
qbcli/internal/cli/vendor
Package vendor provides vendor management commands.
Package vendor provides vendor management commands.
internal
testutil
Package testutil provides testing utilities for the QuickBooks Online SDK.
Package testutil provides testing utilities for the QuickBooks Online SDK.
pkg
qbo
Package qbo provides a Go SDK for the QuickBooks Online API.
Package qbo provides a Go SDK for the QuickBooks Online API.
qbo/auth
Package auth provides OAuth2 authentication for the QuickBooks Online API.
Package auth provides OAuth2 authentication for the QuickBooks Online API.
qbo/batch
Package batch provides batch operation support for the QuickBooks Online API.
Package batch provides batch operation support for the QuickBooks Online API.
qbo/client
Package client provides HTTP client infrastructure for the QuickBooks Online API.
Package client provides HTTP client infrastructure for the QuickBooks Online API.
qbo/entities
Package entities provides type definitions for QuickBooks Online API entities.
Package entities provides type definitions for QuickBooks Online API entities.
qbo/query
Package query provides a fluent query builder for QuickBooks Online's SQL-like query language.
Package query provides a fluent query builder for QuickBooks Online's SQL-like query language.
qbo/reports
Package reports provides report generation for QuickBooks Online.
Package reports provides report generation for QuickBooks Online.
qbo/services
Package services provides entity services for the QuickBooks Online API.
Package services provides entity services for the QuickBooks Online API.
qbo/testutil
Package testutil provides testing utilities for the QuickBooks Online SDK.
Package testutil provides testing utilities for the QuickBooks Online SDK.
qbo/webhooks
Package webhooks provides webhook handling for QuickBooks Online.
Package webhooks provides webhook handling for QuickBooks Online.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL