private static SmartSpeakerUser GetUser(WebhookRequest request) { var user = new SmartSpeakerUser { Id = request.OriginalDetectIntentRequest .Payload.Fields["user"] .StructValue .Fields["userId"] .StringValue }; return(user); }
public override SmartSpeakerRequest ConvertRequest(SkillRequest request) { var user = new SmartSpeakerUser { Id = request.Session.User.UserId, }; switch (request.Request) { case LaunchRequest _: return(new SmartSpeakerRequest { Platform = "Alexa", RequestType = SmartSpeakerRequestType.LaunchRequest, User = user, }); case IntentRequest ir: return(new SmartSpeakerRequest { Platform = "Alexa", RequestType = SmartSpeakerRequestType.IntentRequest, Intent = new SmartSpeakerIntent { IntentName = ir.Intent.Name, Entities = ir.Intent.Slots.ToDictionary(x => x.Key, x => x.Value.Value), }, User = user, }); case SessionEndedRequest _: return(new SmartSpeakerRequest { Platform = "Alexa", RequestType = SmartSpeakerRequestType.EndSessionRequest, User = user, }); default: return(new SmartSpeakerRequest { Platform = "Alexa", RequestType = SmartSpeakerRequestType.EndSessionRequest, User = user, }); } }