Skip to content

refactor: add webapi service layer#10

Merged
alanshaw merged 9 commits into
mainfrom
ash/refactor/webapi-service-layer
Mar 13, 2026
Merged

refactor: add webapi service layer#10
alanshaw merged 9 commits into
mainfrom
ash/refactor/webapi-service-layer

Conversation

@alanshaw

@alanshaw alanshaw commented Jan 23, 2026

Copy link
Copy Markdown
Member

Looking to write a new client for this and the first step is to ensure we can test it against an API backend. This PR decouples the database layer from the API allowing an API to be run in tests that uses a mock backend.

This is mostly a mechanical change, however it does add a tested spid package that allows parsing and formatting a FIL-SPID-V0 header.

refs storacha/spade-agent#7
resolves #13

@alanshaw
alanshaw marked this pull request as ready for review January 28, 2026 18:57
@alanshaw
alanshaw requested a review from a team January 28, 2026 19:00

@frrist frrist left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trusting this is mostly a mechanical change of things, LGTM

Comment on lines +36 to +52
reqJ, err := json.Marshal(
struct {
Method string
Host string
Path string
Params string
ParamsSigned url.Values
Headers http.Header
}{
Method: req.Method,
Host: req.Host,
Path: req.Path,
Params: req.Params.Encode(),
ParamsSigned: signedArgs,
Headers: req.Headers,
},
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels kinda weird to have this as an anonymous struct, your call.

@alanshaw
alanshaw merged commit 70434fc into main Mar 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor to allow test coverage to exist

2 participants