Skip to content

Commit

Permalink
Add #191 Align APIs to GovStack: Change URL paths for service endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
albinpa committed Oct 4, 2023
1 parent 201a850 commit 20c80f5
Show file tree
Hide file tree
Showing 10 changed files with 140 additions and 1 deletion.
2 changes: 1 addition & 1 deletion resources/config
14 changes: 14 additions & 0 deletions src/handlerv2/servicecreateindividualconsentrecord_handler.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package handlerv2

import (
"net/http"

"github.com/bb-consent/api/src/config"
)

func ServiceCreateIndividualConsentRecord(w http.ResponseWriter, r *http.Request) {

w.Header().Set(config.ContentTypeHeader, config.ContentTypeJSON)
w.WriteHeader(http.StatusOK)

}
14 changes: 14 additions & 0 deletions src/handlerv2/servicelistindividualrecordlist_handler.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package handlerv2

import (
"net/http"

"github.com/bb-consent/api/src/config"
)

func ServiceListIndividualRecordList(w http.ResponseWriter, r *http.Request) {

w.Header().Set(config.ContentTypeHeader, config.ContentTypeJSON)
w.WriteHeader(http.StatusOK)

}
14 changes: 14 additions & 0 deletions src/handlerv2/servicereadindividualrecordread_handler.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package handlerv2

import (
"net/http"

"github.com/bb-consent/api/src/config"
)

func ServiceReadIndividualRecordRead(w http.ResponseWriter, r *http.Request) {

w.Header().Set(config.ContentTypeHeader, config.ContentTypeJSON)
w.WriteHeader(http.StatusOK)

}
14 changes: 14 additions & 0 deletions src/handlerv2/serviceupdateindividualconsentrecord_handler.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package handlerv2

import (
"net/http"

"github.com/bb-consent/api/src/config"
)

func ServiceUpdateIndividualConsentRecord(w http.ResponseWriter, r *http.Request) {

w.Header().Set(config.ContentTypeHeader, config.ContentTypeJSON)
w.WriteHeader(http.StatusOK)

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package handlerv2

import (
"net/http"

"github.com/bb-consent/api/src/config"
)

func ServiceVerificationAgreementConsentRecordRead(w http.ResponseWriter, r *http.Request) {

w.Header().Set(config.ContentTypeHeader, config.ContentTypeJSON)
w.WriteHeader(http.StatusOK)

}
14 changes: 14 additions & 0 deletions src/handlerv2/serviceverificationagreementlist_handler.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package handlerv2

import (
"net/http"

"github.com/bb-consent/api/src/config"
)

func ServiceVerificationAgreementList(w http.ResponseWriter, r *http.Request) {

w.Header().Set(config.ContentTypeHeader, config.ContentTypeJSON)
w.WriteHeader(http.StatusOK)

}
14 changes: 14 additions & 0 deletions src/handlerv2/serviceverificationconsentrecordlist_handler.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package handlerv2

import (
"net/http"

"github.com/bb-consent/api/src/config"
)

func ServiceVerificationConsentRecordList(w http.ResponseWriter, r *http.Request) {

w.Header().Set(config.ContentTypeHeader, config.ContentTypeJSON)
w.WriteHeader(http.StatusOK)

}
21 changes: 21 additions & 0 deletions src/httppathsv2/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,25 @@ func SetRoutes(r *mux.Router, e *casbin.Enforcer) {
r.Handle(DeleteAPIKey, m.Chain(handler.DeleteAPIKey, m.Logger(), m.Authorize(e), m.SetApplicationMode(), m.Authenticate())).Methods("DELETE")
r.Handle(GetAPIKey, m.Chain(handler.GetAPIKey, m.Logger(), m.Authorize(e), m.SetApplicationMode(), m.Authenticate())).Methods("GET")

// Service api(s)

// Data agreements
r.Handle(ServiceDataAgreementRead, m.Chain(handler.GetDataAgreementById, m.Logger(), m.Authorize(e), m.SetApplicationMode(), m.Authenticate())).Methods("GET")

// Global policy configuration
r.Handle(ServicePolicyRead, m.Chain(handler.GetGlobalPolicyConfiguration, m.Logger(), m.Authorize(e), m.SetApplicationMode(), m.Authenticate())).Methods("GET")

// Data attributes
r.Handle(ServiceGetDataAttributes, m.Chain(handler.GetDataAttributes, m.Logger(), m.Authorize(e), m.SetApplicationMode(), m.Authenticate())).Methods("GET")

// Verification mechanisms
r.Handle(ServiceVerificationAgreementList, m.Chain(handler.ServiceVerificationAgreementList, m.Logger(), m.Authorize(e), m.SetApplicationMode(), m.Authenticate())).Methods("GET")
r.Handle(ServiceVerificationAgreementConsentRecordRead, m.Chain(handler.ServiceVerificationAgreementConsentRecordRead, m.Logger(), m.Authorize(e), m.SetApplicationMode(), m.Authenticate())).Methods("GET")
r.Handle(ServiceVerificationConsentRecordList, m.Chain(handler.ServiceVerificationConsentRecordList, m.Logger(), m.Authorize(e), m.SetApplicationMode(), m.Authenticate())).Methods("GET")

// Recording consent
r.Handle(ServiceCreateIndividualConsentRecord, m.Chain(handler.ServiceCreateIndividualConsentRecord, m.Logger(), m.Authorize(e), m.SetApplicationMode(), m.Authenticate())).Methods("POST")
r.Handle(ServiceUpdateIndividualConsentRecord, m.Chain(handler.ServiceUpdateIndividualConsentRecord, m.Logger(), m.Authorize(e), m.SetApplicationMode(), m.Authenticate())).Methods("PUT")
r.Handle(ServiceListIndividualRecordList, m.Chain(handler.ServiceListIndividualRecordList, m.Logger(), m.Authorize(e), m.SetApplicationMode(), m.Authenticate())).Methods("GET")
r.Handle(ServiceReadIndividualRecordRead, m.Chain(handler.ServiceReadIndividualRecordRead, m.Logger(), m.Authorize(e), m.SetApplicationMode(), m.Authenticate())).Methods("GET")
}
20 changes: 20 additions & 0 deletions src/httppathsv2/service_paths.go
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
package httppathsv2

// Data agreements
const ServiceDataAgreementRead = "/v2/service/data-agreement/{dataAgreementId}/"

// Global policy configuration
const ServicePolicyRead = "/v2/service/policy"

// Data attributes
const ServiceGetDataAttributes = "/v2/service/data-agreements/data-attributes"

// Verification mechanisms
const ServiceVerificationAgreementList = "/v2/service/verification/data-agreements/"
const ServiceVerificationAgreementConsentRecordRead = "/v2/service/verification/data-agreement/"
const ServiceVerificationConsentRecordList = "/v2/service/verification/records"

// Recording consent
const ServiceCreateIndividualConsentRecord = "/v2/service/individual/data-agreement/{dataAgreementId}/record"
const ServiceUpdateIndividualConsentRecord = "/v2/service/individual/data-agreement/{dataAgreementRecordId}"
const ServiceListIndividualRecordList = "/v2/service/individual/record/data-agreement/"
const ServiceReadIndividualRecordRead = "/v2/service/individual/record/data-agreement/{dataAgreementId}/"

0 comments on commit 20c80f5

Please sign in to comment.