Skip to content

Feature/auth client foundation#40

Merged
teesofttech merged 4 commits into
masterfrom
feature/auth-client-foundation
Jun 14, 2026
Merged

Feature/auth client foundation#40
teesofttech merged 4 commits into
masterfrom
feature/auth-client-foundation

Conversation

@teesofttech

@teesofttech teesofttech commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Added delete and refresh operations for data sources.
  • Improvements

    • All async operations now support cancellation tokens, enabling better control over long-running API requests across all services (users, groups, projects, permissions, workbooks, and data sources).

Copilot AI review requested due to automatic review settings June 14, 2026 18:54
@teesofttech
teesofttech merged commit 90e8e5f into master Jun 14, 2026
1 of 2 checks passed
@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 90cd6af3-7fd5-489c-bd9b-cb97ff85e9c4

📥 Commits

Reviewing files that changed from the base of the PR and between ec142e3 and 562c45d.

📒 Files selected for processing (19)
  • src/TableauSharp/Common/Http/TableauPublishContentBuilder.cs
  • src/TableauSharp/DataSources/Services/DataSourceService.cs
  • src/TableauSharp/DataSources/Services/IDataSourceService.cs
  • src/TableauSharp/Permissions/Services/IPermissionService.cs
  • src/TableauSharp/Permissions/Services/PermissionService.cs
  • src/TableauSharp/Projects/Services/IProjectService.cs
  • src/TableauSharp/Projects/Services/ProjectService.cs
  • src/TableauSharp/Users/Services/GroupService.cs
  • src/TableauSharp/Users/Services/IGroupService.cs
  • src/TableauSharp/Users/Services/IUserService.cs
  • src/TableauSharp/Users/Services/UserService.cs
  • src/TableauSharp/Workbooks/Services/WorkbookService.cs
  • test/TableauSharp.Tests/Common/SiteScopedServiceTestContext.cs
  • test/TableauSharp.Tests/DataSources/DataSourceServiceTests.cs
  • test/TableauSharp.Tests/Permissions/PermissionServiceTests.cs
  • test/TableauSharp.Tests/Projects/ProjectServiceTests.cs
  • test/TableauSharp.Tests/Users/GroupServiceTests.cs
  • test/TableauSharp.Tests/Users/UserServiceTests.cs
  • test/TableauSharp.Tests/Workbooks/WorkbookServiceTests.cs

📝 Walkthrough

Walkthrough

Introduces TableauPublishContentBuilder, a static utility that assembles multipart Tableau publish payloads with XML-escaped metadata and binary file parts. All service classes (DataSourceService, WorkbookService, PermissionService, ProjectService, UserService, GroupService) are refactored from direct HttpClient injection to IHttpClientFactory + ITableauRequestBuilder. Every service interface method gains an optional CancellationToken. DataSourceService adds DeleteAsync and RefreshAsync. A shared SiteScopedServiceTestContext backs new NUnit test suites covering auth headers, multipart payloads, and error paths.

Changes

ITableauRequestBuilder Migration, Publish Builder, and Test Coverage

Layer / File(s) Summary
TableauPublishContentBuilder: multipart publish payload factory
src/TableauSharp/Common/Http/TableauPublishContentBuilder.cs
New static class validates file inputs against extension allowlists, XML-escapes values via SecurityElement.Escape, and assembles multipart content with a Tableau tsRequest XML part and a binary file part for workbook and data source publish operations.
Service interface contracts: CancellationToken on all methods
src/TableauSharp/DataSources/Services/IDataSourceService.cs, src/TableauSharp/Permissions/Services/IPermissionService.cs, src/TableauSharp/Projects/Services/IProjectService.cs, src/TableauSharp/Users/Services/IGroupService.cs, src/TableauSharp/Users/Services/IUserService.cs
All five service interfaces replace token-less method signatures with CancellationToken cancellationToken = default overloads across every CRUD and permission operation.
DataSourceService and WorkbookService refactored
src/TableauSharp/DataSources/Services/DataSourceService.cs, src/TableauSharp/Workbooks/Services/WorkbookService.cs
DataSourceService drops IOptions/ITableauTokenProvider in favor of IHttpClientFactory + ITableauRequestBuilder, delegates publish content to TableauPublishContentBuilder, and adds DeleteAsync and RefreshAsync. WorkbookService.PublishAsync replaces manual MultipartFormDataContent with TableauPublishContentBuilder.CreateWorkbookContentAsync and moves overwrite to a query parameter.
Permission, Project, User, Group services refactored
src/TableauSharp/Permissions/Services/PermissionService.cs, src/TableauSharp/Projects/Services/ProjectService.cs, src/TableauSharp/Users/Services/UserService.cs, src/TableauSharp/Users/Services/GroupService.cs
All four services adopt IHttpClientFactory + ITableauRequestBuilder, eliminating CreateClient() helpers and stored IOptions/token provider fields. Every method threads CancellationToken through SendAsync and ReadAsStringAsync. PermissionService add and delete flows switch to builder-created PUT/DELETE requests.
Test infrastructure and service test suites
test/TableauSharp.Tests/Common/SiteScopedServiceTestContext.cs, test/TableauSharp.Tests/DataSources/DataSourceServiceTests.cs, test/TableauSharp.Tests/Permissions/PermissionServiceTests.cs, test/TableauSharp.Tests/Projects/ProjectServiceTests.cs, test/TableauSharp.Tests/Users/GroupServiceTests.cs, test/TableauSharp.Tests/Users/UserServiceTests.cs, test/TableauSharp.Tests/Workbooks/WorkbookServiceTests.cs
SiteScopedServiceTestContext wires MockHttpMessageHandler, IHttpClientFactory, ITableauTokenProvider, and TableauRequestBuilder as shared test state. NUnit fixtures for all services validate X-Tableau-Auth headers, assert deserialized responses, verify multipart publish payloads, and cover error paths for missing files, unsupported extensions, and missing project IDs.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐇 A rabbit hopped through the HTTP maze,
Old clients were tangled in IOptions haze.
Now builders and factories hop in a row,
CancellationToken lets the async flow.
Each multipart payload gets properly dressed —
XML-escaped names, extension-checked, blessed! 🎉

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/auth-client-foundation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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