api

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2021 License: GPL-3.0 Imports: 13 Imported by: 1

Documentation

Overview

Package api provides primitives to interact the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGetAttachmentBySecureHashRequest

func NewGetAttachmentBySecureHashRequest(server string, secureHash string) (*http.Request, error)

NewGetAttachmentBySecureHashRequest generates requests for GetAttachmentBySecureHash

func NewGetConsentRequestStateByIdRequest

func NewGetConsentRequestStateByIdRequest(server string, uuid string) (*http.Request, error)

NewGetConsentRequestStateByIdRequest generates requests for GetConsentRequestStateById

Types

type ASymmetricKey

type ASymmetricKey struct {
	Alg *string `json:"alg,omitempty"`

	// base64 encoded
	CipherText *string `json:"cipherText,omitempty"`

	// Generic identifier used for representing BSN, agbcode, etc. It's always constructed as an URN followed by a colon (:) and then the identifying value of the given URN
	LegalEntity Identifier `json:"legalEntity"`
}

ASymmetricKey defines model for ASymmetricKey.

type BridgeClient

type BridgeClient interface {
	// GetConsentRequestStateById returns the consent request state metadata based on the uuid
	GetConsentRequestStateById(context.Context, string) (*FullConsentRequestState, error)
	// GetAttachmentBySecureHash retrieves an attachment by its hash
	GetAttachmentBySecureHash(context.Context, string) ([]byte, error)
}

func NewConsentBridgeClient

func NewConsentBridgeClient() BridgeClient

NewConsentBridgeClient returns a BridgeClient configured according to the current config

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) GetAttachmentBySecureHash

func (c *Client) GetAttachmentBySecureHash(ctx context.Context, secureHash string) (*http.Response, error)

func (*Client) GetConsentRequestStateById

func (c *Client) GetConsentRequestStateById(ctx context.Context, uuid string) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// GetAttachmentBySecureHash request
	GetAttachmentBySecureHash(ctx context.Context, secureHash string) (*http.Response, error)

	// GetConsentRequestStateById request
	GetConsentRequestStateById(ctx context.Context, uuid string) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption added in v0.14.0

type ClientOption func(*Client) error

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) GetAttachmentBySecureHashWithResponse

func (c *ClientWithResponses) GetAttachmentBySecureHashWithResponse(ctx context.Context, secureHash string) (*GetAttachmentBySecureHashResponse, error)

GetAttachmentBySecureHashWithResponse request returning *GetAttachmentBySecureHashResponse

func (*ClientWithResponses) GetConsentRequestStateByIdWithResponse

func (c *ClientWithResponses) GetConsentRequestStateByIdWithResponse(ctx context.Context, uuid string) (*GetConsentRequestStateByIdResponse, error)

GetConsentRequestStateByIdWithResponse request returning *GetConsentRequestStateByIdResponse

type ClientWithResponsesInterface added in v0.14.0

