Files
go-onlyoffice/CHANGELOG.md
T
eSlider 7ff947faa7 feat(auth): AuthenticateContext + InvalidateToken for long-running syncs
Adds two helpers tailored for cron-driven or watcher-style clients:

- AuthenticateContext(ctx) — cancellable variant of Authenticate(). Bypasses
  the non-context Query() path and POSTs /api/2.0/authentication.json directly,
  so a stalled auth call never outlives the caller's deadline.
- InvalidateToken() — zeroes the cached *Token. Next request (or Authenticate*)
  forces a fresh auth. Intended for mid-sync 401 recovery when the server has
  revoked/rotated the session while local Expires still looks fresh.

Plain Authenticate() is unchanged; it remains a convenience wrapper.

Unit tests cover cache-hit, forced refresh, and context-cancellation paths.

Refs eSlider/inventar-sync#3, ASR-0008.

Made-with: Cursor
2026-04-24 12:22:26 +01:00

2.6 KiB

Changelog

All notable changes to this project are documented here. The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[Unreleased]

[0.3.1] - 2026-04-24

Added

  • AuthenticateContext(ctx) — context-aware auth that honours cancellation and deadlines. Preferred entry point for long-running syncs (cron, watchers).
  • InvalidateToken() — clears the cached token to force re-auth on the next request. Use this to recover from a mid-sync 401 when the server has revoked the session while the local Expires timestamp still looks fresh.

Notes

  • Plain Authenticate() is unchanged and remains a convenience wrapper around AuthenticateContext(context.Background()).
  • No breaking changes; a patch release.

[0.3.0] - 2026-04-24

Added

  • Calendar helpers: ListCalendars, ListEvents, AddEvent, DeleteEvent.
  • CRM helpers: contacts (ListContacts, GetContact, FindCompany, FindPerson, CreateCompany, CreatePerson, AddContactInfo, DeleteContact), deals (ListOpportunities, GetOpportunity, CreateOpportunity, AddOpportunityMember, ListDealStages, DeleteOpportunity), cases (ListCases, CreateCase, AddCaseMember, DeleteCase), CRM tasks (ListCRMTasks, CreateCRMTask, DeleteCRMTask, ListTaskCategories), and history notes (AddHistoryNote).
  • Project task extras: GetProjectByID, ListTasks, ListAllTasks, GetTaskByID, AddTask, AddSubtask, UpdateTaskStatus, DeleteTask.
  • File upload: UploadOpportunityFile (multipart).
  • SelfUserID cached lookup of people/@self.
  • Defaults struct + SetDefaults + GetEnvironmentDefaults for optional calendar/project fallbacks.
  • Alias env vars accepted by GetEnvironmentCredentials: ONLYOFFICE_HOST / ONLYOFFICE_NAME / ONLYOFFICE_PASSWORD.
  • Public Authenticate() that primes the token eagerly.
  • Bundled CLI: cmd/oo-cli (Cobra) with commands cal-list, cal-events, cal-add, cal-delete, task-list, task-add, subtask-add, task-update, crm-contacts, crm-add-contact, crm-deals, crm-add-deal, crm-cases, applications-sync.
  • httptest-based unit tests for form / multipart / CRM helpers.

Changed

  • The onlyoffice.Client struct gained unexported fields (defaults, selfID, noteCatID); the public API is unchanged and remains backwards compatible.

[0.2.0] - earlier

  • Badges, docs expansion (Gitea sync use case, Gantt/PM workflows).

[0.1.0] - earlier

  • Initial release: OnlyOffice Project Management API client.