Add EDU server wiring

This commit is contained in:
Neil Alexander 2021-07-28 14:06:23 +01:00
parent dcadec88d9
commit 8683f7553f
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
9 changed files with 105 additions and 0 deletions

View file

@ -15,6 +15,7 @@ const (
EDUServerInputTypingEventPath = "/eduserver/input"
EDUServerInputSendToDeviceEventPath = "/eduserver/sendToDevice"
EDUServerInputReceiptEventPath = "/eduserver/receipt"
EDUServerInputSigningKeyUpdatePath = "/eduserver/signingKeyUpdate"
)
// NewEDUServerClient creates a EDUServerInputAPI implemented by talking to a HTTP POST API.
@ -68,3 +69,16 @@ func (h *httpEDUServerInputAPI) InputReceiptEvent(
apiURL := h.eduServerURL + EDUServerInputReceiptEventPath
return httputil.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
}
// InputSigningKeyUpdate implements EDUServerInputAPI
func (h *httpEDUServerInputAPI) InputSigningKeyUpdate(
ctx context.Context,
request *api.InputSigningKeyUpdateRequest,
response *api.InputSigningKeyUpdateResponse,
) error {
span, ctx := opentracing.StartSpanFromContext(ctx, "InputSigningKeyUpdate")
defer span.Finish()
apiURL := h.eduServerURL + EDUServerInputSigningKeyUpdatePath
return httputil.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
}