Documentation
¶
Overview ¶
Package operations hosts shared operation helpers and configuration utilities.
Index ¶
- Variables
- func AddPayloadIf(details map[string]any, include bool, key string, payload any) map[string]any
- func ApplyOperationTemplate(template OperationTemplate, overrides map[string]any) (map[string]any, error)
- func DecodeConfig(config map[string]any, target any) error
- func EnsureIncludePayloads(config map[string]any) map[string]any
- func HealthCheckRunner[T any](tokenType TokenType, endpoint string, failureMsg string, ...) types.OperationFunc
- func HealthOperation(name types.OperationName, description string, client types.ClientName, ...) types.OperationDescriptor
- func OperationFailure(summary string, err error) types.OperationResult
- func OperationSuccess(summary string, details map[string]any) types.OperationResult
- func ResolveOperationConfig(config *openapi.IntegrationConfig, operation string, overrides map[string]any) (map[string]any, error)
- func SanitizeClientDescriptors(provider types.ProviderType, descriptors []types.ClientDescriptor) []types.ClientDescriptor
- func SanitizeOperationDescriptors(provider types.ProviderType, descriptors []types.OperationDescriptor) []types.OperationDescriptor
- func SchemaFrom[T any]() map[string]any
- type OperationTemplate
- type Pagination
- type PayloadOptions
- type RepositorySelector
- type TokenType
Constants ¶
This section is empty.
Variables ¶
var ( // ErrDecodeConfigTargetNil indicates DecodeConfig was called with a nil target ErrDecodeConfigTargetNil = errors.New("operations: decode config target is nil") // ErrOperationTemplateRequired indicates the operation requires a stored template configuration ErrOperationTemplateRequired = errors.New("operations: operation template required") // ErrOperationTemplateOverridesNotAllowed indicates overrides are not permitted for a template ErrOperationTemplateOverridesNotAllowed = errors.New("operations: operation template overrides not allowed") // ErrOperationTemplateOverrideNotAllowed indicates a provided override key is not permitted ErrOperationTemplateOverrideNotAllowed = errors.New("operations: operation template override not allowed") // ErrUnsupportedTokenType indicates the token type is not supported ErrUnsupportedTokenType = errors.New("operations: unsupported token type") )
Functions ¶
func AddPayloadIf ¶
AddPayloadIf attaches payloads to a details map when requested
func ApplyOperationTemplate ¶
func ApplyOperationTemplate(template OperationTemplate, overrides map[string]any) (map[string]any, error)
ApplyOperationTemplate merges a template with optional overrides
func DecodeConfig ¶
DecodeConfig decodes a config map into a target struct, respecting defaults on the target
func EnsureIncludePayloads ¶
EnsureIncludePayloads forces include_payloads to true.
func HealthCheckRunner ¶
func HealthCheckRunner[T any](tokenType TokenType, endpoint string, failureMsg string, resultFn func(T) (string, map[string]any)) types.OperationFunc
HealthCheckRunner creates a health check operation function using the common pattern.
func HealthOperation ¶
func HealthOperation(name types.OperationName, description string, client types.ClientName, run types.OperationFunc) types.OperationDescriptor
HealthOperation builds a standard health check descriptor.
func OperationFailure ¶
func OperationFailure(summary string, err error) types.OperationResult
OperationFailure builds a failed operation result with an error detail
func OperationSuccess ¶
func OperationSuccess(summary string, details map[string]any) types.OperationResult
OperationSuccess builds a successful operation result.
func ResolveOperationConfig ¶
func ResolveOperationConfig(config *openapi.IntegrationConfig, operation string, overrides map[string]any) (map[string]any, error)
ResolveOperationConfig merges stored templates with optional overrides
func SanitizeClientDescriptors ¶
func SanitizeClientDescriptors(provider types.ProviderType, descriptors []types.ClientDescriptor) []types.ClientDescriptor
SanitizeClientDescriptors filters out invalid client descriptors and assigns provider type
func SanitizeOperationDescriptors ¶
func SanitizeOperationDescriptors(provider types.ProviderType, descriptors []types.OperationDescriptor) []types.OperationDescriptor
SanitizeOperationDescriptors filters and cleans a slice of OperationDescriptor
func SchemaFrom ¶
SchemaFrom reflects a JSON schema from a Go type and returns it as a map
Types ¶
type OperationTemplate ¶
type OperationTemplate struct {
// Config is the base configuration for the operation
Config map[string]any
// AllowedOverrides contains keys that may be overridden at runtime
AllowedOverrides map[string]struct{}
}
OperationTemplate captures a stored configuration and optional override keys
func OperationTemplateFor ¶
func OperationTemplateFor(config *openapi.IntegrationConfig, operation string) (OperationTemplate, bool)
OperationTemplateFor loads an operation template from integration config
type Pagination ¶
type Pagination struct {
// PerPage sets the number of items to request per page
PerPage int `json:"per_page"`
// PageSize provides an alternate page size input
PageSize int `json:"page_size"`
// Page selects the page index to request
Page int `json:"page"`
}
Pagination captures common paging controls
func (Pagination) EffectivePageSize ¶
func (p Pagination) EffectivePageSize(defaultValue int) int
EffectivePageSize returns the configured page size or the provided default
type PayloadOptions ¶
type PayloadOptions struct {
// IncludePayloads controls whether raw payloads are returned
IncludePayloads bool `json:"include_payloads"`
}
PayloadOptions captures optional payload controls
type RepositorySelector ¶
type RepositorySelector struct {
// Repositories lists repository names to include
Repositories []types.TrimmedString `json:"repositories"`
// Repos lists repository names using a shorter alias
Repos []types.TrimmedString `json:"repos"`
// Repository selects a single repository name
Repository types.TrimmedString `json:"repository"`
// Owner filters repositories by owner
Owner types.TrimmedString `json:"owner"`
}
RepositorySelector captures repository selection settings
func (RepositorySelector) List ¶
func (r RepositorySelector) List() []string
List returns a merged, de-duplicated repository list