-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDeleteMatchLobby.cs
31 lines (27 loc) · 1.17 KB
/
DeleteMatchLobby.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
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
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.Util;
namespace TicTacToeFunctions.Functions
{
public static class DeleteMatchLobby
{
[FunctionName("DeleteMatchLobby")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequestMessage req,
[CosmosDB(ConnectionStringSetting = "PlayFabTicTacToeCosmosDB")] DocumentClient cosmosDBClient)
{
var context = await FunctionContext<DeleteMatchLobbyInfoRequest>.Create(req);
var matchLobbyRequest = context.FunctionArgument;
Settings.TrySetSecretKey(context.ApiSettings);
Settings.TrySetCloudName(context.ApiSettings);
await MatchLobbyUtil.DeleteMatchLobbyFromDDBBAsync(cosmosDBClient, matchLobbyRequest.Id, matchLobbyRequest.MatchLobbyId);
return new OkObjectResult(matchLobbyRequest);
}
}
}