docs: use preset.client_builder in examples - #91
Merged
Conversation
The preset already carries the API key (and the iroh-services endpoint address inside it), but the examples reached for `Client::builder`, which starts blank — so readers passed the key twice, or hit "Missing remote endpoint to dial" if they only gave it to the preset. Mirrors n0-computer/iroh-services#100. - setup snippet, access, custom metrics, net diagnostics: build a preset, bind with `preset.clone()`, then `preset.client_builder(&endpoint)` - custom metrics also called `client.metric(name, value)`, which does not exist. Replaced with the real API: a `MetricsGroup` struct registered via `register_metrics_group` Every snippet here was compile-checked against iroh-services main. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013ebw1QzA5dpk9iVDZ29zkz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Docs counterpart to n0-computer/iroh-services#100.
The preset already carries the API key — and the iroh-services endpoint address inside it — but these snippets reached for
Client::builder, which starts blank. Readers either passed the key twice or hit "Missing remote endpoint to dial" when they gave it only to the preset.Now every snippet builds a preset, binds with
preset.clone(), and gets its client frompreset.client_builder(&endpoint):snippets/iroh-services-setup.mdx(Rust block only; the FFI bindings take the key directly)iroh-services/access.mdxiroh-services/metrics/custom.mdxiroh-services/net-diagnostics/quickstart.mdxcustom.mdxalso documentedclient.metric("document_written", 1), which is not a real method. Replaced with the actual API: aMetricsGroup-deriving struct registered throughregister_metrics_group.Every Rust snippet in this PR was compile-checked against iroh-services
mainas a throwaway example.Left alone:
connect-two-endpoints.mdxbinds a plainpresets::N0endpoint and attaches the services client only when the env var is set.Client::builder(&endpoint).api_secret_from_env()sets the remote itself, so that page is correct as written.🤖 Generated with Claude Code
https://claude.ai/code/session_013ebw1QzA5dpk9iVDZ29zkz