generate

package module
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: MIT Imports: 0 Imported by: 0

README

CREC API Go

Go client, server stubs, and shared models for the CREC (CRE Connect) API. Generated from OpenAPI specifications.

Overview

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)

Installation

go get github.com/smartcontractkit/crec-api-go/client
go get github.com/smartcontractkit/crec-api-go/models

Usage

Client
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.

Models

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.

Regenerating Bindings

After modifying api/openapi.yaml or models/models.yaml:

make tools && make generate

This runs oapi-codegen for the client, server stubs, and models.

Validating the OpenAPI Spec

make validate-openapi

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package client provides primitives to interact with the openapi HTTP API.
Package client provides primitives to interact with the openapi HTTP API.
Package ginserver provides primitives to interact with the openapi HTTP API.
Package ginserver provides primitives to interact with the openapi HTTP API.
Package models provides primitives to interact with the openapi HTTP API.
Package models provides primitives to interact with the openapi HTTP API.
Package stdserver provides primitives to interact with the openapi HTTP API.
Package stdserver provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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