content

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDraftNotFound                = errors.New("draft content not found in PAC")
	ErrDraftNotValid                = errors.New("draft content is invalid")
	ErrDraftContentTypeNotSupported = errors.New("draft content-type is invalid")
)
View Source
var (
	AllowedOriginSystemIDValues = map[string]struct{}{}
	AllowedContentTypes         = map[string]struct{}{}
)

Functions

This section is empty.

Types

type API added in v1.2.4

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

func NewContentAPI

func NewContentAPI(endpoint string, username string, password string, xPolicies []string, httpClient *http.Client) *API

func (*API) Endpoint added in v1.2.4

func (api *API) Endpoint() string

func (*API) GTG added in v1.2.4

func (api *API) GTG() error

func (*API) Get added in v1.2.4

func (api *API) Get(ctx context.Context, contentUUID string, log *logger.UPPLogger) (*http.Response, error)

type DraftContentRW

type DraftContentRW interface {
	Read(ctx context.Context, contentUUID string, log *logger.UPPLogger) (io.ReadCloser, error)
	Write(ctx context.Context, contentUUID string, content *string, headers map[string]string, log *logger.UPPLogger) error
	GTG() error
	Endpoint() string
}

func NewDraftContentRWService

func NewDraftContentRWService(endpoint string, resolver DraftContentValidatorResolver, httpClient *http.Client) DraftContentRW

type DraftContentValidator added in v1.2.4

type DraftContentValidator interface {
	Validate(ctx context.Context, contentUUID string, nativeBody io.Reader, contentType string, log *logger.UPPLogger) (io.ReadCloser, error)
	GTG() error
	Endpoint() string
}

func NewSparkDraftContentValidatorService added in v1.2.4

func NewSparkDraftContentValidatorService(endpoint string, httpClient *http.Client) DraftContentValidator

type DraftContentValidatorResolver added in v1.2.4

type DraftContentValidatorResolver interface {
	// ValidatorForContentType Resolves and returns a DraftContentValidator implementation if present.
	ValidatorForContentType(contentType string) (DraftContentValidator, error)
}

DraftContentValidatorResolver manages the validators available for a given originId/content-type pair.

func NewDraftContentValidatorResolver added in v1.2.4

func NewDraftContentValidatorResolver(contentTypeToValidator map[string]DraftContentValidator) DraftContentValidatorResolver

NewDraftContentValidatorResolver returns a DraftContentValidatorResolver implementation

type Handler

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

func NewHandler

func NewHandler(uppAPI contentProviderAPI, draftContentRW DraftContentRW, timeout time.Duration, log *logger.UPPLogger) *Handler

func (*Handler) ReadContent

func (h *Handler) ReadContent(w http.ResponseWriter, r *http.Request)

func (*Handler) WriteNativeContent

func (h *Handler) WriteNativeContent(w http.ResponseWriter, r *http.Request)

type ValidatorError added in v1.2.4

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

func (ValidatorError) Error added in v1.2.4

func (e ValidatorError) Error() string

func (ValidatorError) StatusCode added in v1.2.4

func (e ValidatorError) StatusCode() int

Jump to

Keyboard shortcuts

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