Add HasDataChangedAsync for lightweight change detection via HEAD request#47
Open
jfversluis wants to merge 1 commit intonikneem:mainfrom
Open
Add HasDataChangedAsync for lightweight change detection via HEAD request#47jfversluis wants to merge 1 commit intonikneem:mainfrom
jfversluis wants to merge 1 commit intonikneem:mainfrom
Conversation
Adds a new HasDataChangedAsync method to ISessionizeApiClient that uses Sessionize's built-in ?hashonly=true query parameter to fetch a lightweight hash (~40 bytes) of the data for any view endpoint. Consumers can compare this hash against a previously stored value to determine if a full data download (~300KB for the All view) is necessary. Returns a DataChangedResponse record with: - HasChanged: whether the server hash differs from the provided hash - Hash: the current server hash to store for subsequent checks Includes unit tests (7) with mocked HttpClient and integration tests (6) against the live Sessionize API. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
721f60e to
97c5bd8
Compare
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.
Summary
Adds a new
HasDataChangedAsyncmethod toISessionizeApiClientthat uses Sessionize's built-in?hashonly=truequery parameter to fetch a lightweight hash of the data for any view endpoint, avoiding a full data download.Motivation
Mobile and bandwidth-constrained apps (e.g., conference companion apps built with .NET MAUI) need to periodically check for schedule updates. The current approach requires a full GET request (~300KB for the
Allview). Sessionize supports a?hashonly=truequery parameter that returns only a ~40-byte SHA-1 hash of the data, which changes whenever the underlying data changes.This is especially valuable for:
How it works
Appending
?hashonly=trueto any Sessionize view endpoint returns just the hash:Each view (
All,Sessions,Speakers,GridSmart,SpeakerWall) returns its own hash.Changes
New DTO
DataChangedResponse(bool HasChanged, string Hash)— a record containing whether data changed and the current server hashInterface addition
ISessionizeApiClient.HasDataChangedAsync(viewName, lastKnownHash?, sessionizeApiId?, cancellationToken?)viewName: The Sessionize view to check (e.g., "All", "Sessions", "Speakers", "GridSmart", "SpeakerWall")lastKnownHash: The hash from a previous call. If null, returnsHasChanged=truewith the current server hashsessionizeApiIdandcancellationTokenpattern as existing methodsImplementation
{apiId}/view/{viewName}?hashonly=truelastKnownHash(case-insensitive)GetViewEndpoint()helper for consistent URL constructionILoggerTests
Usage Example
Backward Compatibility
This is a purely additive change:
ISessionizeApiClient(interface addition)DataChangedResponseDTO