api

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Call

func Call[T any, R any, L any](ctx context.Context, service Service[T, R, L], action string, id int, createItem func() *T)

Call is a generic function to handle any resource type

Types

type Service

type Service[T any, R any, L any] interface {
	Get(ctx context.Context, id int, params url.Values) (*R, error)
	List(ctx context.Context, params url.Values) (*L, error)
	Create(ctx context.Context, item *T) (*R, error)
	Update(ctx context.Context, id int, item *T) (*R, error)
}

Service defines the interface that all service types must implement

Jump to

Keyboard shortcuts

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