Help us shape the future of Go! Take the 2026 Go Developer Survey

catalog

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package catalog demonstrates a small REST integration built on httpclient. Copy the pattern into internal/modules/<module>/integrations/<provider> as needed. This is an example API, not a client for a real catalog provider.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct{ *httpclient.Client }

Client embeds the framework client so Do, Build and Configure need no wrappers. Construct it with New and reuse it across requests.

func New

func New(baseURL, token string) (*Client, error)

New configures the API prefix and optional bearer token without sending requests.

type CreateProductBody

type CreateProductBody struct {
	Name string `json:"name"`
}

type CreateProductRequest

type CreateProductRequest struct {
	httpclient.Request `method:"POST" path:"products"`
	Body               CreateProductBody `body:"json"`
}

CreateProductRequest sends only Body as JSON.

type GetProductRequest

type GetProductRequest struct {
	httpclient.Request `method:"GET" path:"products/{id}"`
	ID                 string   `path:"id"`
	Fields             []string `query:"fields,omitempty"`
}

GetProductRequest fetches a product, optionally selecting response fields.

type ProductResponse

type ProductResponse struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

ProductResponse is the provider's JSON payload; status and headers remain on httpclient.Response. Both the get and create operations return this shape.

Jump to

Keyboard shortcuts

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