codesamples

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package codesamples generates the versioned CLI sample catalog consumed by the SumUp developer portal.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Catalog

type Catalog struct {
	SchemaVersion  int      `json:"schemaVersion"`
	Language       string   `json:"language"`
	SDK            SDK      `json:"sdk"`
	OpenAPIVersion string   `json:"openAPIVersion"`
	Samples        []Sample `json:"samples"`
}

Catalog is the versioned JSON contract consumed by documentation sites.

func Generate

func Generate(cliVersion string) (*Catalog, error)

Generate builds a deterministic sample catalog for the current CLI command tree and generated OpenAPI operation catalog.

type SDK

type SDK struct {
	Module  string `json:"module"`
	Version string `json:"version"`
}

SDK identifies the CLI package used by every generated sample. The field name is retained for compatibility with the shared portal catalog schema.

type Sample

type Sample struct {
	ID          string `json:"id"`
	OperationID string `json:"operationId"`
	Example     string `json:"example,omitempty"`
	Summary     string `json:"summary,omitempty"`
	Description string `json:"description,omitempty"`
	HTTPMethod  string `json:"httpMethod"`
	Path        string `json:"path"`
	Source      string `json:"sample"`
}

Sample is one complete CLI invocation for an OpenAPI operation.

Jump to

Keyboard shortcuts

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