client

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadyExists = errors.New("resource already exists")
	ErrNotFound      = errors.New("resource not found")
	ErrGeneric       = errors.New("error handling response")
)

Functions

func HandleResponse

func HandleResponse[T any](res *http.Response) (T, error)

func ParseJsonBody

func ParseJsonBody(res io.ReadCloser, out interface{}) (err error)

func ToPointer

func ToPointer[T any](in T, err error) (*T, error)

Types

type Category

type Category struct {
	Id   string `bson:"_id,omitempty" json:"id"`
	Name string `bson:"name,omitempty" json:"name"`
}

type CategoryClient

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

func (*CategoryClient) All

func (c *CategoryClient) All() ([]api.Category, error)

func (*CategoryClient) Create

func (c *CategoryClient) Create(category *Category) (*api.Category, error)

func (*CategoryClient) Get

func (c *CategoryClient) Get(id string) (*api.Category, error)

func (CategoryClient) GetJson

func (c CategoryClient) GetJson(endpoint string) (*http.Response, error)

func (CategoryClient) PostJson

func (c CategoryClient) PostJson(endpoint string, payload interface{}) (*http.Response, error)

func (CategoryClient) PutJson

func (c CategoryClient) PutJson(endpoint string, payload interface{}) (*http.Response, error)

type HTTPClient

type HTTPClient struct {
	Records    *RecordClient
	Categories *CategoryClient
	Patients   *PatientClient
	// contains filtered or unexported fields
}

func NewHTTPClient

func NewHTTPClient(uri string, timeout time.Duration) (*HTTPClient, error)

type PatientClient

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

func (*PatientClient) All

func (c *PatientClient) All() ([]api.Patient, error)

func (*PatientClient) Get

func (c *PatientClient) Get(id string) (api.Patient, error)

func (PatientClient) GetJson

func (c PatientClient) GetJson(endpoint string) (*http.Response, error)

func (PatientClient) PostJson

func (c PatientClient) PostJson(endpoint string, payload interface{}) (*http.Response, error)

func (PatientClient) PutJson

func (c PatientClient) PutJson(endpoint string, payload interface{}) (*http.Response, error)

type RecordClient

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

func (*RecordClient) Create

func (c *RecordClient) Create(create *api.NewRecord) (*api.Record, error)

func (*RecordClient) Download

func (c *RecordClient) Download(recordId string) (io.ReadCloser, error)

func (*RecordClient) Get

func (c *RecordClient) Get(id string) (*api.Record, error)

func (RecordClient) GetJson

func (c RecordClient) GetJson(endpoint string) (*http.Response, error)

func (*RecordClient) List

func (c *RecordClient) List() ([]api.Record, error)

func (RecordClient) PostJson

func (c RecordClient) PostJson(endpoint string, payload interface{}) (*http.Response, error)

func (RecordClient) PutJson

func (c RecordClient) PutJson(endpoint string, payload interface{}) (*http.Response, error)

func (*RecordClient) Update

func (c *RecordClient) Update(record *api.Record) (*api.Record, error)

func (*RecordClient) UpdatePages

func (c *RecordClient) UpdatePages(recordId string, updatedPages []api.PageUpdate) (*api.Record, error)

Jump to

Keyboard shortcuts

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