Skip to content

Commit 9e03193

Browse files
committed
- add summary info for documentation files
- add license acceptance requirement to add package - bump version
1 parent 04e7ccf commit 9e03193

File tree

4 files changed

+99
-2
lines changed

4 files changed

+99
-2
lines changed

Directory.Build.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
1717
<PackageReadmeFile>README.md</PackageReadmeFile>
1818
<PackageLicenseExpression>MIT</PackageLicenseExpression>
19+
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
1920

20-
<Version>0.4.2</Version>
21+
<Version>0.4.3</Version>
2122
</PropertyGroup>
2223
</Project>

src/ModEndpoints.Core/[Configuration]/MapToGroupAttribute.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
namespace ModEndpoints.Core;
22

33
/// <summary>
4-
///
4+
/// Attribute to map targeted endpoint or route group under specified parent route group.
55
/// </summary>
6+
/// <typeparam name="TGroup"></typeparam>
67
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
78
public class MapToGroupAttribute<TGroup> : Attribute
89
where TGroup : IRouteGroupConfigurator, new()

src/ModEndpoints.RemoteServices/DependencyInjectionExtensions.cs

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ public static class DependencyInjectionExtensions
1111
private const string ChannelAlreadyRegistered = "A channel for request type {0} is already registered.";
1212
private const string ChannelCannotBeRegistered = "Channel couldn't be registered for request type {0} and client name {1}.";
1313

14+
/// <summary>
15+
/// Adds and configures a new client for specified ServiceEndpoint request.
16+
/// </summary>
17+
/// <typeparam name="TRequest">ServiceEndpoint request type to be processed.</typeparam>
18+
/// <param name="services"></param>
19+
/// <param name="baseAddress">Base address of Uri of the Internet resource used when sending requests.</param>
20+
/// <param name="timeout">Timespan to wait before the request times out.</param>
21+
/// <param name="configureClientBuilder">Delegate to further customize <see cref="IHttpClientBuilder"/> for added <see cref="HttpClient"/>.</param>
22+
/// <returns></returns>
1423
public static IServiceCollection AddRemoteServiceWithNewClient<TRequest>(
1524
this IServiceCollection services,
1625
string baseAddress,
@@ -26,6 +35,16 @@ public static IServiceCollection AddRemoteServiceWithNewClient<TRequest>(
2635
configureClientBuilder);
2736
}
2837

38+
/// <summary>
39+
/// Adds and configures a new client for specified ServiceEndpoint request.
40+
/// </summary>
41+
/// <typeparam name="TRequest">ServiceEndpoint request type to be processed.</typeparam>
42+
/// <param name="services"></param>
43+
/// <param name="clientName">The logical name for the client to configure.</param>
44+
/// <param name="baseAddress">Base address of Uri of the Internet resource used when sending requests.</param>
45+
/// <param name="timeout">Timespan to wait before the request times out.</param>
46+
/// <param name="configureClientBuilder">Delegate to further customize <see cref="IHttpClientBuilder"/> for added <see cref="HttpClient"/>.</param>
47+
/// <returns></returns>
2948
public static IServiceCollection AddRemoteServiceWithNewClient<TRequest>(
3049
this IServiceCollection services,
3150
string clientName,
@@ -48,6 +67,14 @@ public static IServiceCollection AddRemoteServiceWithNewClient<TRequest>(
4867
configureClientBuilder);
4968
}
5069

70+
/// <summary>
71+
/// Adds and configures a new client for specified ServiceEndpoint request.
72+
/// </summary>
73+
/// <typeparam name="TRequest">ServiceEndpoint request type to be processed.</typeparam>
74+
/// <param name="services"></param>
75+
/// <param name="configureClient">Delegate that will be used to configure <see cref="HttpClient"/>.</param>
76+
/// <param name="configureClientBuilder">Delegate to further customize <see cref="IHttpClientBuilder"/> for added <see cref="HttpClient"/>.</param>
77+
/// <returns></returns>
5178
public static IServiceCollection AddRemoteServiceWithNewClient<TRequest>(
5279
this IServiceCollection services,
5380
Action<IServiceProvider, HttpClient> configureClient,
@@ -61,6 +88,16 @@ public static IServiceCollection AddRemoteServiceWithNewClient<TRequest>(
6188
configureClientBuilder);
6289
}
6390

91+
/// <summary>
92+
/// Adds and configures a new client for specified ServiceEndpoint request.
93+
/// </summary>
94+
/// <typeparam name="TRequest">ServiceEndpoint request type to be processed.</typeparam>
95+
/// <param name="services"></param>
96+
/// <param name="clientName">The logical name for the client to configure.</param>
97+
/// <param name="configureClient">Delegate that will be used to configure <see cref="HttpClient"/>.</param>
98+
/// <param name="configureClientBuilder">Delegate to further customize <see cref="IHttpClientBuilder"/> for added <see cref="HttpClient"/>.</param>
99+
/// <returns></returns>
100+
/// <exception cref="InvalidOperationException"></exception>
64101
public static IServiceCollection AddRemoteServiceWithNewClient<TRequest>(
65102
this IServiceCollection services,
66103
string clientName,
@@ -80,6 +117,14 @@ public static IServiceCollection AddRemoteServiceWithNewClient<TRequest>(
80117
configureClientBuilder);
81118
}
82119

