Technical API Reference

What it demonstrates: Technical documentation with multiple source code blocks (Go, JSON, bash), parameter tables, response codes, error handling patterns, and admonitions for warnings and tips.

Who it’s for: Go developers documenting APIs, libraries, or technical systems.

Run It

ascii2html examples/technical/api-reference.adoc
open examples/technical/api-reference.html

Source

examples/technical/api-reference.adoc

Go Client Example

Here’s the Go client example from the document:

package main

import (
	"context"
	"fmt"
	"log"

	widget "{sdk-package}"
)

func main() {
	client := widget.NewClient("YOUR_TOKEN")

	// List all active widgets
	widgets, err := client.List(context.Background(), &widget.ListOptions{
		Status: "active",
		Limit:  50,
	})
	if err != nil {
		log.Fatal(err)
	}

	for _, w := range widgets.Data {
		fmt.Printf("%s: %s (%s)\n", w.ID, w.Name, w.Status)
	}

	// Create a new widget
	created, err := client.Create(context.Background(), &widget.CreateRequest{
		Name:        "Gear Assembly",
		Description: "Main gear assembly unit",
		Tags:        []string{"mechanical", "assembly"},
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("Created: %s\n", created.ID)
}