Skip to content

Commit

Permalink
Merged PR 211122: [CSHARP SDK] Document Admin properties in Admin API…
Browse files Browse the repository at this point in the history
…s only Report/Dataset/Dashboard/Tile/Dataflow

Preview of the API docs : https://review.docs.microsoft.com/en-us/rest/api/power-bi/admin/workspace-info-get-scan-result?branch=split

**Issue:**
The Report object has properties returned by admin APIS only and not by Reports and Apps APIs.
Also scanner APIs (WorksapceInfo) returns dedicated properties like sensitivity labels and endorsementDetails, but don't return url properties (weburl, embedUrl, ...).
This is confusing for users of the SDK and REST API spec.

**Solution:**
Have 3 different object: one for Report, AdminReport and WorksapceInfo Report
The

Minor BREAKING CHANGES -  don't require a Major version upgrade IMHO
 1.  The Admin APIs will return an AdminReport object instead of a Report object with all the properties except sensitivityLabel andEndorsementDetails
 2.  The Reports and Apps API will still return a Report object but cannot reference one of the properties
 listed above
 3. The scanner APIs will return all the properties  except Url properties (embedUrl,....)

Note the same issue exists for Dataflows and Dashboard but this is not in the scope of this change, because of low priority.
  • Loading branch information
laurent-mic committed Nov 25, 2021
1 parent e2dceed commit a710d5a
Show file tree
Hide file tree
Showing 82 changed files with 4,964 additions and 640 deletions.
4 changes: 2 additions & 2 deletions .pipelines/pipeline.user.windows.official.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version:
name: 'sdk version'
major: 3
minor: 31
major: 4
minor: 0
system: 'Buildrevision'
exclude_commit: true
assembly_version: 'majorminoronly'
Expand Down
2 changes: 1 addition & 1 deletion scripts/pack-sdk.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ call .\init-dev-cmd.cmd
REM Set Major and Minor package version
SET MAJOR=%CDP_MAJOR_NUMBER_ONLY%
SET MINOR=%CDP_MINOR_NUMBER_ONLY%
SET PATCH=2
SET PATCH=0
if "%MAJOR%"=="" SET MAJOR=0
if "%MINOR%"=="" SET MINOR=0

Expand Down
2 changes: 1 addition & 1 deletion sdk/PowerBI.Api.Tests/ReportTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private IPowerBIClient CreatePowerBIClient(HttpClientHandler handler)

