Skip to content

Add .NET SDK with dependency-injection integration (Aayush Mishra) - #9

Open
aayushmishraaa wants to merge 1 commit into
superdocsapp:mainfrom
aayushmishraaa:sdk-dotnet
Open

Add .NET SDK with dependency-injection integration (Aayush Mishra)#9
aayushmishraaa wants to merge 1 commit into
superdocsapp:mainfrom
aayushmishraaa:sdk-dotnet

Conversation

@aayushmishraaa

Copy link
Copy Markdown

Aayush Mishra

A .NET client for the SuperDocs API that registers in one line through IHttpClientFactory, so connection pooling, resilience and telemetry come from the host application rather than being reinvented inside the library. Includes a worker-service sample that watches a folder and produces branded documents.

Built for the SuperDocs engineer task.


What's in it

  • Multi-targets net10.0 and net8.0 — current LTS and previous
  • AddSuperDocs(configuration) returns the IHttpClientBuilder, so AddStandardResilienceHandler() is the host's call, not the SDK's
  • Source-generated JSON, nullable enabled, every method async with a CancellationToken, and no synchronous surface at all — a blocking wrapper is the classic deadlock, so the library doesn't offer one
  • 0 warnings / 0 errors on both frameworks under TreatWarningsAsErrors + AnalysisLevel latest-all
  • 38 tests, no API key, no network
  • Packs deterministically with symbols; two clean rebuilds produce a byte-identical assembly

Four API behaviours it absorbs

Each found by calling the live API rather than reading docs, so consumers don't meet them:

  1. Proposed changes are encoded two different ways. metadata.pending_changes returns real objects; the SSE and intermediate_responses paths return a JSON-encoded string. Guidance describing the second parse as universal is true of one path and false of the other — apply it to the polling path and you throw, skip it on streaming and you get nothing.
  2. A large edit arrives in several approval rounds. ReviewAsync drives the whole review; approving once and waiting for completion polls forever (I watched it reach 146 requests).
  3. An unknown operation value used to make the entire change fail to deserialise and vanish silently — a reviewer would approve a batch without being shown one of its edits. It now degrades to Unknown and stays visible.
  4. The upload field is file_base64, not content_base64.

Sample

samples/SuperDocs.Worker.Sample runs from a clean clone with only SUPERDOCS_API_KEY set. AutoApprove defaults to false — an unattended worker that approves its own edits has no human gate, and a sample that pretended otherwise would teach the wrong shape.

Limitations, stated in the README

No large-upload (presigned) path, no multi-document sessions, no template wrapping, a guessed 20-round review bound, and an SSE parser that skips frames it doesn't recognise.

A .NET client that registers through IHttpClientFactory, so pooling, resilience
and telemetry come from the host application rather than being reinvented inside
the library. AddSuperDocs returns the IHttpClientBuilder, and the worker sample
attaches AddStandardResilienceHandler to it.

Multi-targets net10.0 and net8.0 — the current LTS and the previous one, because
enterprise Microsoft-stack teams are frequently a release behind and are exactly
the people who cannot upgrade on someone else's schedule.

Source-generated JSON throughout, nullable enabled, every method async with a
CancellationToken, and no synchronous surface at all. Builds 0 warnings / 0
errors on both frameworks under TreatWarningsAsErrors with AnalysisLevel
latest-all. 38 tests, no API key, no network. Packs deterministically with
symbols; two clean rebuilds produce a byte-identical assembly.

The SDK absorbs four API behaviours so consumers never meet them, each found by
calling the live API rather than by reading docs:

  - Proposed changes are encoded two different ways depending on how you fetch
    them. metadata.pending_changes returns objects; the SSE and
    intermediate_responses paths return a JSON-encoded string. Guidance calling
    the second parse universal is true of one path and false of the other.
  - A large edit arrives in several approval rounds. ReviewAsync drives the whole
    review; approving once and waiting for completion polls forever.
  - An unknown `operation` value used to make the whole change fail to
    deserialise and vanish from the review — a reviewer would approve a batch
    without being shown one of its edits.
  - The upload field is file_base64, not content_base64.

Includes a worker-service sample that watches a folder and produces branded
documents, runnable from a clean clone with only SUPERDOCS_API_KEY set.
AutoApprove defaults to false: an unattended worker that approves its own edits
has no human gate, and a sample that pretended otherwise would teach the wrong
shape.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

1 participant