Skip to content

Commit

Permalink
Use IAPIFunction instead IAPIFunctionsContainer
Browse files Browse the repository at this point in the history
  • Loading branch information
arenekosreal committed Jul 21, 2024
1 parent b899a23 commit 3551d73
Show file tree
Hide file tree
Showing 728 changed files with 18,054 additions and 729 deletions.
18 changes: 8 additions & 10 deletions E5Renewer/Controllers/JsonAPIV1Controller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,34 @@ public class JsonAPIV1Controller : ControllerBase
{
private readonly ILogger<JsonAPIV1Controller> logger;
private readonly IStatusManager statusManager;
private readonly IEnumerable<IAPIFunctionsContainer> apiFunctionsContainers;
private readonly IEnumerable<IAPIFunction> apiFunctions;
private readonly IUnixTimestampGenerator unixTimestampGenerator;

/// <summary>Initialize controller by logger given.</summary>
/// <param name="logger">The logger to create logs.</param>
/// <param name="statusManager">The <see cref="IStatusManager">IStatusManager</see> implementation.</param>
/// <param name="apiFunctionsContainers">The <see cref="IAPIFunctionsContainer">IAPIFunctionsContainer</see> implementation.</param>
/// <param name="unixTimestampGenerator">The <see cref="IUnixTimestampGenerator">IUnixTimestampGenerator</see> implementation.</param>
/// <param name="statusManager">The <see cref="IStatusManager"/> implementation.</param>
/// <param name="apiFunctions">The <see cref="IAPIFunction"/> implementation.</param>
/// <param name="unixTimestampGenerator">The <see cref="IUnixTimestampGenerator"/> implementation.</param>
/// <remarks>All the params are injected by Asp.Net Core runtime.</remarks>
public JsonAPIV1Controller(
ILogger<JsonAPIV1Controller> logger,
IStatusManager statusManager,
IEnumerable<IAPIFunctionsContainer> apiFunctionsContainers,
IEnumerable<IAPIFunction> apiFunctions,
IUnixTimestampGenerator unixTimestampGenerator
)
{
this.logger = logger;
this.statusManager = statusManager;
this.apiFunctionsContainers = apiFunctionsContainers;
this.apiFunctions = apiFunctions;
this.unixTimestampGenerator = unixTimestampGenerator;
}

/// <summary>Handler for <c>/v1/list_apis</c>.</summary>
[HttpGet("list_apis")]
public Task<InvokeResult> GetListApis()
{
IEnumerable<string> result = this.apiFunctionsContainers.
Select((c) => c.GetAPIFunctions()).
SelectMany((c) => c).
Select((kv) => kv.Key);
IEnumerable<string> result = this.apiFunctions.
Select((c) => c.id);
logger.LogDebug("Getting result [{0}]", string.Join(", ", result));
return Task.FromResult(new InvokeResult(
"list_apis",
Expand Down
16 changes: 0 additions & 16 deletions E5Renewer/Models/GraphAPIs/APIAttribute.cs

This file was deleted.

9 changes: 0 additions & 9 deletions E5Renewer/Models/GraphAPIs/APIFunction.cs

This file was deleted.

25 changes: 25 additions & 0 deletions E5Renewer/Models/GraphAPIs/APIFunctions/Admin/Get.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Microsoft.Graph;

namespace E5Renewer.Models.GraphAPIs.APIFunctions.Admin
{
/// <summary>Admin.Get api implementation.</summary>
public class Get : IAPIFunction
{
/// <inheritdoc/>
public ILogger logger { get; }

/// <summary>Initialize <see cref="Get"/> class.</summary>
/// <param name="logger">The <see cref="ILogger{IAPIFunction}"/> implementation.</param>
/// <remarks>All params should be injected by Asp.Net Core.</remarks>
public Get(ILogger<Get> logger)
{
this.logger = logger;
}

/// <inheritdoc/>
public string id { get => "Admin.Get"; }

/// <inheritdoc/>
public async Task<object?> CallAsync(GraphServiceClient client) => await client.Admin.GetAsync();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Microsoft.Graph;

namespace E5Renewer.Models.GraphAPIs.APIFunctions.AgreementAcceptances
{
/// <summary>AgreementAcceptances.Get api implementation.</summary>
public class Get : IAPIFunction
{
/// <inheritdoc/>
public ILogger logger { get; }

/// <summary>Initialize <see cref="Get"/> class.</summary>
/// <param name="logger">The <see cref="ILogger{IAPIFunction}"/> implementation.</param>
/// <remarks>All params should be injected by Asp.Net Core.</remarks>
public Get(ILogger<Get> logger)
{
this.logger = logger;
}

/// <inheritdoc/>
public string id { get => "AgreementAcceptances.Get"; }

/// <inheritdoc/>
public async Task<object?> CallAsync(GraphServiceClient client) => await client.AgreementAcceptances.GetAsync();
}
}
25 changes: 25 additions & 0 deletions E5Renewer/Models/GraphAPIs/APIFunctions/Agreements/Get.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Microsoft.Graph;

namespace E5Renewer.Models.GraphAPIs.APIFunctions.Agreements
{
/// <summary>Agreements.Get api implementation.</summary>
public class Get : IAPIFunction
{
/// <inheritdoc/>
public ILogger logger { get; }

/// <summary>Initialize <see cref="Get"/> class.</summary>
/// <param name="logger">The <see cref="ILogger{IAPIFunction}"/> implementation.</param>
/// <remarks>All params should be injected by Asp.Net Core.</remarks>
public Get(ILogger<Get> logger)
{
this.logger = logger;
}

/// <inheritdoc/>
public string id { get => "Agreements.Get"; }

/// <inheritdoc/>
public async Task<object?> CallAsync(GraphServiceClient client) => await client.Agreements.GetAsync();
}
}
25 changes: 25 additions & 0 deletions E5Renewer/Models/GraphAPIs/APIFunctions/AppCatalogs/Get.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Microsoft.Graph;

namespace E5Renewer.Models.GraphAPIs.APIFunctions
{
/// <summary>AppCatalogs.Get api implementation.</summary>
public class Get : IAPIFunction
{
/// <inheritdoc/>
public ILogger logger { get; }

/// <summary>Initialize <see cref="Get"/> class.</summary>
/// <param name="logger">The <see cref="ILogger{IAPIFunction}"/> implementation.</param>
/// <remarks>All params should be injected by Asp.Net Core.</remarks>
public Get(ILogger<Get> logger)
{
this.logger = logger;
}

/// <inheritdoc/>
public string id { get => "AppCatalogs.Get"; }

/// <inheritdoc/>
public async Task<object?> CallAsync(GraphServiceClient client) => await client.AppCatalogs.GetAsync();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Microsoft.Graph;

namespace E5Renewer.Models.GraphAPIs.APIFunctions.ApplicationTemplates
{
/// <summary>ApplicationTemplates.Get api implementation.</summary>
public class Get : IAPIFunction
{
/// <inheritdoc/>
public ILogger logger { get; }

/// <summary>Initialize <see cref="Get"/> class.</summary>
/// <param name="logger">The <see cref="ILogger{IAPIFunction}"/> implementation.</param>
/// <remarks>All params should be injected by Asp.Net Core.</remarks>
public Get(ILogger<Get> logger)
{
this.logger = logger;
}

/// <inheritdoc/>
public string id { get => "ApplicationTemplates.Get"; }

/// <inheritdoc/>
public async Task<object?> CallAsync(GraphServiceClient client) => await client.ApplicationTemplates.GetAsync();
}
}
25 changes: 25 additions & 0 deletions E5Renewer/Models/GraphAPIs/APIFunctions/Applications/Get.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Microsoft.Graph;

namespace E5Renewer.Models.GraphAPIs.APIFunctions.Applications
{
/// <summary>Applications.Get api implementation.</summary>
public class Get : IAPIFunction
{
/// <inheritdoc/>
public ILogger logger { get; }

/// <summary>Initialize <see cref="Get"/> class.</summary>
/// <param name="logger">The <see cref="ILogger{IAPIFunction}"/> implementation.</param>
/// <remarks>All params should be injected by Asp.Net Core.</remarks>
public Get(ILogger<Get> logger)
{
this.logger = logger;
}

/// <inheritdoc/>
public string id { get => "Applications.Get"; }

/// <inheritdoc/>
public async Task<object?> CallAsync(GraphServiceClient client) => await client.Applications.GetAsync();
}
}
25 changes: 25 additions & 0 deletions E5Renewer/Models/GraphAPIs/APIFunctions/AuditLogs/Get.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Microsoft.Graph;

namespace E5Renewer.Models.GraphAPIs.APIFunctions.AuditLogs
{
/// <summary>AuditLogs.Get api implementation.</summary>
public class Get : IAPIFunction
{
/// <inheritdoc/>
public ILogger logger { get; }

/// <summary>Initialize <see cref="Get"/> class.</summary>
/// <param name="logger">The <see cref="ILogger{IAPIFunction}"/> implementation.</param>
/// <remarks>All params should be injected by Asp.Net Core.</remarks>
public Get(ILogger<Get> logger)
{
this.logger = logger;
}

/// <inheritdoc/>
public string id { get => "AuditLogs.Get"; }

/// <inheritdoc/>
public async Task<object?> CallAsync(GraphServiceClient client) => await client.AuditLogs.GetAsync();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Microsoft.Graph;

namespace E5Renewer.Models.GraphAPIs.APIFunctions.AuthenticationMethodConfigurations
{
/// <summary>AuthenticationMethodConfigurations.Get api implementation.</summary>
public class Get : IAPIFunction
{
/// <inheritdoc/>
public ILogger logger { get; }

/// <summary>Initialize <see cref="Get"/> class.</summary>
/// <param name="logger">The <see cref="ILogger{IAPIFunction}"/> implementation.</param>
/// <remarks>All params should be injected by Asp.Net Core.</remarks>
public Get(ILogger<Get> logger)
{
this.logger = logger;
}

/// <inheritdoc/>
public string id { get => "AuthenticationMethodConfigurations.Get"; }

/// <inheritdoc/>
public async Task<object?> CallAsync(GraphServiceClient client) => await client.AuthenticationMethodConfigurations.GetAsync();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Microsoft.Graph;

namespace E5Renewer.Models.GraphAPIs.APIFunctions.AuthenticationMethodsPolicy
{
/// <summary>AuthenticationMethodsPolicy.Get api implementation.</summary>
public class Get : IAPIFunction
{
/// <inheritdoc/>
public ILogger logger { get; }

/// <summary>Initialize <see cref="Get"/> class.</summary>
/// <param name="logger">The <see cref="ILogger{IAPIFunction}"/> implementation.</param>
/// <remarks>All params should be injected by Asp.Net Core.</remarks>
public Get(ILogger<Get> logger)
{
this.logger = logger;
}

/// <inheritdoc/>
public string id { get => "AuthenticationMethodsPolicy.Get"; }

/// <inheritdoc/>
public async Task<object?> CallAsync(GraphServiceClient client) => await client.AuthenticationMethodsPolicy.GetAsync();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Microsoft.Graph;

namespace E5Renewer.Models.GraphAPIs.APIFunctions.CertificateBasedAuthConfiguration.Count
{
/// <summary>CertificateBasedAuthConfiguration.Count.Get api implementation.</summary>
public class Get : IAPIFunction
{
/// <inheritdoc/>
public ILogger logger { get; }

/// <summary>Initialize <see cref="Get"/> class.</summary>
/// <param name="logger">The <see cref="ILogger{IAPIFunction}"/> implementation.</param>
/// <remarks>All params should be injected by Asp.Net Core.</remarks>
public Get(ILogger<Get> logger)
{
this.logger = logger;
}

/// <inheritdoc/>
public string id { get => "CertificateBasedAuthConfiguration.Count.Get"; }

/// <inheritdoc/>
public async Task<object?> CallAsync(GraphServiceClient client) => await client.CertificateBasedAuthConfiguration.Count.GetAsync();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Microsoft.Graph;

namespace E5Renewer.Models.GraphAPIs.APIFunctions.CertificateBasedAuthConfiguration
{
/// <summary>CertificateBasedAuthConfiguration.Get api implementation.</summary>
public class Get : IAPIFunction
{
/// <inheritdoc/>
public ILogger logger { get; }

/// <summary>Initialize <see cref="Get"/> class.</summary>
/// <param name="logger">The <see cref="ILogger{IAPIFunction}"/> implementation.</param>
/// <remarks>All params should be injected by Asp.Net Core.</remarks>
public Get(ILogger<Get> logger)
{
this.logger = logger;
}

/// <inheritdoc/>
public string id { get => "CertificateBasedAuthConfiguration.Get"; }

/// <inheritdoc/>
public async Task<object?> CallAsync(GraphServiceClient client) => await client.CertificateBasedAuthConfiguration.GetAsync();
}
}
25 changes: 25 additions & 0 deletions E5Renewer/Models/GraphAPIs/APIFunctions/Chats/Count/Get.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Microsoft.Graph;

namespace E5Renewer.Models.GraphAPIs.APIFunctions.Chats.Count
{
/// <summary>Chats.Count.Get api implementation.</summary>
public class Get : IAPIFunction
{
/// <inheritdoc/>
public ILogger logger { get; }

/// <summary>Initialize <see cref="Get"/> class.</summary>
/// <param name="logger">The <see cref="ILogger{IAPIFunction}"/> implementation.</param>
/// <remarks>All params should be injected by Asp.Net Core.</remarks>
public Get(ILogger<Get> logger)
{
this.logger = logger;
}

/// <inheritdoc/>
public string id { get => "Chats.Count.Get"; }

/// <inheritdoc/>
public async Task<object?> CallAsync(GraphServiceClient client) => await client.Chats.Count.GetAsync();
}
}
Loading

0 comments on commit 3551d73

Please sign in to comment.