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 RegisterHandlers(router EchoRouter, si ServerInterface)
- func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)
- type CheckConsentJSONBody
- type CheckConsentJSONRequestBody
- type CheckConsentResponse
- 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 ClientOption
- 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 ClientWithResponsesInterface
- type ConsentCheckRequest
- type ConsentCheckResponse
- type ConsentQueryRequest
- type ConsentQueryResponse
- type ConsentRecord
- type CreateConsentJSONBody
- type CreateConsentJSONRequestBody
- type CreateConsentResponse
- type DeleteConsentResponse
- type EchoRouter
- type FindConsentRecordParams
- type FindConsentRecordResponse
- 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 HttpRequestDoer
- type Identifier
- type PageDefinition
- type PatientConsent
- type QueryConsentJSONBody
- type QueryConsentJSONRequestBody
- type QueryConsentResponse
- 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 RegisterHandlers ¶
func RegisterHandlers(router EchoRouter, si ServerInterface)
RegisterHandlers adds each server route to the EchoRouter.
func RegisterHandlersWithBaseURL ¶ added in v0.16.0
func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)
Registers handlers, and prepends BaseURL to the paths, so that the paths can be served under a prefix.
Types ¶
type CheckConsentJSONBody ¶ added in v0.14.0
type CheckConsentJSONBody ConsentCheckRequest
CheckConsentJSONBody defines parameters for CheckConsent.
type CheckConsentJSONRequestBody ¶
type CheckConsentJSONRequestBody CheckConsentJSONBody
CheckConsentRequestBody defines body for CheckConsent for application/json ContentType.
type CheckConsentResponse ¶ added in v0.14.0
type CheckConsentResponse struct { Body []byte HTTPResponse *http.Response JSON200 *ConsentCheckResponse }
func ParseCheckConsentResponse ¶ added in v0.14.0
func ParseCheckConsentResponse(rsp *http.Response) (*CheckConsentResponse, error)
ParseCheckConsentResponse parses an HTTP response from a CheckConsentWithResponse call
func (CheckConsentResponse) Status ¶ added in v0.14.0
func (r CheckConsentResponse) Status() string
Status returns HTTPResponse.Status
func (CheckConsentResponse) StatusCode ¶ added in v0.14.0
func (r CheckConsentResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type Client ¶
type Client struct { // The endpoint of the server conforming to this interface, with scheme, // https://api.deepmap.com for example. This can contain a path relative // to the server, such as https://api.deepmap.com/dev-test, and all the // paths in the swagger spec will be appended to the server. Server string // Doer for performing requests, typically a *http.Client with any // customized settings, such as certificate chains. Client HttpRequestDoer // 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 NewClient ¶ added in v0.14.0
func NewClient(server string, opts ...ClientOption) (*Client, error)
Creates a new Client, with reasonable defaults
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 ClientOption ¶ added in v0.14.0
ClientOption allows setting custom parameters during construction
func WithBaseURL ¶ added in v0.14.0
func WithBaseURL(baseURL string) ClientOption
WithBaseURL overrides the baseURL.
func WithHTTPClient ¶ added in v0.14.0
func WithHTTPClient(doer HttpRequestDoer) ClientOption
WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.
func WithRequestEditorFn ¶ added in v0.14.0
func WithRequestEditorFn(fn RequestEditorFn) ClientOption
WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.
type ClientWithResponses ¶
type ClientWithResponses struct {
ClientInterface
}
ClientWithResponses builds on ClientInterface to offer response payloads
func NewClientWithResponses ¶
func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)
NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling
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 ClientWithResponsesInterface ¶ added in v0.14.0
type ClientWithResponsesInterface interface { // CreateConsent request with any body CreateConsentWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*CreateConsentResponse, error) CreateConsentWithResponse(ctx context.Context, body CreateConsentJSONRequestBody) (*CreateConsentResponse, error) // CheckConsent request with any body CheckConsentWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*CheckConsentResponse, error) CheckConsentWithResponse(ctx context.Context, body CheckConsentJSONRequestBody) (*CheckConsentResponse, error) // QueryConsent request with any body QueryConsentWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*QueryConsentResponse, error) QueryConsentWithResponse(ctx context.Context, body QueryConsentJSONRequestBody) (*QueryConsentResponse, error) // DeleteConsent request DeleteConsentWithResponse(ctx context.Context, consentRecordHash string) (*DeleteConsentResponse, error) // FindConsentRecord request FindConsentRecordWithResponse(ctx context.Context, consentRecordHash string, params *FindConsentRecordParams) (*FindConsentRecordResponse, error) }
ClientWithResponsesInterface is the interface specification for the client with responses above.
type ConsentCheckRequest ¶
type ConsentCheckRequest struct { // Generic identifier used for representing BSN, agbcode, etc. It's always constructed as an URN followed by a double colon (:) and then the identifying value of the given URN Actor Identifier `json:"actor"` // Generic identifier used for representing BSN, agbcode, etc. It's always constructed as an URN followed by a double colon (:) and then the identifying value of the given URN Custodian Identifier `json:"custodian"` // Consent class that is requested DataClass string `json:"dataClass"` // Generic identifier used for representing BSN, agbcode, etc. It's always constructed as an URN followed by a double colon (:) and then the identifying value of the given URN Subject Identifier `json:"subject"` // Date at which consent has to be valid. Optional, when empty, Now() is used. format: 2020-01-01T12:00:00+01:00 ValidAt *string `json:"validAt,omitempty"` }
ConsentCheckRequest defines model for ConsentCheckRequest.
type ConsentCheckResponse ¶
type ConsentCheckResponse struct { ConsentGiven *string `json:"consentGiven,omitempty"` // for future use Limitations *string `json:"limitations,omitempty"` }
ConsentCheckResponse defines model for ConsentCheckResponse.
type ConsentQueryRequest ¶
type ConsentQueryRequest struct { // Generic identifier used for representing BSN, agbcode, etc. It's always constructed as an URN followed by a double colon (:) and then the identifying value of the given URN Actor *Identifier `json:"actor,omitempty"` // Generic identifier used for representing BSN, agbcode, etc. It's always constructed as an URN followed by a double colon (:) and then the identifying value of the given URN Custodian *Identifier `json:"custodian,omitempty"` Page *PageDefinition `json:"page,omitempty"` // Generic identifier used for representing BSN, agbcode, etc. It's always constructed as an URN followed by a double colon (:) and then the identifying value of the given URN Subject *Identifier `json:"subject,omitempty"` // Date at which consent has to be valid. Optional, when empty, Now() is used. format: 2020-01-01T12:00:00+01:00 ValidAt *string `json:"validAt,omitempty"` }
ConsentQueryRequest defines model for ConsentQueryRequest.
type ConsentQueryResponse ¶
type ConsentQueryResponse struct { Page PageDefinition `json:"page"` Results []PatientConsent `json:"results"` // Total number of results TotalResults int `json:"totalResults"` }
ConsentQueryResponse defines model for ConsentQueryResponse.
type ConsentRecord ¶
type ConsentRecord struct { // Array of consent classes DataClasses []string `json:"dataClasses"` // the hash of the previous version of the hash PreviousRecordHash *string `json:"previousRecordHash,omitempty"` // the unique hash for the consent record proving consent has been given, can be seen as the unique ID for a consentRecord RecordHash string `json:"recordHash"` // DateTime from which a record is valid (inclusive) ValidFrom ValidFrom `json:"validFrom"` // DateTime to which a record is valid (exclusive) ValidTo *ValidTo `json:"validTo,omitempty"` // the version number for the record, starts at 1, equals the length of the chain when following the previousRecordHash 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 CreateConsentJSONBody ¶ added in v0.14.0
type CreateConsentJSONBody PatientConsent
CreateConsentJSONBody defines parameters for CreateConsent.
type CreateConsentJSONRequestBody ¶
type CreateConsentJSONRequestBody CreateConsentJSONBody
CreateConsentRequestBody defines body for CreateConsent for application/json ContentType.
type CreateConsentResponse ¶ added in v0.14.0
func ParseCreateConsentResponse ¶ added in v0.14.0
func ParseCreateConsentResponse(rsp *http.Response) (*CreateConsentResponse, error)
ParseCreateConsentResponse parses an HTTP response from a CreateConsentWithResponse call
func (CreateConsentResponse) Status ¶ added in v0.14.0
func (r CreateConsentResponse) Status() string
Status returns HTTPResponse.Status
func (CreateConsentResponse) StatusCode ¶ added in v0.14.0
func (r CreateConsentResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type DeleteConsentResponse ¶ added in v0.14.0
func ParseDeleteConsentResponse ¶ added in v0.14.0
func ParseDeleteConsentResponse(rsp *http.Response) (*DeleteConsentResponse, error)
ParseDeleteConsentResponse parses an HTTP response from a DeleteConsentWithResponse call
func (DeleteConsentResponse) Status ¶ added in v0.14.0
func (r DeleteConsentResponse) Status() string
Status returns HTTPResponse.Status
func (DeleteConsentResponse) StatusCode ¶ added in v0.14.0
func (r DeleteConsentResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type EchoRouter ¶ added in v0.14.0
type EchoRouter interface { CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route }
This is a simple interface which specifies echo.Route addition functions which are present on both echo.Echo and echo.Group, since we want to allow using either of them for path registration
type FindConsentRecordParams ¶
type FindConsentRecordParams struct { // flag to indicate to only return a value when the given record is the latest in the chain Latest *bool `json:"latest,omitempty"` }
FindConsentRecordParams defines parameters for FindConsentRecord.
type FindConsentRecordResponse ¶ added in v0.14.0
type FindConsentRecordResponse struct { Body []byte HTTPResponse *http.Response JSON200 *ConsentRecord }
func ParseFindConsentRecordResponse ¶ added in v0.14.0
func ParseFindConsentRecordResponse(rsp *http.Response) (*FindConsentRecordResponse, error)
ParseFindConsentRecordResponse parses an HTTP response from a FindConsentRecordWithResponse call
func (FindConsentRecordResponse) Status ¶ added in v0.14.0
func (r FindConsentRecordResponse) Status() string
Status returns HTTPResponse.Status
func (FindConsentRecordResponse) StatusCode ¶ added in v0.14.0
func (r FindConsentRecordResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
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 HttpRequestDoer ¶ added in v0.14.0
Doer performs HTTP requests.
The standard http.Client implements this interface.
type PageDefinition ¶
PageDefinition defines model for PageDefinition.
type PatientConsent ¶
type PatientConsent struct { // Generic identifier used for representing BSN, agbcode, etc. It's always constructed as an URN followed by a double colon (:) and then the identifying value of the given URN Actor Identifier `json:"actor"` // Generic identifier used for representing BSN, agbcode, etc. It's always constructed as an URN followed by a double colon (:) and then the identifying value of the given URN Custodian Identifier `json:"custodian"` // Id as generated by the HMAC of custodian(subject-actor) Id string `json:"id"` Records []ConsentRecord `json:"records"` // Generic identifier used for representing BSN, agbcode, etc. It's always constructed as an URN followed by a double colon (:) and then the identifying value of the given URN 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 QueryConsentJSONBody ¶ added in v0.14.0
type QueryConsentJSONBody ConsentQueryRequest
QueryConsentJSONBody defines parameters for QueryConsent.
type QueryConsentJSONRequestBody ¶
type QueryConsentJSONRequestBody QueryConsentJSONBody
QueryConsentRequestBody defines body for QueryConsent for application/json ContentType.
type QueryConsentResponse ¶ added in v0.14.0
type QueryConsentResponse struct { Body []byte HTTPResponse *http.Response JSON200 *ConsentQueryResponse }
func ParseQueryConsentResponse ¶ added in v0.14.0
func ParseQueryConsentResponse(rsp *http.Response) (*QueryConsentResponse, error)
ParseQueryConsentResponse parses an HTTP response from a QueryConsentWithResponse call
func (QueryConsentResponse) Status ¶ added in v0.14.0
func (r QueryConsentResponse) Status() string
Status returns HTTPResponse.Status
func (QueryConsentResponse) StatusCode ¶ added in v0.14.0
func (r QueryConsentResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
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