fhirapi

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2025 License: EUPL-1.2 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const FormMimeType = "application/x-www-form-urlencoded"
View Source
const JSONMimeType = "application/fhir+json"

Variables

This section is empty.

Functions

func BadRequestError

func BadRequestError(message string, cause error) error

func SendErrorResponse

func SendErrorResponse(ctx context.Context, httpResponse http.ResponseWriter, err error)

SendErrorResponse will send the given error as OperationOutcome to the FHIR client. If the error isn't an Error instance, it will send a generic error back to the FHIR client, to avoid leaking sensitive internals.

func SendResponse

func SendResponse(ctx context.Context, httpResponse http.ResponseWriter, httpStatus int, resource interface{})

Types

type Error

type Error struct {
	// Message is the message that can be return to the FHIR client.
	Message string
	// Cause is an optional error that is only logged internally, not returned to the FHIR client.
	Cause error
	// IssueType is the FHIR issue type that is used in the OperationOutcome.
	IssueType fhir.IssueType
}

Error defines a problem that can be translated to a FHIR OperationOutcome, to be returned to the FHIR client.

func (Error) Error

func (e Error) Error() string

func (Error) OperationOutcome

func (e Error) OperationOutcome() fhir.OperationOutcome

type Request

type Request[T any] struct {
	Resource   T
	Parameters url.Values
}

func ParseRequest

func ParseRequest[T any](httpRequest *http.Request) (*Request[T], error)

ParseRequest reads an HTTP request as FHIR request. If it fails, the returned error can be sent to the client as OperationOutcome.

Jump to

Keyboard shortcuts

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