fetchproviders

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrManagedNativeProvider = errors.New("native fetch provider is managed by the system")

Functions

This section is empty.

Types

type CreateRequest

type CreateRequest struct {
	Name     string         `json:"name"`
	Provider ProviderName   `json:"provider"`
	Config   map[string]any `json:"config,omitempty"`
}

type GetResponse

type GetResponse struct {
	ID        string         `json:"id"`
	Name      string         `json:"name"`
	Provider  string         `json:"provider"`
	Config    map[string]any `json:"config,omitempty"`
	Enable    bool           `json:"enable"`
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
}

type ProviderConfigSchema

type ProviderConfigSchema struct {
	Fields map[string]ProviderFieldSchema `json:"fields"`
}

type ProviderFieldSchema

type ProviderFieldSchema struct {
	Type        string   `json:"type"`
	Title       string   `json:"title,omitempty"`
	Description string   `json:"description,omitempty"`
	Required    bool     `json:"required,omitempty"`
	Enum        []string `json:"enum,omitempty"`
	Example     any      `json:"example,omitempty"`
}

type ProviderMeta

type ProviderMeta struct {
	Provider     string               `json:"provider"`
	DisplayName  string               `json:"display_name"`
	ConfigSchema ProviderConfigSchema `json:"config_schema"`
}

type ProviderName

type ProviderName string
const (
	ProviderNative             ProviderName = "native"
	ProviderJina               ProviderName = "jina"
	ProviderCloudflareMarkdown ProviderName = "cloudflare_markdown"
)

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(log *slog.Logger, queries dbstore.Queries) *Service

func (*Service) Create

func (s *Service) Create(ctx context.Context, req CreateRequest) (GetResponse, error)

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, id string) error

func (*Service) EnsureDefaults

func (s *Service) EnsureDefaults(ctx context.Context) error

func (*Service) Get

func (s *Service) Get(ctx context.Context, id string) (GetResponse, error)

func (*Service) GetRawByID

func (s *Service) GetRawByID(ctx context.Context, id string) (sqlc.FetchProvider, error)

func (*Service) List

func (s *Service) List(ctx context.Context, provider string) ([]GetResponse, error)

func (*Service) ListMeta

func (*Service) ListMeta(_ context.Context) []ProviderMeta

func (*Service) Update

func (s *Service) Update(ctx context.Context, id string, req UpdateRequest) (GetResponse, error)

type UpdateRequest

type UpdateRequest struct {
	Name     *string        `json:"name,omitempty"`
	Provider *ProviderName  `json:"provider,omitempty"`
	Config   map[string]any `json:"config,omitempty"`
	Enable   *bool          `json:"enable,omitempty"`
}

Jump to

Keyboard shortcuts

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