Skip to content

Feature parity with the .NET client - #24

Open
akselkvitberg wants to merge 6 commits into
8-event-message-attributesfrom
feature/dotnet-parity
Open

akselkvitberg wants to merge 6 commits into
8-event-message-attributesfrom
feature/dotnet-parity

Conversation

@akselkvitberg

Copy link
Copy Markdown
Member

Summary

Brings the Go SDK to feature parity with the .NET PubSubClient (bcc-code/bcc-pubsub, including the signed deliveries in bcc-code/bcc-pubsub#181 and the Node counterpart bcc-code/bcc-pubsub#192). Parity is split over several PRs:

PR Change
#16 ProblemDetails errors (*pubsubsdk.Error)
#17 PublishRequestData.Message → Data
#18 Publish Attributes
#19 Subscribe Orgs
#20 EventMessage Attributes
this PR Delete subscription, Dispatch, Subscribe response, ScheduleTime, scopes
#22 Verify signed push deliveries (X-PubSub-Token)

#16–#20 were closed earlier because only Core API uses this SDK. They are reopened for parity. This PR is stacked on #20; merge the stack in order, retargeting each PR to main as the one below it merges.

Changes

  • DeleteSubscription(ctx, type, subscriptionID) → DELETE /Subscriptions/{type}?subscriptionId=. Built on Reng's commit from feature/Delete-subscription-endpoint (authorship kept). The type is path-escaped and the query is built with url.Values; before, the ? went through url.JoinPath and was encoded into the path.
  • Subscribe returns *model.SubscribeResponse, as in .NET. Breaking: callers that use err := client.Subscribe(...) need _, err :=.
  • Dispatch(ctx, model.DispatchPayload) (*model.DispatchResponse, error) → POST /Dispatch, and DeleteTask(ctx, dispatchID) → DELETE /Dispatch/Delete?dispatchId=.
  • PublishRequestData.ScheduleTime (optional, left out of the JSON when unset).
  • Scopes ScopePubSubDeliver and ScopePubSubDispatch.
  • README with usage for each operation and error handling.

Differences from .NET that remain

  • .NET adds SubscribeRequest.Scopes to the token it requests per call. The Go client takes scopes once in WithClientCredentials, so the credentials must include every scope used. Documented on each method and in the README.
  • The environment URLs still point to api.bcc.no/pubsub. .NET and Node use pubsub.api.bcc.no; update pubsub api path #2 and update pubsub endpoints in the sdk #3 change this and are not part of this PR.
  • The .NET EventType/MessageScopes reflection helpers and the Wolverine integration have no Go counterpart.

Existing users

Core API needs Message → Data (#17) and, if it calls Subscribe, the new return value, when it bumps the SDK.

Verification

  • go build ./..., go vet ./... and go test ./... pass.
  • New tests use httptest and cover, for each operation, the method, the path, the query and the exact JSON keys, plus the decoded response. They also cover:
    • path escaping of /, spaces and ?
    • empty IDs, which return an error without sending a request
    • scheduleTime sent as RFC 3339 and left out when unset
    • 400 ProblemDetails returned as *Error

🤖 Generated with Claude Code

rvanoord and others added 6 commits October 13, 2026 13:37
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Escape the type as a path segment and build the query with url.Values,
reject an empty type, and add tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <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.

2 participants