Skip to content

feat: add of(...) convenience factory to StockQuotesRequest and OptionsQuotesRequest#18

Merged
MarketDataDev03 merged 1 commit into
mainfrom
17_add_convinence_factory
Jun 29, 2026
Merged

feat: add of(...) convenience factory to StockQuotesRequest and OptionsQuotesRequest#18
MarketDataDev03 merged 1 commit into
mainfrom
17_add_convinence_factory

Conversation

@MarketDataDev03

Copy link
Copy Markdown
Collaborator

feat: add of(...) convenience factory to StockQuotesRequest and OptionsQuotesRequest

Closes #17.

Every request type in the SDK exposes a paired construction surface — Foo.of(required...)
(convenience factory, required args only) and Foo.builder(required...) (full builder for
optionals). Two multi-symbol request types were missing the of(...) half and only had
builder(...):

  • StockQuotesRequest
  • OptionsQuotesRequest

Their varargs sibling StockPricesRequest already has both, so this was an accidental omission,
not a design choice — a consumer wanting a no-options multi-symbol quote was forced into
.builder(...).build() for no reason.

Changes

  • StockQuotesRequest.of(String first, String... rest) — mirrors StockPricesRequest.of.
  • OptionsQuotesRequest.of(String first, String... rest) — same.
  • Each is a one-line shortcut for builder(first, rest...).build().
  • Added unit tests in RequestValidationTest covering both factories (symbols carried, optionals
    default to null).
// before
client.stocks().quotes(StockQuotesRequest.builder("AAPL", "MSFT").build());
// after
client.stocks().quotes(StockQuotesRequest.of("AAPL", "MSFT"));

Testing

  • ./gradlew build passes: unit tests, Spotless, and jacocoTestCoverageVerification
    (100% line coverage is maintained — the new factories are exercised by the added tests).

Motivation

The API-section docs in MarketDataApp/documentation#154
add Java/Kotlin examples for every endpoint. The multi-symbol quote examples were the only ones
that couldn't use the minimal .of(...) form because of this gap; once this ships they read as
cleanly as the rest.

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

The author of this PR, MarketDataDev03, is not an activated member of this organization on Codecov.
Please activate this user on Codecov to display this PR comment.
Coverage data is still being uploaded to Codecov.io for purposes of overall coverage calculations.
Please don't hesitate to email us at support@codecov.io with any questions.

@MarketDataApp

Copy link
Copy Markdown
Owner

It looks good to me. This is what I wanted to see:

// before
client.stocks().quotes(StockQuotesRequest.builder("AAPL", "MSFT").build());
// after
client.stocks().quotes(StockQuotesRequest.of("AAPL", "MSFT"));

I'll defer to @MarketDataDev01 on the code review, however.

@MarketDataDev03 MarketDataDev03 force-pushed the 17_add_convinence_factory branch from 974058a to ca3704e Compare June 29, 2026 14:23
@MarketDataDev03 MarketDataDev03 merged commit 5884519 into main Jun 29, 2026
5 checks passed
@MarketDataDev03 MarketDataDev03 deleted the 17_add_convinence_factory branch June 29, 2026 14:25
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.

Add of(...) convenience factory to StockQuotesRequest and OptionsQuotesRequest

3 participants