Skip to content

Commit

Permalink
Expose directoryObject get/list
Browse files Browse the repository at this point in the history
Jabe committed Oct 18, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 6a61e76 commit 3fec68c
Showing 3 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
using SlimLib.Auth.Azure;
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;

namespace SlimLib.Microsoft.Graph
{
public interface ISlimGraphDirectoryObjectsClient
{
Task<JsonDocument?> GetObjectAsync(IAzureTenant tenant, Guid objectID, ScalarRequestOptions? options = default, CancellationToken cancellationToken = default);

IAsyncEnumerable<JsonDocument> GetObjectsAsync(IAzureTenant tenant, ListRequestOptions? options = default, CancellationToken cancellationToken = default);

IAsyncEnumerable<Guid[]> CheckMemberGroupsAsync(IAzureTenant tenant, Guid objectID, ICollection<Guid> groupIDs, InvokeRequestOptions? options = default, CancellationToken cancellationToken = default);
IAsyncEnumerable<Guid[]> GetMemberGroupsAsync(IAzureTenant tenant, Guid objectID, bool securityEnabledOnly, InvokeRequestOptions? options = default, CancellationToken cancellationToken = default);

Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ public interface ISlimGraphClient
ISlimGraphApplicationsClient Applications { get; }
ISlimGraphAuditEventsClient AuditEvents { get; }
ISlimGraphAuditLogsClient AuditLogs { get; }
ISlimGraphDirectoryObjectsClient DirectoryObjects { get; }
ISlimGraphOrganizationsClient Organization { get; }
ISlimGraphOrgContactsClient OrgContacts { get; }
ISlimGraphDevicesClient Devices { get; }
Original file line number Diff line number Diff line change
@@ -6,11 +6,26 @@
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Threading;
using System.Threading.Tasks;

namespace SlimLib.Microsoft.Graph
{
partial class SlimGraphClientImpl
{
async Task<JsonDocument?> ISlimGraphDirectoryObjectsClient.GetObjectAsync(IAzureTenant tenant, Guid objectID, ScalarRequestOptions? options, CancellationToken cancellationToken)
{
var link = BuildLink(options, $"directoryObjects/{objectID}");

return await GetAsync(tenant, link, new RequestHeaderOptions(), cancellationToken).ConfigureAwait(false);
}

IAsyncEnumerable<JsonDocument> ISlimGraphDirectoryObjectsClient.GetObjectsAsync(IAzureTenant tenant, ListRequestOptions? options, [EnumeratorCancellation] CancellationToken cancellationToken)
{
var nextLink = BuildLink(options, "directoryObjects");

return GetArrayAsync(tenant, nextLink, options, cancellationToken);
}

IAsyncEnumerable<Guid[]> ISlimGraphDirectoryObjectsClient.CheckMemberGroupsAsync(IAzureTenant tenant, Guid objectID, ICollection<Guid> groupIDs, InvokeRequestOptions? options, CancellationToken cancellationToken)
=> CheckMemberGroupsImplAsync(tenant, "directoryObjects", objectID.ToString(), groupIDs, options, cancellationToken);

0 comments on commit 3fec68c

Please sign in to comment.