client

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2025 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const TEMPLATE_MAIN = `
package apogy

import (
	openapi "github.com/aep/apogy/api/go"
)

type Mutation struct {
	Add interface{} ` + "`json:\"add,omitempty\"`" + ` 
	Sub interface{} ` + "`json:\"sub,omitempty\"`" + ` 
	Mul interface{} ` + "`json:\"mul,omitempty\"`" + ` 
	Div interface{} ` + "`json:\"div,omitempty\"`" + ` 
	Min interface{} ` + "`json:\"min,omitempty\"`" + ` 
	Max interface{} ` + "`json:\"max,omitempty\"`" + ` 
	Set interface{} ` + "`json:\"set,omitempty\"`" + ` 
}
type Mutations map[string]Mutation

type Document[Val any] struct {
	openapi.Document

	Id string ` + "`json:\"id\"`" + ` 
	Model string ` + "`json:\"model\"`" + ` 
	Val Val ` + "`json:\"val\"`" + `
	Mut Mutations ` + "`json:\"mut\",omitempty`" + ` 
}

type ValidationRequest[Doc any] struct {
	Current *Doc ` + "`json:\"current,omitempty\"`" + `
	Pending *Doc ` + "`json:\"pending,omitempty\"`" + ` 
}

{{range $t, $n := .Types}} 
type {{$t}} Document[{{$t}}Val]
{{end}} 

type Client struct {
	openapi.ClientInterface
	{{range $t, $n := .Types}}
	{{$t}} *openapi.TypedClient[{{$t}}]
	{{end}}
}

type ClientOption openapi.ClientOption

func NewClient(server string, opts ...ClientOption) (*Client, error) {

	var optss []openapi.ClientOption
	for _, o := range opts {
		optss = append(optss, openapi.ClientOption(o))
	}

	client, err := openapi.NewClient(server, optss...)
	if err != nil {
		return nil, err
	}

	r := &Client{ClientInterface: client}

	{{range $t,$n := .Types}}
	r.{{$t}}  = &openapi.TypedClient[{{$t}}]{client, "{{$n}}"}
	{{end}}

	return r, nil
}

`
View Source
const TEMPLATE_MODEL = `
package apogy

import (
)

`

Variables

This section is empty.

Functions

func RegisterCommands

func RegisterCommands(root *cobra.Command)

Types

This section is empty.

Jump to

Keyboard shortcuts

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