Move login/logout into the generic dispatcher #2
Labels
No labels
nagonag
nagonag/ignore
bug
doc
duplicate
enhancement
help wanted
invalid
question
security
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
IUS/joker-dmapi-client#2
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Plan 5: Move login/logout into the generic dispatcher
Goal
loginandlogoutappear inListAPICalls()and work like every other command.Remove the special-case
if cmd == "login"block inrun().Schema changes (
dmapi/api.yaml)Add a new top-level boolean field
auth-required(defaults to true).Set it to
falseonloginandlogout.Generator changes (
dmapi/gen/main.go+dmapi/api.go.template)AuthRequired boolto themodelstruct (default true).AuthRequired boolonAPICallstruct.APICall.AuthRequiredfrom the YAML field.Runtime changes (
dmapi/request.go/dmapi/client.go)Client.DochecksAPICall.AuthRequired; if false, skip cookie restore andthe re-login retry loop.
Loginresult handling (print "login ok") intorun()after the genericio.Copy, or letLoginResultbody carry the TLD list.LoginResulttypeCurrently defined by hand in
login.go. Once the generator can emit it, the hand-written type can be removed. Until then, the generated code can embed it by name
(
LoginResult:in theresult:map — same pattern asBasicResult:).Notes
client.Login()stays as a direct method used internally for re-auth on 401.The generic dispatcher calls
client.Do()which in turn callsclient.Login()on session expiry — so there is no circular dependency.
logoutjust needsBasicResult; no extra fields.AI attribution comment added per repository instruction for this open issue.\n\n(co)authored by ai:gpt-5-codex