Skip to content

Commit

Permalink
Update the OfX README.md -> Have a missing of OfX documents!
Browse files Browse the repository at this point in the history
  • Loading branch information
quyvu01 committed Dec 28, 2024
1 parent cb5060f commit 2afc00b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 21 deletions.
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,9 @@ public sealed class SomeDataResponse
### 3. Write a Handler in Your Service to Fetch the Data
Implement a handler to process data requests. For example:
```csharp
public class UserRequestHandler(IRequestClient<GetUserOfXQuery> client)
: IMappableRequestHandler<GetUserOfXQuery, UserOfAttribute>
public class UserRequestHandler(): IMappableRequestHandler<UserOfAttribute>
{
public async Task<ItemsResponse<OfXDataResponse>> RequestAsync(
RequestContext<GetUserOfXQuery> request,
CancellationToken cancellationToken = default)
public async Task<ItemsResponse<OfXDataResponse>> RequestAsync(RequestContext<UserOfAttribute> request)
{
// Implement data fetching logic here (e.g., via REST, RPC, or gRPC)
}
Expand Down
32 changes: 16 additions & 16 deletions src/OfX.Tests/Handlers/UserRequestHandler.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// using OfX.Abstractions;
// using OfX.Responses;
// using OfX.Tests.Attributes;
// using OfX.Tests.Models;
//
// namespace OfX.Tests.Handlers;
//
// public sealed class UserRequestHandler(IQueryOfHandler<User, UserOfAttribute> userQueryOf)
// : IMappableRequestHandler<UserOfAttribute>
// {
// public async Task<ItemsResponse<OfXDataResponse>> RequestAsync(RequestContext<UserOfAttribute> context)
// {
// var data = await userQueryOf.GetDataAsync(context);
// return data;
// }
// }
using OfX.Abstractions;
using OfX.Responses;
using OfX.Tests.Attributes;
using OfX.Tests.Models;

namespace OfX.Tests.Handlers;

public sealed class UserRequestHandler(IQueryOfHandler<User, UserOfAttribute> userQueryOf)
: IMappableRequestHandler<UserOfAttribute>
{
public async Task<ItemsResponse<OfXDataResponse>> RequestAsync(RequestContext<UserOfAttribute> context)
{
var data = await userQueryOf.GetDataAsync(context);
return data;
}
}

0 comments on commit 2afc00b

Please sign in to comment.