-
Notifications
You must be signed in to change notification settings - Fork 5
/
SearchMatchlobbies.cs
33 lines (30 loc) · 1.18 KB
/
SearchMatchlobbies.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Azure.Documents.Client;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using PlayFab.Plugins.CloudScript;
using TicTacToeFunctions.Models.Requests;
using TicTacToeFunctions.Models.Responses;
using TicTacToeFunctions.Util;
namespace TicTacToeFunctions.Functions
{
public static class SearchMatchLobbies
{
[FunctionName("SearchMatchLobbies")]
public static async Task<Wrapper<MatchLobbyDTO>> Run(
[HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequestMessage req,
[CosmosDB(ConnectionStringSetting = "PlayFabTicTacToeCosmosDB")] DocumentClient cosmosDBClient)
{
var context = await FunctionContext<SearchMatchLobbiesRequest>.Create(req);
var lobbyListRequest = context.FunctionArgument;
var result = await MatchLobbyUtil.GetMatchLobbiesDTOAsync(
cosmosDBClient,
ExpressionUtils.GetSearchMatchLobbiesExpression(lobbyListRequest.SearchTerm));
return new Wrapper<MatchLobbyDTO>
{
Items = result
};
}
}
}