client

package
v0.0.0-...-d8b21ba Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: MIT Imports: 10 Imported by: 0

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
	// contains filtered or unexported fields
}

func NewHTTPClient

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

type NewRecord

type NewRecord struct {
	File       io.Reader
	ReceivedAt time.Time
	Sender     string
	Date       *time.Time
	PatientId  *string
	Status     *api.Status
	Comment    *string
	Category   *string
}

type RecordClient

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

func (*RecordClient) Create

func (c *RecordClient) Create(create *NewRecord) (*api.Record, 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) 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