Skip to content

Commit d0a768f

Browse files
authored
Merge pull request #46 from teesofttech/copilot/update-readme-file
Reviewing the codebase and updating README file
2 parents 88dc5a7 + 9995238 commit d0a768f

1 file changed

Lines changed: 116 additions & 29 deletions

File tree

README.md

Lines changed: 116 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
## Features
88

9-
- **Authentication** (Personal Access Token or Username/Password)
10-
- **User & Group Management** (CRUD operations, role assignments)
11-
- **Project Management** (create, update, organize)
12-
- **Workbooks & Views** (fetch, export, publish)
13-
- **Data Sources** (list, refresh, permissions)
14-
- **Permissions API** (assign/revoke capabilities, sync with external systems)
15-
- **Embedding Support** (trusted tickets, URL helpers)
9+
- **Authentication** (Personal Access Token, Username/Password, or Connected App JWT)
10+
- **User & Group Management** (CRUD operations, group membership)
11+
- **Project Management** (create, update, delete)
12+
- **Workbooks & Views** (list, publish, delete, export views as PDF/PNG/CSV)
13+
- **Data Sources** (list, publish, refresh, delete)
14+
- **Permissions API** (get, add, and delete capabilities on workbooks, projects, and data sources)
15+
- **Embedding Support** (trusted tickets, embed URL helpers)
1616
- **Common Models & Utilities** (strongly typed POCOs, pagination, error handling)
1717

1818
---
@@ -25,10 +25,12 @@ Install prerelease packages from NuGet as modules reach preview quality:
2525
dotnet add package TableauSharp --prerelease
2626
```
2727

28-
For now, clone the repository:
28+
Or clone the repository to build locally:
2929

3030
```bash
3131
git clone https://github.com/teesofttech/TableauSharp.git
32+
cd TableauSharp
33+
dotnet build TableauSharp.sln
3234
```
3335

3436
Maintainers can publish prerelease packages from GitHub Actions after the [Module Completion Gate](docs/module-completion.md) is met. See [Release Process](docs/release.md).
@@ -37,54 +39,91 @@ Maintainers can publish prerelease packages from GitHub Actions after the [Modul
3739

3840
## Configuration (appsettings.json)
3941

40-
Add your Tableau settings in `appsettings.json`:
42+
Add your Tableau settings in `appsettings.json`. Include only the fields relevant to the authentication method you plan to use.
4143

4244
```json
4345
{
4446
"TableauOptions": {
4547
"Server": "https://your-tableau-server",
4648
"Version": "3.23",
47-
"Site": "yoursite"
49+
"Site": "your-site-name"
4850
},
4951
"TableauAuthOptions": {
50-
"SiteContentUrl": "yoursite",
51-
"PersonalAccessTokenName": "your-token-name",
52-
"PersonalAccessTokenSecret": "your-token-secret",
52+
"SiteContentUrl": "your-site-name",
53+
54+
// Personal Access Token (recommended for server-side apps)
55+
"PersonalAccessTokenName": "your-pat-name",
56+
"PersonalAccessTokenSecret": "your-pat-secret",
57+
58+
// Username & Password
59+
"Username": "your-username",
60+
"Password": "your-password",
61+
62+
// Connected App / JWT
63+
"SecretId": "your-connected-app-secret-id",
64+
"SecretValue": "your-connected-app-secret-value",
65+
"Jwt_Expiry_Minutes": 10,
66+
"Jwt_Audience": "https://your-tableau-server",
67+
"Scopes": "tableau:views:read tableau:workbooks:read tableau:datasources:read",
68+
5369
"UsePAT": true
5470
}
5571
}
5672
```
5773

74+
> **Note:** Comments (`//`) are not valid JSON. Remove them before use or switch to `appsettings.Development.json`.
75+
5876
---
5977

6078
## Dependency Injection Setup
6179

6280
Register TableauSharp in `Program.cs` (or `Startup.cs`):
6381

6482
```csharp
65-
using TableauSharp.Common.Models;
6683
using TableauSharp.Extensions;
6784

6885
var builder = WebApplication.CreateBuilder(args);
6986

70-
// Register Tableau services
7187
builder.Services.AddTableauSharp(builder.Configuration);
7288

7389
var app = builder.Build();
7490
```
7591

92+
`AddTableauSharp` registers all services — `IAuthService`, `IUserService`, `IGroupService`, `IProjectService`, `IWorkbookService`, `IViewService`, `IDataSourceService`, `IPermissionService`, and `IEmbeddingService` — as scoped dependencies.
93+
7694
---
7795

7896
## Authentication Lifecycle
7997

80-
Call one of the sign-in methods before using site-scoped services:
98+
Call one of the sign-in methods before using site-scoped services. The token is stored automatically in the scoped `ITableauTokenProvider` and injected into all other services.
99+
100+
### Personal Access Token (recommended)
101+
102+
```csharp
103+
var token = await authService.SignInWithPATAsync();
104+
```
105+
106+
### Username & Password
107+
108+
```csharp
109+
var token = await authService.SignInWithUserCredentialsAsync();
110+
```
111+
112+
### Connected App / JWT
113+
114+
```csharp
115+
var token = await authService.SignInWithJWTAsync("user@example.com");
116+
```
117+
118+
Configure `SecretId`, `SecretValue`, `Jwt_Expiry_Minutes`, `Jwt_Audience`, and `Scopes` in `TableauAuthOptions`.
119+
120+
### Sign Out
81121

