feat: add a QueryParams multimap and route query manipulation through it#147
feat: add a QueryParams multimap and route query manipulation through it#147OmarAlJarrah wants to merge 1 commit into
Conversation
Introduce an immutable, insertion-ordered, multi-valued QueryParams type in
http.common, modelled on Headers: private constructor, mutable Builder with
add/set/remove, get(name)/values(name)/contains(name)/names()/entries(), and
external (decoded) vs encoded (application/x-www-form-urlencoded, UTF-8) forms
via encode()/parse(). Unlike Headers, names are case-sensitive and values may be
empty or value-less (?flag), matching how query strings appear on the wire.
Replace the placeholder QueryParam stub (and its NotImplementedError test) with
this real, public type.
Rewire pagination's RequestRebuilder to use QueryParams for query manipulation
instead of split('&') string surgery; the PageNumber/Cursor/LinkHeader
strategies flow through the rebuilder unchanged. The previous approach only
handled single-valued params and re-implemented percent-encoding inline.
Document, in docs/http.md, the request-URL model decision this commits to: keep
java.net.URL as the resolved URL container (preserving DNS-free textual equality)
and layer QueryParams for query manipulation, rather than a fully deconstructed
URL value object. Add the QueryParams Common Types section and File Index entry,
and regenerate the sdk-core API snapshot.
|
This adds a public Issues
Worth double-checking
|
Summary
Adds a first-class
QueryParamsmultimap and routes pagination's query manipulation through it, replacing the placeholderQueryParamstub and thesplit('&')string surgery inRequestRebuilder.What changed
QueryParamstype (org.dexpace.sdk.core.http.common) — immutable, insertion-ordered, multi-valued, modelled onHeaders: private constructor +Builderwithadd/set/remove, plusget(name)/values(name)/contains(name)/names()/entries()/size()/isEmpty(). External (decoded) vs encoded (application/x-www-form-urlencoded, UTF-8) forms viaencode()and the inverseparse(query), which round-trips names, values, and order. UnlikeHeaders, names are case-sensitive and values may be empty or value-less (?flag), matching how query strings appear on the wire.@JvmStaticfactories (builder(),empty(),parse(...)) for Java callers.QueryParamstub (fun implementation(): Nothing = TODO()) and itsNotImplementedErrortest.RequestRebuilderto parseurl.queryintoQueryParams, mutate through the builder, and re-encode — no moresplit('&'). ThePageNumber/Cursor/LinkHeaderstrategies flow through the rebuilder unchanged.java.net.URLas the resolved URL container, preserving DNS-free textual equality, and layerQueryParamsfor query manipulation, rather than a fully deconstructed URL value object) with rationale; adds theQueryParamsCommon Types section and File Index entry.sdk-core/api/sdk-core.api.Note for reviewers
This overlaps with PR #145 (pagination unification) — both touch
RequestRebuilder. Please sequence the merges; whichever lands second will need a small rebase on that file.Gated build (scoped, run locally — no CI yet)
Result: BUILD SUCCESSFUL.
QueryParamsTestand all pagination strategy tests (PageNumberPaginationTest,CursorPaginationTest,LinkHeaderPaginationTest, plus laziness/cap/single-read suites) pass; ktlint, detekt, and apiCheck are green.:sdk-core:apiDumpwas run and the regenerated snapshot committed.Closes #28
Closes #29