120+
/// <summary>
121+
/// Adds specified ServiceEndpoint request to an already added and configured client.
122+
/// </summary>
123+
/// <typeparam name="TRequest">ServiceEndpoint request type to be processed.</typeparam>
124+
/// <param name="services"></param>
125+
/// <param name="clientName">The logical name for the client to configure.</param>
126+
/// <returns></returns>
127+
/// <exception cref="InvalidOperationException"></exception>
83128
public static IServiceCollection AddRemoteServiceToExistingClient<TRequest>(
84129
this IServiceCollection services,
85130
string clientName)
@@ -92,6 +137,17 @@ public static IServiceCollection AddRemoteServiceToExistingClient<TRequest>(
92137
return services.AddRemoteServiceToExistingClientInternal(typeof(TRequest), clientName);
93138
}
94139

140+
/// <summary>
141+
/// Adds and configures a new client for ServiceEndpoint requests in specified assembly.
142+
/// </summary>
143+
/// <param name="services"></param>
144+
/// <param name="fromAssembly">Name of the assembly that will be scanned for ServiceEndpoint requests.</param>
145+
/// <param name="clientName">The logical name for the client to configure.</param>
146+
/// <param name="configureClient">Delegate that will be used to configure <see cref="HttpClient"/>.</param>
147+
/// <param name="configureClientBuilder">Delegate to further customize <see cref="IHttpClientBuilder"/> for added <see cref="HttpClient"/>.</param>
148+
/// <param name="requestFilterPredicate">A predicate to filter ServiceEndpoint requests found, before being processed.</param>
149+
/// <returns></returns>
150+
/// <exception cref="InvalidOperationException"></exception>
95151
public static IServiceCollection AddRemoteServicesWithNewClient(
96152
this IServiceCollection services,
97153
Assembly fromAssembly,
@@ -128,6 +184,15 @@ public static IServiceCollection AddRemoteServicesWithNewClient(
128184
return services;
129185
}
130186

187+
/// <summary>
188+
/// Adds ServiceEndpoint requests in specified assembly to an already added and configured client.
189+
/// </summary>
190+
/// <param name="services"></param>
191+
/// <param name="fromAssembly">Name of the assembly that will be scanned for ServiceEndpoint requests.</param>
192+
/// <param name="clientName">The logical name for the client to configure.</param>
193+
/// <param name="requestFilterPredicate">A predicate to filter ServiceEndpoint requests found, before being processed.</param>
194+
/// <returns></returns>
195+
/// <exception cref="InvalidOperationException"></exception>
131196
public static IServiceCollection AddRemoteServicesToExistingClient(
132197
this IServiceCollection services,
133198
Assembly fromAssembly,

src/ModEndpoints.RemoteServices/IServiceChannel.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,25 @@
44
using ModResults;
55

66
namespace ModEndpoints.RemoteServices;
7+
8+
/// <summary>
9+
/// ServiceEndpoint channel for sending requests to remote services via configured clients.
10+
/// </summary>
711
public interface IServiceChannel
812
{
13+
/// <summary>
14+
/// Sends request to remote service endpoint.
15+
/// </summary>
16+
/// <typeparam name="TRequest">Type of ServiceEndpoint request that will be sent.</typeparam>
17+
/// <typeparam name="TResponse">ServiceEndpoint response type.</typeparam>
18+
/// <param name="req">Request to be sent.</param>
19+
/// <param name="ct">The <see cref="CancellationToken"/> to cancel operation.</param>
20+
/// <param name="endpointUriPrefix">Path to append as prefix to resolved enpoint uri. Usually used to add path segments to configured client's base address.</param>
21+
/// <param name="mediaType">The media type to use for the content.</param>
22+
/// <param name="jsonSerializerOptions">Options to control the behavior during serialization.</param>
23+
/// <param name="configureRequestHeaders">Delegate to configure HTTP request headers.</param>
24+
/// <param name="uriResolverName"><see cref="IServiceEndpointUriResolver"/> name to be used to resolve ServiceEnpoint Uri.</param>
25+
/// <returns>Response of remote service endpoint or failure result.</returns>
926
Task<Result<TResponse>> SendAsync<TRequest, TResponse>(
1027
TRequest req,
1128
CancellationToken ct,
@@ -16,6 +33,19 @@ Task<Result<TResponse>> SendAsync<TRequest, TResponse>(
1633
string? uriResolverName = null)
1734
where TRequest : IServiceRequest<TResponse>
1835
where TResponse : notnull;
36+
37+
/// <summary>
38+
/// Sends request to remote service endpoint.
39+
/// </summary>
40+
/// <typeparam name="TRequest">Type of ServiceEndpoint request that will be sent.</typeparam>
41+
/// <param name="req">Request to be sent.</param>
42+
/// <param name="ct">The <see cref="CancellationToken"/> to cancel operation.</param>
43+
/// <param name="endpointUriPrefix">Path to append as prefix to resolved enpoint uri. Usually used to add path segments to configured client's base address.</param>
44+
/// <param name="mediaType">The media type to use for the content.</param>
45+
/// <param name="jsonSerializerOptions">Options to control the behavior during serialization.</param>
46+
/// <param name="configureRequestHeaders">Delegate to configure HTTP request headers.</param>
47+
/// <param name="uriResolverName"><see cref="IServiceEndpointUriResolver"/> name to be used to resolve ServiceEnpoint Uri.</param>
48+
/// <returns>Response of remote service endpoint or failure result.</returns>
1949
Task<Result> SendAsync<TRequest>(
2050
TRequest req,
2151
CancellationToken ct,

0 commit comments

Comments
 (0)