82122
```csharp
83-
var authToken = await authService.SignInWithPATAsync();
84-
var workbooks = await workbookService.GetAllAsync();
123+
await authService.SignOutAsync(token.Token);
85124
```
86125

87-
Successful sign-in stores the Tableau auth token, site LUID, site content URL, user LUID, and expiration in the scoped Tableau session. Site-scoped REST requests use the signed-in site LUID returned by Tableau, not the friendly site content URL.
126+
Successful sign-in stores the Tableau auth token, site LUID, site content URL, user LUID, and expiration. Site-scoped REST requests use the signed-in site LUID returned by Tableau, not the friendly site content URL.
88127

89128
The built-in session is scoped for a single logical caller. Server applications that serve multiple Tableau users should create an appropriate DI scope per caller/request or manage user-specific sessions explicitly.
90129

@@ -97,44 +136,92 @@ The built-in session is scoped for a single logical caller. Server applications
97136
```csharp
98137
public class WorkbooksController : ControllerBase
99138
{
139+
private readonly IAuthService _authService;
100140
private readonly IWorkbookService _workbookService;
101141

102-
public WorkbooksController(IWorkbookService workbookService)
142+
public WorkbooksController(IAuthService authService, IWorkbookService workbookService)
103143
{
144+
_authService = authService;
104145
_workbookService = workbookService;
105146
}
106147

107148
[HttpGet("workbooks")]
108149
public async Task<IActionResult> GetWorkbooks()
109150
{
151+
await _authService.SignInWithPATAsync();
110152
var workbooks = await _workbookService.GetAllAsync();
111153
return Ok(workbooks);
112154
}
113155
}
114156
```
115157

158+
### Export a View
159+
160+
```csharp
161+
var export = await viewService.ExportViewAsync(new ExportRequest
162+
{
163+
ViewId = "view-id",
164+
Format = "PNG" // PNG, PDF, or CSV
165+
});
166+
167+
await File.WriteAllBytesAsync(export.FileName, export.FileContent);
168+
```
169+
170+
---
171+
172+
## Running the Examples
173+
174+
The `samples/TableauSharp.Examples` project is a runnable console app that demonstrates every service.
175+
176+
```bash
177+
cd samples/TableauSharp.Examples
178+
179+
# Show available examples
180+
dotnet run
181+
182+
# Run a specific example
183+
dotnet run -- auth # Sign in with PAT, JWT, credentials
184+
dotnet run -- users # User & group CRUD
185+
dotnet run -- projects # Project CRUD
186+
dotnet run -- workbooks # List, publish, export workbooks
187+
dotnet run -- datasources # List, publish, refresh data sources
188+
dotnet run -- permissions # Get, grant, revoke permissions
189+
dotnet run -- embedding # Trusted ticket & embed URLs
190+
```
191+
192+
Configure real Tableau credentials in `samples/TableauSharp.Examples/appsettings.json` before running.
193+
116194
---
117195

118196
## Project Structure
119197

120198
```
121199
TableauSharp/
122-
├── Auth/ # Authentication services
123-
├── Users/ # User & Group management
124-
├── Workbooks/ # Workbooks and Views
125-
├── DataSources/ # Data sources
126-
├── Projects/ # Project management
127-
├── Permissions/ # Permissions management
128-
├── Embedding/ # Trusted tickets and embedding
129-
└── Common/ # Shared models, enums, utilities
200+
├── src/
201+
│ └── TableauSharp/ # SDK source code
202+
│ ├── Auth/ # Authentication services (PAT, credentials, JWT)
203+
│ ├── Users/ # User & Group management
204+
│ ├── Workbooks/ # Workbooks and Views (list, publish, export)
205+
│ ├── DataSources/ # Data source management and refresh
206+
│ ├── Projects/ # Project management
207+
│ ├── Permissions/ # Permissions for workbooks, projects, data sources
208+
│ ├── Embedding/ # Trusted tickets and embed URL helpers
209+
│ ├── Extensions/ # IServiceCollection extension (AddTableauSharp)
210+
│ ├── Settings/ # TableauOptions and TableauAuthOptions
211+
│ └── Common/ # Shared models, enums, HTTP helpers, token provider
212+
├── samples/
213+
│ └── TableauSharp.Examples/ # Runnable console app with per-module examples
214+
├── test/
215+
│ └── TableauSharp.Tests/ # Unit tests
216+
└── docs/ # Module completion gate and release process docs
130217
```
131218

132219
---
133220

134221
## Roadmap
135222

136223
### v0.1.0 (Preview)
137-
- Authentication
224+
- Authentication (PAT, Username/Password, Connected App JWT)
138225
- Fetch workbooks & export views
139226
- Basic permissions support
140227

0 commit comments

Comments
 (0)