Break up files, add events change to okapi

tags/v0.0.2
Bas Kloosterman 1 year ago
parent 75d9ba198c
commit 5bc626687b
  1. 177
      okap.proto
  2. 16
      okapi-errors.proto
  3. 65
      okapi-events.proto
  4. 51
      okapi-onboarding.proto
  5. 56
      okapi-patient-registration.proto
  6. 74
      okapi-service-config.proto
  7. 27
      okapi.proto

@ -1,177 +0,0 @@
syntax = "proto3";
import "okap-errors.proto";
option go_package = "whiteboxsystems.nl/okap";
service OKAP {
// Onboarding
rpc GetMetadata (GetMetadataRequest) returns (GetMetadataResponse) {}
rpc Register (RegisterRequest) returns (RegisterResponse) {}
rpc CompleteRegistration (CompleteRegistrationRequest) returns (CompleteRegistrationResponse) {}
// Configuration
rpc ConfigureCallback (ConfigureCallbackRequest) returns (ConfigureCallbackResponse) {}
rpc ListServices (ListServicesRequest) returns (ListServicesResponse) {}
rpc UpdatePatientRegistration (UpdatePatientRegistrationRequest) returns (UpdatePatientRegistrationResponse) {}
rpc ListPatientRegistration (ListPatientRegistrationRequest) returns (ListPatientRegistrationResponse) {}
}
enum XISAuthMethod {
mTLS = 0;
BearerToken = 1;
}
message MTLSConfigurationParams {
string publicKey = 1;
}
message BearerTokenConfigurationParams {
string token = 1;
}
message XISAuthConfiguration {
XISAuthMethod method = 1;
oneof config {
MTLSConfigurationParams mtlsConfig = 2;
BearerTokenConfigurationParams apiTokenConfig = 3;
}
}
message ProtocolAuthConfiguration {
string method = 1;
map<string, string> configuration = 2;
}
enum SubscriptionPolicy {
subnone = 0;
optin = 1;
optout = 2;
}
enum ConsentPolicy {
consentnone = 0;
explicit = 1;
presumed = 2;
}
message ProtocolDefinition {
string protocol = 1;
repeated string authMethods = 2;
}
message ServiceDefinition {
string id = 1;
string name = 2;
string description = 3;
SubscriptionPolicy subscriptionPolicy = 4;
ConsentPolicy consentPolicy = 5;
repeated ProtocolDefinition fetchProtocols = 6;
repeated ProtocolDefinition pushProtocols = 7;
}
message GetMetadataRequest {}
message GetMetadataResponse {
string supplierFormalName = 1;
string supplierDisplayName = 2;
string productName = 3;
string version = 4;
}
message RegisterRequest {
string organisationFormalName = 1;
string organisationDisplayName = 2;
string organisationIdentifier = 3;
string organisationIdentifierType = 4; // Type bijv. AGB, BIG registratie of KvK
XISAuthConfiguration auth = 5;
}
message RegisterResponse {
string reference = 1;
}
message CompleteRegistrationRequest {
string reference = 1;
string registrationToken = 2;
}
message CompleteRegistrationResponse {}
message CallbackConfig {
string protocol = 1;
map<string,string> config = 2;
ProtocolAuthConfiguration auth = 3;
}
message ConfigureCallbackRequest {
string serviceId = 1;
bool enabled = 2;
CallbackConfig fetch = 3;
CallbackConfig push = 4;
}
message ConfigureCallbackResponse {
string serviceId = 1;
bool enabled = 2;
CallbackConfig fetch = 3;
CallbackConfig push = 4;
}
message ListServicesRequest {
}
message ServiceConfiguration {
string serviceId = 1;
bool enabled = 2;
CallbackConfig fetch = 3;
CallbackConfig push = 4;
}
message ListServicesResponse {
repeated ServiceDefinition availableServices = 1;
repeated ServiceConfiguration configurations = 2;
}
message PatientMeta {
string identifier = 1;
string identifierType = 2;
string firstname = 3;
string surname = 4;
string birthdate = 5;
string street = 6;
string streetNumber = 7;
string streetNumberExtension = 8;
string postalCode = 9;
string city = 10;
string country = 11;
map<string, string> extra = 12;
}
message PatientRegistrationData {
PatientMeta subject = 1;
bool registered = 2;
map<string, string> callbackProtocolMeta = 3;
}
message PatientRegistrationError {
int32 index = 1;
OKAPError error = 2;
}
message UpdatePatientRegistrationRequest {
string serviceId = 1;
repeated PatientRegistrationData PatientRegistrationData = 2;
bool atomicUpdate = 3;
}
message UpdatePatientRegistrationResponse {
repeated PatientRegistrationError errors = 2;
}
message ListPatientRegistrationRequest {
string serviceId = 1;
}
message ListPatientRegistrationResponse {
repeated PatientRegistrationData PatientRegistrationData = 2;
}

