fhirclient

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package fhirclient is a small read-only FHIR R4 HTTP client (Search and Read). It depends only on the stdlib and samply FHIR models — no substrate-internal imports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client reads from a FHIR R4 server base URL (e.g. https://ehr.example/fhir). Unauthenticated by default; an injected token source supplies auth.

func New

func New(baseURL string, hc *http.Client) *Client

New returns a Client for baseURL. A nil hc uses http.DefaultClient. Trailing slashes on baseURL are trimmed so path joining is unambiguous.

func (*Client) Read added in v0.12.0

func (c *Client) Read(ctx context.Context, resourceType, id string) (body []byte, found bool, err error)

Read issues GET {base}/{resourceType}/{id} and returns the raw response bytes. Non-2xx or a read failure is an error; 404 returns an error (callers inspect the status via errors.Is or by treating the error as absence). found=false is returned for 404 specifically (resource absent); other errors are returned as (nil, false, err) — callers that want fail-safe semantics ignore err.

func (*Client) Search

func (c *Client) Search(ctx context.Context, resourceType string, query url.Values) (*fhir.Bundle, error)

Search issues GET {base}/{resourceType}?{query} and returns the parsed Bundle. Non-2xx or a decode failure is an error (callers decide how to degrade).

Jump to

Keyboard shortcuts

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