private static HttpResponseMessage CreateSampleReportResponse(string name = default(string))
{
var report = new Report(Guid.NewGuid(), "Report Name", "AN URL", "EMBEDURL");
var report = new Report(id: Guid.NewGuid(), name: "Report Name", webUrl: "AN URL", embedUrl: "EMBEDURL");

return new HttpResponseMessage(HttpStatusCode.OK)
{
Expand Down
4 changes: 2 additions & 2 deletions sdk/PowerBI.Api/Extensions/DashboardsOperationsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public static Dashboard GetDashboard(this IDashboardsOperations operations, Guid
/// <param name='skip'>
/// Skips the first n results
/// </param>
public static Dashboards GetDashboardsAsAdmin(this IDashboardsOperations operations, Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?))
public static AdminDashboards GetDashboardsAsAdmin(this IDashboardsOperations operations, Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?))
{
return operations.GetDashboardsInGroupAsAdminAsync(groupId, filter, top, skip).GetAwaiter().GetResult();
}
Expand Down Expand Up @@ -182,7 +182,7 @@ public static Dashboard GetDashboard(this IDashboardsOperations operations, Guid
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Dashboards> GetDashboardsAsAdminAsync(this IDashboardsOperations operations, Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?), CancellationToken cancellationToken = default(CancellationToken))
public static async Task<AdminDashboards> GetDashboardsAsAdminAsync(this IDashboardsOperations operations, Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetDashboardsInGroupAsAdminWithHttpMessagesAsync(groupId, filter, top, skip, null, cancellationToken).ConfigureAwait(false))
{
Expand Down
4 changes: 2 additions & 2 deletions sdk/PowerBI.Api/Extensions/DatasetsOperationsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static Datasets GetDatasets(this IDatasetsOperations operations, Guid gro
/// <param name='expand'>
/// Expands related entities inline
/// </param>
public static Datasets GetDatasetsAsAdmin(this IDatasetsOperations operations, Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?), string expand = default(string))
public static AdminDatasets GetDatasetsAsAdmin(this IDatasetsOperations operations, Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?), string expand = default(string))
{
return operations.GetDatasetsInGroupAsAdminAsync(groupId, filter, top, skip, expand).GetAwaiter().GetResult();
}
Expand Down Expand Up @@ -108,7 +108,7 @@ public static Datasets GetDatasets(this IDatasetsOperations operations, Guid gro
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Datasets> GetDatasetsAsAdminAsync(this IDatasetsOperations operations, Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?), string expand = default(string), CancellationToken cancellationToken = default(CancellationToken))
public static async Task<AdminDatasets> GetDatasetsAsAdminAsync(this IDatasetsOperations operations, Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?), string expand = default(string), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetDatasetsInGroupAsAdminWithHttpMessagesAsync(groupId, filter, top, skip, expand, null, cancellationToken).ConfigureAwait(false))
{
Expand Down
4 changes: 2 additions & 2 deletions sdk/PowerBI.Api/Extensions/ReportsOperationsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static Reports GetReports(this IReportsOperations operations, Guid groupI
/// <param name='skip'>
/// Skips the first n results
/// </param>
public static Reports GetReportsAsAdmin(this IReportsOperations operations, Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?))
public static AdminReports GetReportsAsAdmin(this IReportsOperations operations, Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?))
{
return operations.GetReportsInGroupAsAdminAsync(groupId, filter, top, skip).GetAwaiter().GetResult();
}
Expand Down Expand Up @@ -103,7 +103,7 @@ public static Reports GetReports(this IReportsOperations operations, Guid groupI
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Reports> GetReportsAsAdminAsync(this IReportsOperations operations, Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?), CancellationToken cancellationToken = default(CancellationToken))
public static async Task<AdminReports> GetReportsAsAdminAsync(this IReportsOperations operations, Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetReportsInGroupAsAdminWithHttpMessagesAsync(groupId, filter, top, skip, null, cancellationToken).ConfigureAwait(false))
{
Expand Down
18 changes: 9 additions & 9 deletions sdk/PowerBI.Api/Source/DashboardsOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2124,7 +2124,7 @@ public DashboardsOperations(PowerBIClient client)
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<HttpOperationResponse<Dashboards>> GetDashboardsInGroupAsAdminWithHttpMessagesAsync(System.Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
public async Task<HttpOperationResponse<AdminDashboards>> GetDashboardsInGroupAsAdminWithHttpMessagesAsync(System.Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
Expand Down Expand Up @@ -2226,7 +2226,7 @@ public DashboardsOperations(PowerBIClient client)
throw ex;
}
// Create Result
var _result = new HttpOperationResponse<Dashboards>();
var _result = new HttpOperationResponse<AdminDashboards>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
// Deserialize Response
Expand All @@ -2235,7 +2235,7 @@ public DashboardsOperations(PowerBIClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Dashboards>(_responseContent, Client.DeserializationSettings);
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<AdminDashboards>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
Expand Down Expand Up @@ -2305,7 +2305,7 @@ public DashboardsOperations(PowerBIClient client)
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<HttpOperationResponse<Dashboards>> GetDashboardsAsAdminWithHttpMessagesAsync(string expand = default(string), string filter = default(string), int? top = default(int?), int? skip = default(int?), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
public async Task<HttpOperationResponse<AdminDashboards>> GetDashboardsAsAdminWithHttpMessagesAsync(string expand = default(string), string filter = default(string), int? top = default(int?), int? skip = default(int?), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
Expand Down Expand Up @@ -2410,7 +2410,7 @@ public DashboardsOperations(PowerBIClient client)
throw ex;
}
// Create Result
var _result = new HttpOperationResponse<Dashboards>();
var _result = new HttpOperationResponse<AdminDashboards>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
// Deserialize Response
Expand All @@ -2419,7 +2419,7 @@ public DashboardsOperations(PowerBIClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Dashboards>(_responseContent, Client.DeserializationSettings);
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<AdminDashboards>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
Expand Down Expand Up @@ -2479,7 +2479,7 @@ public DashboardsOperations(PowerBIClient client)
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<HttpOperationResponse<Tiles>> GetTilesAsAdminWithHttpMessagesAsync(System.Guid dashboardId, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
public async Task<HttpOperationResponse<AdminTiles>> GetTilesAsAdminWithHttpMessagesAsync(System.Guid dashboardId, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
Expand Down Expand Up @@ -2561,7 +2561,7 @@ public DashboardsOperations(PowerBIClient client)
throw ex;
}
// Create Result
var _result = new HttpOperationResponse<Tiles>();
var _result = new HttpOperationResponse<AdminTiles>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
// Deserialize Response
Expand All @@ -2570,7 +2570,7 @@ public DashboardsOperations(PowerBIClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Tiles>(_responseContent, Client.DeserializationSettings);
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<AdminTiles>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
Expand Down
12 changes: 6 additions & 6 deletions sdk/PowerBI.Api/Source/DashboardsOperationsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ public static EmbedToken GenerateTokenInGroup(this IDashboardsOperations operati
/// <param name='skip'>
/// Skips the first n results
/// </param>
public static Dashboards GetDashboardsInGroupAsAdmin(this IDashboardsOperations operations, System.Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?))
public static AdminDashboards GetDashboardsInGroupAsAdmin(this IDashboardsOperations operations, System.Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?))
{
return operations.GetDashboardsInGroupAsAdminAsync(groupId, filter, top, skip).GetAwaiter().GetResult();
}
Expand Down Expand Up @@ -961,7 +961,7 @@ public static EmbedToken GenerateTokenInGroup(this IDashboardsOperations operati
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Dashboards> GetDashboardsInGroupAsAdminAsync(this IDashboardsOperations operations, System.Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?), CancellationToken cancellationToken = default(CancellationToken))
public static async Task<AdminDashboards> GetDashboardsInGroupAsAdminAsync(this IDashboardsOperations operations, System.Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetDashboardsInGroupAsAdminWithHttpMessagesAsync(groupId, filter, top, skip, null, cancellationToken).ConfigureAwait(false))
{
Expand Down Expand Up @@ -1008,7 +1008,7 @@ public static EmbedToken GenerateTokenInGroup(this IDashboardsOperations operati
/// <param name='skip'>
/// Skips the first n results
/// </param>
public static Dashboards GetDashboardsAsAdmin(this IDashboardsOperations operations, string expand = default(string), string filter = default(string), int? top = default(int?), int? skip = default(int?))
public static AdminDashboards GetDashboardsAsAdmin(this IDashboardsOperations operations, string expand = default(string), string filter = default(string), int? top = default(int?), int? skip = default(int?))
{
return operations.GetDashboardsAsAdminAsync(expand, filter, top, skip).GetAwaiter().GetResult();
}
Expand Down Expand Up @@ -1055,7 +1055,7 @@ public static EmbedToken GenerateTokenInGroup(this IDashboardsOperations operati
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Dashboards> GetDashboardsAsAdminAsync(this IDashboardsOperations operations, string expand = default(string), string filter = default(string), int? top = default(int?), int? skip = default(int?), CancellationToken cancellationToken = default(CancellationToken))
public static async Task<AdminDashboards> GetDashboardsAsAdminAsync(this IDashboardsOperations operations, string expand = default(string), string filter = default(string), int? top = default(int?), int? skip = default(int?), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetDashboardsAsAdminWithHttpMessagesAsync(expand, filter, top, skip, null, cancellationToken).ConfigureAwait(false))
{
Expand Down Expand Up @@ -1092,7 +1092,7 @@ public static EmbedToken GenerateTokenInGroup(this IDashboardsOperations operati
/// <param name='dashboardId'>
/// The dashboard ID
/// </param>
public static Tiles GetTilesAsAdmin(this IDashboardsOperations operations, System.Guid dashboardId)
public static AdminTiles GetTilesAsAdmin(this IDashboardsOperations operations, System.Guid dashboardId)
{
return operations.GetTilesAsAdminAsync(dashboardId).GetAwaiter().GetResult();
}
Expand Down Expand Up @@ -1129,7 +1129,7 @@ public static Tiles GetTilesAsAdmin(this IDashboardsOperations operations, Syste
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Tiles> GetTilesAsAdminAsync(this IDashboardsOperations operations, System.Guid dashboardId, CancellationToken cancellationToken = default(CancellationToken))
public static async Task<AdminTiles> GetTilesAsAdminAsync(this IDashboardsOperations operations, System.Guid dashboardId, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetTilesAsAdminWithHttpMessagesAsync(dashboardId, null, cancellationToken).ConfigureAwait(false))
{
Expand Down
Loading

0 comments on commit a710d5a

Please sign in to comment.