Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Improve channel set and service health methods #1938

Merged
merged 1 commit into from
Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 6 additions & 36 deletions src/Commands/Utilities/ServiceHealthUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,8 @@ internal static class ServiceHealthUtility
/// <returns>List with <see cref="ServiceUpdateMessage"> objects</returns>
public static async Task<IEnumerable<ServiceUpdateMessage>> GetServiceUpdateMessagesAsync(HttpClient httpClient, string accessToken)
{
var returnCollection = new List<ServiceUpdateMessage>();
var collection = await GraphHelper.GetAsync<RestResultCollection<ServiceUpdateMessage>>(httpClient, $"v1.0/admin/serviceAnnouncement/messages", accessToken);
if (collection != null && collection.Items.Any())
{
returnCollection = collection.Items.ToList();
while (!string.IsNullOrEmpty(collection.NextLink))
{
collection = await GraphHelper.GetAsync<RestResultCollection<ServiceUpdateMessage>>(httpClient, collection.NextLink, accessToken);
returnCollection.AddRange(collection.Items);
}
}
return returnCollection;
var collection = await GraphHelper.GetResultCollectionAsync<ServiceUpdateMessage>(httpClient, $"v1.0/admin/serviceAnnouncement/messages", accessToken);
return collection;
}

/// <summary>
Expand Down Expand Up @@ -214,18 +204,8 @@ public static async Task<bool> SetServiceUpdateMessageAsNotfavoriteByIdAsync(str
/// <returns>List with <see cref="ServiceHealthIssue"> objects</returns>
public static async Task<IEnumerable<ServiceHealthIssue>> GetServiceHealthIssuesAsync(HttpClient httpClient, string accessToken)
{
var returnCollection = new List<ServiceHealthIssue>();
var collection = await GraphHelper.GetAsync<RestResultCollection<ServiceHealthIssue>>(httpClient, $"v1.0/admin/serviceAnnouncement/issues", accessToken);
if (collection != null && collection.Items.Any())
{
returnCollection = collection.Items.ToList();
while (!string.IsNullOrEmpty(collection.NextLink))
{
collection = await GraphHelper.GetAsync<RestResultCollection<ServiceHealthIssue>>(httpClient, collection.NextLink, accessToken);
returnCollection.AddRange(collection.Items);
}
}
return returnCollection;
var collection = await GraphHelper.GetResultCollectionAsync<ServiceHealthIssue>(httpClient, $"v1.0/admin/serviceAnnouncement/issues", accessToken);
return collection;
}

/// <summary>
Expand Down Expand Up @@ -253,18 +233,8 @@ public static async Task<ServiceHealthIssue> GetServiceHealthIssueByIdAsync(stri
/// <returns>List with <see cref="ServiceHealthCurrent"> objects</returns>
public static async Task<IEnumerable<ServiceHealthCurrent>> GetServiceCurrentHealthAsync(HttpClient httpClient, string accessToken)
{
var returnCollection = new List<ServiceHealthCurrent>();
var collection = await GraphHelper.GetAsync<RestResultCollection<ServiceHealthCurrent>>(httpClient, $"v1.0/admin/serviceAnnouncement/healthOverviews", accessToken);
if (collection != null && collection.Items.Any())
{
returnCollection = collection.Items.ToList();
while (!string.IsNullOrEmpty(collection.NextLink))
{
collection = await GraphHelper.GetAsync<RestResultCollection<ServiceHealthCurrent>>(httpClient, collection.NextLink, accessToken);
returnCollection.AddRange(collection.Items);
}
}
return returnCollection;
var collection = await GraphHelper.GetResultCollectionAsync<ServiceHealthCurrent>(httpClient, $"v1.0/admin/serviceAnnouncement/healthOverviews", accessToken);
return collection;
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/Utilities/TeamsUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ public static async Task<TeamChannelMessageReply> GetMessageReplyAsync(HttpClien

public static async Task<TeamChannel> UpdateChannelAsync(HttpClient httpClient, string accessToken, string groupId, string channelId, TeamChannel channel)
{
return await GraphHelper.PatchAsync(httpClient, accessToken, $"beta/teams/{groupId}/channels/{channelId}", channel);
return await GraphHelper.PatchAsync(httpClient, accessToken, $"v1.0/teams/{groupId}/channels/{channelId}", channel);
}
#endregion

Expand Down