Documentation ¶
Overview ¶
Package api provides primitives to interact the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.
Index ¶
- Variables
- func NewCheckConsentRequest(server string, body CheckConsentJSONRequestBody) (*http.Request, error)
- func NewCheckConsentRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func NewCreateConsentRequest(server string, body CreateConsentJSONRequestBody) (*http.Request, error)
- func NewCreateConsentRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func NewDeleteConsentRequest(server string, consentRecordHash string) (*http.Request, error)
- func NewFindConsentRecordRequest(server string, consentRecordHash string, params *FindConsentRecordParams) (*http.Request, error)
- func NewQueryConsentRequest(server string, body QueryConsentJSONRequestBody) (*http.Request, error)
- func NewQueryConsentRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func ParsecheckConsentResponse(rsp *http.Response) (*checkConsentResponse, error)
- func ParsecreateConsentResponse(rsp *http.Response) (*createConsentResponse, error)
- func ParsedeleteConsentResponse(rsp *http.Response) (*deleteConsentResponse, error)
- func ParsefindConsentRecordResponse(rsp *http.Response) (*findConsentRecordResponse, error)
- func ParsequeryConsentResponse(rsp *http.Response) (*queryConsentResponse, error)
- func RegisterHandlers(router runtime.EchoRouter, si ServerInterface)
- type CheckConsentJSONRequestBody
- type Client
- func (c *Client) CheckConsent(ctx context.Context, body CheckConsentJSONRequestBody) (*http.Response, error)
- func (c *Client) CheckConsentWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error)
- func (c *Client) CreateConsent(ctx context.Context, body CreateConsentJSONRequestBody) (*http.Response, error)
- func (c *Client) CreateConsentWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error)
- func (c *Client) DeleteConsent(ctx context.Context, consentRecordHash string) (*http.Response, error)
- func (c *Client) FindConsentRecord(ctx context.Context, consentRecordHash string, params *FindConsentRecordParams) (*http.Response, error)
- func (c *Client) QueryConsent(ctx context.Context, body QueryConsentJSONRequestBody) (*http.Response, error)
- func (c *Client) QueryConsentWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error)
- type ClientInterface
- type ClientWithResponses
- func (c *ClientWithResponses) CheckConsentWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*checkConsentResponse, error)
- func (c *ClientWithResponses) CheckConsentWithResponse(ctx context.Context, body CheckConsentJSONRequestBody) (*checkConsentResponse, error)
- func (c *ClientWithResponses) CreateConsentWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*createConsentResponse, error)
- func (c *ClientWithResponses) CreateConsentWithResponse(ctx context.Context, body CreateConsentJSONRequestBody) (*createConsentResponse, error)
- func (c *ClientWithResponses) DeleteConsentWithResponse(ctx context.Context, consentRecordHash string) (*deleteConsentResponse, error)
- func (c *ClientWithResponses) FindConsentRecordWithResponse(ctx context.Context, consentRecordHash string, params *FindConsentRecordParams) (*findConsentRecordResponse, error)
- func (c *ClientWithResponses) QueryConsentWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*queryConsentResponse, error)
- func (c *ClientWithResponses) QueryConsentWithResponse(ctx context.Context, body QueryConsentJSONRequestBody) (*queryConsentResponse, error)
- type ConsentCheckRequest
- type ConsentCheckResponse
- type ConsentQueryRequest
- type ConsentQueryResponse
- type ConsentRecord
- type CreateConsentJSONRequestBody
- type FindConsentRecordParams
- type HttpClient
- func (hb HttpClient) ConsentAuth(ctx context.Context, custodian string, subject string, actor string, ...) (bool, error)
- func (hb HttpClient) DeleteConsentRecordByHash(context context.Context, consentRecordHash string) (bool, error)
- func (hb HttpClient) FindConsentRecordByHash(context context.Context, consentRecordHash string, latest bool) (pkg.ConsentRecord, error)
- func (hb HttpClient) QueryConsent(context context.Context, actor *string, custodian *string, subject *string, ...) ([]pkg.PatientConsent, error)
- func (hb HttpClient) RecordConsent(ctx context.Context, consent []pkg.PatientConsent) error
- type Identifier
- type PageDefinition
- type PatientConsent
- type QueryConsentJSONRequestBody
- type RequestEditorFn
- type ServerInterface
- type ServerInterfaceWrapper
- func (w *ServerInterfaceWrapper) CheckConsent(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) CreateConsent(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) DeleteConsent(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) FindConsentRecord(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) QueryConsent(ctx echo.Context) error
- type ValidFrom
- type ValidTo
- type Wrapper
- func (w *Wrapper) CheckConsent(ctx echo.Context) error
- func (w *Wrapper) CreateConsent(ctx echo.Context) error
- func (w *Wrapper) DeleteConsent(ctx echo.Context, consentRecordHash string) error
- func (w *Wrapper) FindConsentRecord(ctx echo.Context, consentRecordHash string, params FindConsentRecordParams) error
- func (w *Wrapper) QueryConsent(ctx echo.Context) error
Constants ¶
This section is empty.
Variables ¶
var ErrorMissingHash = errors.New("missing consentRecordHash")
ErrorMissingHash is returned when the consentRecordHash parameter is missing
Functions ¶
func NewCheckConsentRequest ¶
func NewCheckConsentRequest(server string, body CheckConsentJSONRequestBody) (*http.Request, error)
NewCheckConsentRequest calls the generic CheckConsent builder with application/json body
func NewCheckConsentRequestWithBody ¶
func NewCheckConsentRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewCheckConsentRequestWithBody generates requests for CheckConsent with any type of body
func NewCreateConsentRequest ¶
func NewCreateConsentRequest(server string, body CreateConsentJSONRequestBody) (*http.Request, error)
NewCreateConsentRequest calls the generic CreateConsent builder with application/json body
func NewCreateConsentRequestWithBody ¶
func NewCreateConsentRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewCreateConsentRequestWithBody generates requests for CreateConsent with any type of body
func NewDeleteConsentRequest ¶
NewDeleteConsentRequest generates requests for DeleteConsent
func NewFindConsentRecordRequest ¶
func NewFindConsentRecordRequest(server string, consentRecordHash string, params *FindConsentRecordParams) (*http.Request, error)
NewFindConsentRecordRequest generates requests for FindConsentRecord
func NewQueryConsentRequest ¶
func NewQueryConsentRequest(server string, body QueryConsentJSONRequestBody) (*http.Request, error)
NewQueryConsentRequest calls the generic QueryConsent builder with application/json body
func NewQueryConsentRequestWithBody ¶
func NewQueryConsentRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewQueryConsentRequestWithBody generates requests for QueryConsent with any type of body
func ParsecheckConsentResponse ¶
ParsecheckConsentResponse parses an HTTP response from a CheckConsentWithResponse call
func ParsecreateConsentResponse ¶
ParsecreateConsentResponse parses an HTTP response from a CreateConsentWithResponse call
func ParsedeleteConsentResponse ¶
ParsedeleteConsentResponse parses an HTTP response from a DeleteConsentWithResponse call
func ParsefindConsentRecordResponse ¶
ParsefindConsentRecordResponse parses an HTTP response from a FindConsentRecordWithResponse call
func ParsequeryConsentResponse ¶
ParsequeryConsentResponse parses an HTTP response from a QueryConsentWithResponse call
func RegisterHandlers ¶
func RegisterHandlers(router runtime.EchoRouter, si ServerInterface)
RegisterHandlers adds each server route to the EchoRouter.
Types ¶
type CheckConsentJSONRequestBody ¶
type CheckConsentJSONRequestBody checkConsentJSONBody
CheckConsentRequestBody defines body for CheckConsent for application/json ContentType.
type Client ¶
type Client struct { // The endpoint of the server conforming to this interface, with scheme, // https://api.deepmap.com for example. Server string // HTTP client with any customized settings, such as certificate chains. Client http.Client // A callback for modifying requests which are generated before sending over // the network. RequestEditor RequestEditorFn }
Client which conforms to the OpenAPI3 specification for this service.
func (*Client) CheckConsent ¶
func (*Client) CheckConsentWithBody ¶
func (*Client) CreateConsent ¶
func (*Client) CreateConsentWithBody ¶
func (*Client) DeleteConsent ¶
func (*Client) FindConsentRecord ¶
func (*Client) QueryConsent ¶
type ClientInterface ¶
type ClientInterface interface { // CreateConsent request with any body CreateConsentWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error) CreateConsent(ctx context.Context, body CreateConsentJSONRequestBody) (*http.Response, error) // CheckConsent request with any body CheckConsentWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error) CheckConsent(ctx context.Context, body CheckConsentJSONRequestBody) (*http.Response, error) // QueryConsent request with any body QueryConsentWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error) QueryConsent(ctx context.Context, body QueryConsentJSONRequestBody) (*http.Response, error) // DeleteConsent request DeleteConsent(ctx context.Context, consentRecordHash string) (*http.Response, error) // FindConsentRecord request FindConsentRecord(ctx context.Context, consentRecordHash string, params *FindConsentRecordParams) (*http.Response, error) }
The interface specification for the client above.
type ClientWithResponses ¶
type ClientWithResponses struct {
ClientInterface
}
ClientWithResponses builds on ClientInterface to offer response payloads
func NewClientWithResponses ¶
func NewClientWithResponses(server string) *ClientWithResponses
NewClientWithResponses returns a ClientWithResponses with a default Client:
func NewClientWithResponsesAndRequestEditorFunc ¶
func NewClientWithResponsesAndRequestEditorFunc(server string, reqEditorFn RequestEditorFn) *ClientWithResponses
NewClientWithResponsesAndRequestEditorFunc takes in a RequestEditorFn callback function and returns a ClientWithResponses with a default Client:
func (*ClientWithResponses) CheckConsentWithBodyWithResponse ¶
func (c *ClientWithResponses) CheckConsentWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*checkConsentResponse, error)
CheckConsentWithBodyWithResponse request with arbitrary body returning *CheckConsentResponse
func (*ClientWithResponses) CheckConsentWithResponse ¶
func (c *ClientWithResponses) CheckConsentWithResponse(ctx context.Context, body CheckConsentJSONRequestBody) (*checkConsentResponse, error)
func (*ClientWithResponses) CreateConsentWithBodyWithResponse ¶
func (c *ClientWithResponses) CreateConsentWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*createConsentResponse, error)
CreateConsentWithBodyWithResponse request with arbitrary body returning *CreateConsentResponse
func (*ClientWithResponses) CreateConsentWithResponse ¶
func (c *ClientWithResponses) CreateConsentWithResponse(ctx context.Context, body CreateConsentJSONRequestBody) (*createConsentResponse, error)
func (*ClientWithResponses) DeleteConsentWithResponse ¶
func (c *ClientWithResponses) DeleteConsentWithResponse(ctx context.Context, consentRecordHash string) (*deleteConsentResponse, error)
DeleteConsentWithResponse request returning *DeleteConsentResponse
func (*ClientWithResponses) FindConsentRecordWithResponse ¶
func (c *ClientWithResponses) FindConsentRecordWithResponse(ctx context.Context, consentRecordHash string, params *FindConsentRecordParams) (*findConsentRecordResponse, error)
FindConsentRecordWithResponse request returning *FindConsentRecordResponse
func (*ClientWithResponses) QueryConsentWithBodyWithResponse ¶
func (c *ClientWithResponses) QueryConsentWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*queryConsentResponse, error)
QueryConsentWithBodyWithResponse request with arbitrary body returning *QueryConsentResponse
func (*ClientWithResponses) QueryConsentWithResponse ¶
func (c *ClientWithResponses) QueryConsentWithResponse(ctx context.Context, body QueryConsentJSONRequestBody) (*queryConsentResponse, error)
type ConsentCheckRequest ¶
type ConsentCheckRequest struct { Actor Identifier `json:"actor"` Custodian Identifier `json:"custodian"` DataClass string `json:"dataClass"` Subject Identifier `json:"subject"` ValidAt *string `json:"validAt,omitempty"` }
ConsentCheckRequest defines model for ConsentCheckRequest.
type ConsentCheckResponse ¶
type ConsentCheckResponse struct { ConsentGiven *string `json:"consentGiven,omitempty"` Limitations *string `json:"limitations,omitempty"` }
ConsentCheckResponse defines model for ConsentCheckResponse.
type ConsentQueryRequest ¶
type ConsentQueryRequest struct { Actor *Identifier `json:"actor,omitempty"` Custodian *Identifier `json:"custodian,omitempty"` Page *PageDefinition `json:"page,omitempty"` Subject *Identifier `json:"subject,omitempty"` ValidAt *string `json:"validAt,omitempty"` }
ConsentQueryRequest defines model for ConsentQueryRequest.
type ConsentQueryResponse ¶
type ConsentQueryResponse struct { Page PageDefinition `json:"page"` Results []PatientConsent `json:"results"` TotalResults int `json:"totalResults"` }
ConsentQueryResponse defines model for ConsentQueryResponse.
type ConsentRecord ¶
type ConsentRecord struct { DataClasses []string `json:"dataClasses"` PreviousRecordHash *string `json:"previousRecordHash,omitempty"` RecordHash string `json:"recordHash"` ValidFrom ValidFrom `json:"validFrom"` ValidTo *ValidTo `json:"validTo,omitempty"` Version *int `json:"version,omitempty"` }
ConsentRecord defines model for ConsentRecord.
func FromConsentRecord ¶
func FromConsentRecord(consentRecord pkg.ConsentRecord) ConsentRecord
FromConsentRecord converts the DB type to api type
func (ConsentRecord) ToConsentRecord ¶
func (cr ConsentRecord) ToConsentRecord() (pkg.ConsentRecord, error)
ToConsentRecord converts the API consent record object to the internal DB object
type CreateConsentJSONRequestBody ¶
type CreateConsentJSONRequestBody createConsentJSONBody
CreateConsentRequestBody defines body for CreateConsent for application/json ContentType.
type FindConsentRecordParams ¶
type FindConsentRecordParams struct {
Latest *bool `json:"latest,omitempty"`
}
FindConsentRecordParams defines parameters for FindConsentRecord.
type HttpClient ¶
type HttpClient struct { ServerAddress string Timeout time.Duration Logger *logrus.Entry // contains filtered or unexported fields }
HttpClient holds the server address and other basic settings for the http client
func (HttpClient) ConsentAuth ¶
func (hb HttpClient) ConsentAuth(ctx context.Context, custodian string, subject string, actor string, dataClass string, checkpoint *time.Time) (bool, error)
ConsentAuth checks if there is an active consent for a given custodian, subject, actor, dataClass and an optional moment in time (checkpoint)
func (HttpClient) DeleteConsentRecordByHash ¶
func (HttpClient) FindConsentRecordByHash ¶
func (hb HttpClient) FindConsentRecordByHash(context context.Context, consentRecordHash string, latest bool) (pkg.ConsentRecord, error)
FindConsentRecordByHash returns a ConsentRecord based on a hash. A latest flag can be added to indicate a record may only be returned if it's the latest in the chain.
func (HttpClient) QueryConsent ¶
func (hb HttpClient) QueryConsent(context context.Context, actor *string, custodian *string, subject *string, validAt *time.Time) ([]pkg.PatientConsent, error)
QueryConsent returns PatientConsent records based on a combination of actor, custodian and subject. The only constraint is that either actor or custodian must not be empty.
func (HttpClient) RecordConsent ¶
func (hb HttpClient) RecordConsent(ctx context.Context, consent []pkg.PatientConsent) error
RecordConsent currently only supports the creation of a single record
type PageDefinition ¶
PageDefinition defines model for PageDefinition.
type PatientConsent ¶
type PatientConsent struct { Actor Identifier `json:"actor"` Custodian Identifier `json:"custodian"` Id string `json:"id"` Records []ConsentRecord `json:"records"` Subject Identifier `json:"subject"` }
PatientConsent defines model for PatientConsent.
func FromPatientConsent ¶
func FromPatientConsent(pc pkg.PatientConsent) PatientConsent
FromPatientConsent converts a pkg.PatientConsent to a PatientConsent
func FromPatientConsents ¶
func FromPatientConsents(pc []pkg.PatientConsent) []PatientConsent
FromPatientConsent converts a slice of pkg.PatientConsent to a slice of api.PatientConsent
func (PatientConsent) ToPatientConsent ¶
func (sc PatientConsent) ToPatientConsent() (pkg.PatientConsent, error)
ToPatientConsent converts the api PatientConsent struct to an internal PatientConsent
type QueryConsentJSONRequestBody ¶
type QueryConsentJSONRequestBody queryConsentJSONBody
QueryConsentRequestBody defines body for QueryConsent for application/json ContentType.
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function
type ServerInterface ¶
type ServerInterface interface { // Create a new consent record for a C-S-A combination.// (POST /consent) CreateConsent(ctx echo.Context) error // Send a request for checking if the given combination exists// (POST /consent/check) CheckConsent(ctx echo.Context) error // Do a query for available consent// (POST /consent/query) QueryConsent(ctx echo.Context) error // Remove a consent record for a C-S-A combination.// (DELETE /consent/{consentRecordHash}) DeleteConsent(ctx echo.Context, consentRecordHash string) error // Retrieve a consent record by hash, use latest query param to only return a value if the given consent record is the latest in the chain.// (GET /consent/{consentRecordHash}) FindConsentRecord(ctx echo.Context, consentRecordHash string, params FindConsentRecordParams) error }
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct {
Handler ServerInterface
}
ServerInterfaceWrapper converts echo contexts to parameters.
func (*ServerInterfaceWrapper) CheckConsent ¶
func (w *ServerInterfaceWrapper) CheckConsent(ctx echo.Context) error
CheckConsent converts echo context to params.
func (*ServerInterfaceWrapper) CreateConsent ¶
func (w *ServerInterfaceWrapper) CreateConsent(ctx echo.Context) error
CreateConsent converts echo context to params.
func (*ServerInterfaceWrapper) DeleteConsent ¶
func (w *ServerInterfaceWrapper) DeleteConsent(ctx echo.Context) error
DeleteConsent converts echo context to params.
func (*ServerInterfaceWrapper) FindConsentRecord ¶
func (w *ServerInterfaceWrapper) FindConsentRecord(ctx echo.Context) error
FindConsentRecord converts echo context to params.
func (*ServerInterfaceWrapper) QueryConsent ¶
func (w *ServerInterfaceWrapper) QueryConsent(ctx echo.Context) error
QueryConsent converts echo context to params.
type Wrapper ¶
type Wrapper struct {
Cs *pkg.ConsentStore
}
Wrapper implements the ServerInterface for the base ConsentStore
func (*Wrapper) CheckConsent ¶
CheckConsent checks if a given resource is allowed for a given actor, subject, custodian triple
func (*Wrapper) CreateConsent ¶
CreateConsent creates or updates a PatientConsent in the consent store
func (*Wrapper) DeleteConsent ¶
DeleteConsent deletes the consentRecord for a given consentRecordHash
func (*Wrapper) FindConsentRecord ¶
func (w *Wrapper) FindConsentRecord(ctx echo.Context, consentRecordHash string, params FindConsentRecordParams) error
FindConsentRecord returns a ConsentRecord based on a hash. A latest flag can be added to indicate a record may only be returned if it's the latest in the chain.
func (*Wrapper) QueryConsent ¶
QueryConsent finds given consent for a combination of actor, subject and/or custodian