public static async Task <TicTacToeSharedGroupData> Run( [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequestMessage req, ILogger log) { var context = await FunctionContext <CreateSharedGroupRequest> .Create(req); // We have to use the MasterPlayerAccountId instead of the TitlePlayerAccountId to avoid errors during its addition as member of SGD var playerOne = context.CallerEntityProfile.Lineage.MasterPlayerAccountId; var sgdResponse = await SharedGroupDataUtil.CreateAsync(context.AuthenticationContext, context.FunctionArgument.SharedGroupId); await SharedGroupDataUtil.AddMembersAsync(context.AuthenticationContext, context.FunctionArgument.SharedGroupId, new List <string> { playerOne }); var sharedGroupData = new TicTacToeSharedGroupData { SharedGroupId = sgdResponse.SharedGroupId, Match = new Match { PlayerOneId = playerOne } }; return(await SharedGroupDataUtil.UpdateAsync(context.AuthenticationContext, sharedGroupData)); }
public static async Task <TicTacToeSharedGroupData> Run( [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequestMessage req) { var context = await FunctionContext <GetSharedGroupRequest> .Create(req); return(await SharedGroupDataUtil.GetAsync(context.AuthenticationContext, context.FunctionArgument.SharedGroupId)); }
public static async Task Run( [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequestMessage req ) { var context = await FunctionContext <DeleteSharedGroupRequest> .Create(req); var request = context.FunctionArgument; await SharedGroupDataUtil.DeleteAsync(context.AuthenticationContext, request.SharedGroupId); }
public static async Task <TicTacToeSharedGroupData> Run( [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequestMessage req) { var context = await FunctionContext <JoinMatchRequest> .Create(req); var playerId = context.CallerEntityProfile.Lineage.MasterPlayerAccountId; await SharedGroupDataUtil.AddMembersAsync(context.AuthenticationContext, context.FunctionArgument.SharedGroupId, new List <string> { playerId }); return(await MatchUtil.AddMember(context.AuthenticationContext, context.FunctionArgument.SharedGroupId, playerId)); }