refactor!: use idiomatic C# enums for run status/origin, permission level, webhook event types - #4
Closed
Pijukatel wants to merge 5 commits into
Closed
refactor!: use idiomatic C# enums for run status/origin, permission level, webhook event types#4Pijukatel wants to merge 5 commits into
Pijukatel wants to merge 5 commits into
Conversation
…evel, webhook event types Replace stringly-typed API-enum fields with real C# enums (ActorJobStatus, RunOrigin, WebhookEventType, PermissionLevel), each with a ToWireValue mapping. Model outputs (ActorRun.Status, Build.Status, Webhook.EventTypes) and option inputs (LastRunOptions, RunListOptions, ActorStartOptions) are now typed; unknown wire values degrade to null and never throw. Removed the internal Statuses helper. Updated tests, examples, docs, CHANGELOG; bumped 0.1.1 -> 0.2.0. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JvkiV9GQnM5qo4iAnX43K7
…cy, runnable examples - Make ToWireValue public only for WebhookEventType (needed to build webhook defs); ActorJobStatus.ToWireValue and RunOriginExtensions are now internal (ActorJobStatus.IsTerminal stays public). - Scope the models.md/CHANGELOG enum-coverage claim; note fields left as strings. - Spell out full WebhookEventType member names in models.md; document IsTerminal preference; fix ToWireValue publicness claim. - Add runnable Status+Origin (actors.md) and multi-status list (runs.md) snippets with correct usings; extend the CI-run RunAndLastRunStorages example (and its examples.md twin) to exercise RunOrigin and multi-status filtering. - Reword .editorconfig CA1711 justification to cite the API/JS reference only. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JvkiV9GQnM5qo4iAnX43K7
…ippet, align examples preamble Addresses iteration-2 review (N1-N3, doc-only): - CHANGELOG: only WebhookEventType.ToWireValue is public; enums otherwise via typed options/models. - webhooks.md: add using System.Linq for EventTypes?.Contains(...). - examples.md: use ApifyClientOptions form (matches CI runner); token param is string? so no NRT warning. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JvkiV9GQnM5qo4iAnX43K7
…Token Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JvkiV9GQnM5qo4iAnX43K7
…d IsTerminal() example and option-type namespaces Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JvkiV9GQnM5qo4iAnX43K7
Collaborator
Author
|
Contaminated by other implementations. |
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
Refactors the .NET/C# client to be more idiomatic C#, per the updated orchestration consistency requirement ("Consistency with the reference implementation that would go against idiomatic use of the language is not desired") with breaking public-interface changes explicitly permitted. This is not an OpenAPI spec sync — the client remains on
v2-2026-07-07T132551Z. Consistency is kept with the JS reference at the API-surface level, not with sibling clients. Version bumped0.1.1→0.2.0.Idiomatic changes (breaking)
ActorJobStatus(+IsTerminal()),RunOrigin,WebhookEventType(+ToWireValue()) inApify.Client.Models;PermissionLevelinApify.Client.Options.ActorRun.Status/Build.Status→ActorJobStatus?;Webhook.EventTypes→IReadOnlyList<WebhookEventType>?. Unrecognized/absent wire values degrade tonull(or are skipped in lists) and never throw; raw JSON stays reachable viaGet(...)/ToJsonObject().LastRunOptions.Status/Origin,RunListOptions.Status,ActorStartOptions.ForcePermissionLevel.Statuseshelper (terminal logic now onActorJobStatus.IsTerminal()). Enum extension classes arepubliconly when they expose a member consumers need (WebhookEventType.ToWireValue,ActorJobStatus.IsTerminal); the rest areinternal.Tests / docs
Unit/ApiEnumTests.cs(wire mapping, terminal helper, unknown→null / list skip-unknown); updated request-shape/run/webhook tests; the CI-run examples exerciseRunOrigin+ multi-status filtering.actors/runs/webhooks/examplesdocs; CHANGELOG entry added.Verification
dotnet format --verify-no-changes→ build (warnings-as-errors) → unit → integration → examples on this PR.NuGet Trusted-Publishing (OIDC) workflow and package metadata are unchanged.
Generated by Claude Code