@ -1,14 +1,14 @@
syntax = "proto3";
option go_package = "whiteboxsystems.nl/okap";
option go_package = "whiteboxsystems.nl/okapi";
enum OKAPErrorCode {
enum OkAPIErrorCode {
None = 0;
// Invalide configuratie voor de gekozen methode
InvalidXISAuthConfiguration = 1;
// Onbekende reference meegegeven
UnkownReference = 2;
// Invalide registratietoken voor deze reference
InvalidRegistrationToken = 3;
// Invalide autorisatietoken voor deze reference
InvalidAuthorisationToken = 3;
// Onbekende service
UnknownService = 4;
// Onbekende protocol
@ -17,11 +17,13 @@ enum OKAPErrorCode {
InvalidProcotolConfig = 6;
// Authenticatie methode onbekend
UnknownAuthMethod = 7;
// Invalide authorizatie configuratie voor het aangegeven protocol
// Invalide authorisatie configuratie voor het aangegeven protocol
InvalidProcotolAuthConfig = 8;
// Er zijn niet genoeg events om deze pagina te bereiken
InvalidPage = 9;
}
message OKAPError {
OKAPErrorCode code = 1;
message OkAPIError {
OkAPIErrorCode code = 1;
string message = 2;
}

@ -0,0 +1,65 @@
syntax = "proto3";
import "google/protobuf/struct.proto";
option go_package = "whiteboxsystems.nl/okapi";
// idea:
// query:
// /:type[/:subtype+]/:service/:patient with wildcard
// Should events payloads be documented by for example json schema?
message Event {
uint64 timestamp = 1;
string type = 2;
string serviceId = 3;
string patientId = 4;
google.protobuf.Struct payload = 5;
// string schema = 6; // ? do we need a schema in the event itself
}
message Query {
uint64 start = 1;
uint64 end = 2;
string type = 3;
string serviceId = 4;
string patientId = 5;
}
message GetEventsRequest {
int32 page = 2;
int32 perPage = 3;
repeated Query query = 4;
}
message GetEventsResponse {
int32 page = 2;
int32 perPage = 3;
repeated Event events = 4;
}
message GetEventsStreamRequest {
repeated Query query = 2;
}
// enum EventCallbackMethod {
// none = 0;
// webhook = 1;
// }
// message EventCallback {
// string id = 1; // who fills this
// bool active = 2;
// EventCallbackMethod method = 3;
// repeated Query query = 4;
// }
// message RegisterEventCallbackRequest {
// repeated EventCallback callbacks = 1;
// }
// message RegisterEventCallbackResponse {}
// message ListEventCallbacksRequest {
// }
// message ListEventCallbacksResponse {
// repeated EventCallback callbacks = 1;
// }

@ -0,0 +1,51 @@
syntax = "proto3";
option go_package = "whiteboxsystems.nl/okapi";
enum XISAuthMethod {
mTLS = 0;
BearerToken = 1;
}
message MTLSConfigurationParams {
string publicKey = 1;
}
message BearerTokenConfigurationParams {
string token = 1;
}
message XISAuthConfiguration {
XISAuthMethod method = 1;
oneof configuration {
MTLSConfigurationParams mtlsConfiguration = 2;
BearerTokenConfigurationParams apiTokenConfiguration = 3;
}
}
message GetMetadataRequest {}
message GetMetadataResponse {
string supplierFormalName = 1;
string supplierDisplayName = 2;
string productName = 3;
string version = 4;
}
message RegisterRequest {
string organisationFormalName = 1;
string organisationDisplayName = 2;
string organisationIdentifier = 3;
string organisationIdentifierType = 4; // Type bijv. AGB, BIG registratie of KvK
XISAuthConfiguration auth = 5;
}
message RegisterResponse {
string reference = 1;
}
message CompleteRegistrationRequest {
string reference = 1;
string authorisationToken = 2;
}
message CompleteRegistrationResponse {}

@ -0,0 +1,56 @@
syntax = "proto3";
import "google/protobuf/struct.proto";
import "okapi-errors.proto";
option go_package = "whiteboxsystems.nl/okapi";
message Identifier {
string type = 1;
string value = 2;
}
message PatientRegistrationData {
PatientMeta subject = 1;
bool registered = 2;
string id = 3;
google.protobuf.Struct callbackProtocolMeta = 4;
}
message PatientMeta {
repeated Identifier identifier = 1;
string firstname = 2;
string surname = 3;
string surnamePrefix = 4;
string birthdate = 5;
string street = 6;
string streetNumber = 7;
string streetNumberExtension = 8;
string postalCode = 9;
string city = 10;
string country = 11;
google.protobuf.Struct extra = 12;
}
message PatientRegistrationError {
int32 index = 1;
OkAPIError error = 2;
}
// Probably do this steaming (also)?
message UpdatePatientRegistrationRequest {
string serviceId = 1;
repeated PatientRegistrationData PatientRegistrationData = 2;
bool atomicUpdate = 3;
}
message UpdatePatientRegistrationResponse {
repeated PatientRegistrationError errors = 1;
}
message ListPatientRegistrationRequest {
string serviceId = 1;
}
message ListPatientRegistrationResponse {
repeated PatientRegistrationData PatientRegistrationData = 1;
}

@ -0,0 +1,74 @@
syntax = "proto3";
import "google/protobuf/struct.proto";
option go_package = "whiteboxsystems.nl/okapi";
// ConfigureCallback
message ProtocolAuthConfiguration {
string method = 1;
google.protobuf.Struct configuration = 2;
}
enum SubscriptionPolicy {
subnone = 0;
optin = 1;
optout = 2;
}
enum ConsentPolicy {
consentnone = 0;
explicit = 1;
presumed = 2;
}
message ProtocolDefinition {
string protocol = 1;
repeated string authMethods = 2;
}
message ServiceDefinition {
string id = 1;
string name = 2;
string description = 3;
SubscriptionPolicy subscriptionPolicy = 4;
ConsentPolicy consentPolicy = 5;
repeated ProtocolDefinition fetchProtocols = 6;
repeated ProtocolDefinition pushProtocols = 7;
}
message CallbackConfiguration {
string protocol = 1;
google.protobuf.Struct configuration = 2;
ProtocolAuthConfiguration auth = 3;
}
message ConfigureCallbackRequest {
string serviceId = 1;
bool enabled = 2;
CallbackConfiguration fetch = 3;
CallbackConfiguration push = 4;
}
message ConfigureCallbackResponse {
string serviceId = 1;
bool enabled = 2;
CallbackConfiguration fetch = 3;
CallbackConfiguration push = 4;
}
// ListServices
message ServiceConfiguration {
string serviceId = 1;
bool enabled = 2;
CallbackConfiguration fetch = 3;
CallbackConfiguration push = 4;
}
message ListServicesRequest {
}
message ListServicesResponse {
repeated ServiceDefinition availableServices = 1;
repeated ServiceConfiguration configurations = 2;
}

@ -0,0 +1,27 @@
syntax = "proto3";
import "okapi-onboarding.proto";
import "okapi-service-config.proto";
import "okapi-patient-registration.proto";
import "okapi-events.proto";
option go_package = "whiteboxsystems.nl/okapi";
service OkAPI {
// Onboarding
rpc GetMetadata (GetMetadataRequest) returns (GetMetadataResponse) {}
rpc Register (RegisterRequest) returns (RegisterResponse) {}
rpc CompleteRegistration (CompleteRegistrationRequest) returns (CompleteRegistrationResponse) {}
// Configuration
rpc ConfigureCallback (ConfigureCallbackRequest) returns (ConfigureCallbackResponse) {}
rpc ListServices (ListServicesRequest) returns (ListServicesResponse) {}
rpc UpdatePatientRegistration (UpdatePatientRegistrationRequest) returns (UpdatePatientRegistrationResponse) {}
rpc ListPatientRegistration (ListPatientRegistrationRequest) returns (ListPatientRegistrationResponse) {}
// Events
rpc GetEvents (GetEventsRequest) returns (GetEventsResponse) {}
rpc GetEventsStream (GetEventsStreamRequest) returns (stream Event) {}
// rpc RegisterEventCallback (RegisterEventCallbackRequest) returns (RegisterEventCallbackResponse) {}
// rpc ListEventCallbacks (ListEventCallbacksRequest) returns (ListEventCallbacksResponse) {}
}
Loading…
Cancel
Save