type ClientWithResponsesInterface interface {
	// GetAttachmentBySecureHash request
	GetAttachmentBySecureHashWithResponse(ctx context.Context, secureHash string) (*GetAttachmentBySecureHashResponse, error)

	// GetConsentRequestStateById request
	GetConsentRequestStateByIdWithResponse(ctx context.Context, uuid string) (*GetConsentRequestStateByIdResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type ConsentId

type ConsentId struct {

	// Unique identifier assigned by the consent cordapp
	UUID string `json:"UUID"`

	// Unique hexadecimal identifier created based on BSN and private key of care provider.
	ExternalId *string `json:"externalId,omitempty"`
}

ConsentId defines model for ConsentId.

type ConsentRecord

type ConsentRecord struct {

	// SHA256 of attachment (metadata + cipherText)
	AttachmentHash *string `json:"attachmentHash,omitempty"`

	// Base64 encoded cipher_text.bin (fhir)
	CipherText *string                     `json:"cipherText,omitempty"`
	Metadata   *Metadata                   `json:"metadata,omitempty"`
	Signatures *[]PartyAttachmentSignature `json:"signatures,omitempty"`
}

ConsentRecord defines model for ConsentRecord.

type ConsentState

type ConsentState struct {
	ConsentId      ConsentId       `json:"consentId"`
	ConsentRecords []ConsentRecord `json:"consentRecords"`
}

ConsentState defines model for ConsentState.

type Domain

type Domain string

Domain defines model for Domain.

const (
	Domain_insurance Domain = "insurance"
	Domain_medical   Domain = "medical"
	Domain_pgo       Domain = "pgo"
	Domain_social    Domain = "social"
)

List of Domain

type FullConsentRequestState

type FullConsentRequestState struct {

	// user generated comment (usually a closing reason)
	Comment        *string         `json:"comment,omitempty"`
	ConsentId      ConsentId       `json:"consentId"`
	ConsentRecords []ConsentRecord `json:"consentRecords"`

	// the date-time when the request was made
	CreatedAt *time.Time `json:"createdAt,omitempty"`

	// Generic identifier used for representing BSN, agbcode, etc. It's always constructed as an URN followed by a colon (:) and then the identifying value of the given URN
	InitiatingLegalEntity Identifier `json:"initiatingLegalEntity"`

	// The X500 name of the node that initiated the transaction (read-only)
	InitiatingNode *string      `json:"initiatingNode,omitempty"`
	LegalEntities  []Identifier `json:"legalEntities"`

	// the date-time of the latest recorded change in state (read-only)
	UpdatedAt *time.Time `json:"updatedAt,omitempty"`
}

FullConsentRequestState defines model for FullConsentRequestState.

func (FullConsentRequestState) String

func (crs FullConsentRequestState) String() string

type GetAttachmentBySecureHashResponse added in v0.14.0

type GetAttachmentBySecureHashResponse struct {
	Body         []byte
	HTTPResponse *http.Response
}

func ParseGetAttachmentBySecureHashResponse added in v0.14.0

func ParseGetAttachmentBySecureHashResponse(rsp *http.Response) (*GetAttachmentBySecureHashResponse, error)

ParseGetAttachmentBySecureHashResponse parses an HTTP response from a GetAttachmentBySecureHashWithResponse call

func (GetAttachmentBySecureHashResponse) Status added in v0.14.0

Status returns HTTPResponse.Status

func (GetAttachmentBySecureHashResponse) StatusCode added in v0.14.0

func (r GetAttachmentBySecureHashResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetConsentRequestStateByIdResponse added in v0.14.0

type GetConsentRequestStateByIdResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *FullConsentRequestState
}

func ParseGetConsentRequestStateByIdResponse added in v0.14.0

func ParseGetConsentRequestStateByIdResponse(rsp *http.Response) (*GetConsentRequestStateByIdResponse, error)

ParseGetConsentRequestStateByIdResponse parses an HTTP response from a GetConsentRequestStateByIdWithResponse call

func (GetConsentRequestStateByIdResponse) Status added in v0.14.0

Status returns HTTPResponse.Status

func (GetConsentRequestStateByIdResponse) StatusCode added in v0.14.0

func (r GetConsentRequestStateByIdResponse) 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) GetAttachmentBySecureHash

func (hb HttpClient) GetAttachmentBySecureHash(ctx context.Context, hash string) ([]byte, error)

func (HttpClient) GetConsentRequestStateById

func (hb HttpClient) GetConsentRequestStateById(ctx context.Context, uuid string) (*FullConsentRequestState, error)

type HttpRequestDoer added in v0.14.0

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type Identifier

type Identifier string

Identifier defines model for Identifier.

func (Identifier) PartyID added in v0.15.0

func (i Identifier) PartyID() core.PartyID

func (*Identifier) UnmarshalJSON added in v0.15.0

func (i *Identifier) UnmarshalJSON(bytes []byte) error

type JWK

type JWK map[string]interface{}

JWK defines model for JWK.

type Metadata

type Metadata struct {

	// Hash of the unencrypted consent FHIR resource. Can be used for uniqueness.
	ConsentRecordHash      string          `json:"consentRecordHash"`
	Domain                 []Domain        `json:"domain"`
	OrganisationSecureKeys []ASymmetricKey `json:"organisationSecureKeys"`
	Period                 Period          `json:"period"`

	// SHA256 of cipherText bytes
	PreviousAttachmentHash *string      `json:"previousAttachmentHash,omitempty"`
	SecureKey              SymmetricKey `json:"secureKey"`
}

Metadata defines model for Metadata.

type PartyAttachmentSignature

type PartyAttachmentSignature struct {

	// Hexidecimal SecureHash value
	Attachment string `json:"attachment"`

	// Generic identifier used for representing BSN, agbcode, etc. It's always constructed as an URN followed by a colon (:) and then the identifying value of the given URN
	LegalEntity Identifier       `json:"legalEntity"`
	Signature   SignatureWithKey `json:"signature"`
}

PartyAttachmentSignature defines model for PartyAttachmentSignature.

type Period

type Period struct {
	ValidFrom time.Time  `json:"validFrom"`
	ValidTo   *time.Time `json:"validTo,omitempty"`
}

Period defines model for Period.

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

type SignatureWithKey

type SignatureWithKey struct {

	// base64 encoded bytes
	Data string `json:"data"`

	// as described by https://tools.ietf.org/html/rfc7517. Modelled as object so libraries can parse the tokens themselves.
	PublicKey JWK `json:"publicKey"`
}

SignatureWithKey defines model for SignatureWithKey.

type StateMachineId

type StateMachineId string

StateMachineId defines model for StateMachineId.

type SymmetricKey

type SymmetricKey struct {
	Alg string `json:"alg"`
	Iv  string `json:"iv"`
}

SymmetricKey defines model for SymmetricKey.

Jump to

Keyboard shortcuts

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