Go client, server stubs, and shared models for the CRE Connect API. Generated from OpenAPI specifications.
This repository provides:
- client — HTTP client for calling CREC API endpoints (channels, watchers, wallets, operations, events)
- models — Shared types such as VerifiableEvent, EVMEvent, Channel, Wallet, and operation/event types
- ginserver / stdserver — Generated server stubs for implementing the API (Gin or net/http)
go get github.com/smartcontractkit/crec-api-go/client
go get github.com/smartcontractkit/crec-api-go/modelsMost consumers should use crec-sdk instead of this package directly.
import (
"context"
"log"
"github.com/smartcontractkit/crec-api-go/client"
)
func main() {
c, err := client.NewClient("https://api.example.com")
if err != nil {
log.Fatal(err)
}
channels, err := c.GetChannels(context.Background(), nil)
if err != nil {
log.Fatal(err)
}
// Use channels...
}Use client.WithRequestEditorFn to add auth headers (e.g. API key) to requests.
The models package is used by crec-workflow-utils, crec-sdk-ext-dta, crec-sdk-ext-dvp, and other CREC components for VerifiableEvent, EVMEvent, and related types.
After modifying api/openapi.yaml or models/models.yaml:
make tools && make generateThis runs oapi-codegen for the client, server stubs, and models.
make validate-openapi- crec-sdk — High-level SDK (most consumers should use this instead of the raw client)
- crec-workflow-utils — Shared utilities for event-listener workflows