public async Task <Group> CreateGroupAsync(CreateGroupParams @params, CancellationToken?token = default(CancellationToken?)) { using (var response = await Post(BuildEndpoint("groups"), @params, token)) using (var content = response.Content) { return(await Factory.CreateGroupAsync(response)); } }
public CreateGroupResponse CreateGroup(CreateGroupParams createGroupParams) { var client = new RestClient( "https://prod-35.westeurope.logic.azure.com:443/workflows/b95ddae3be924054819a5087cc04b7c2/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=BCaR1QWg7kfxeiJLY8FvgnbKyprfCqd7XfK1phJ3_y8"); var request = new RestRequest(Method.POST); request.AddHeader("Host", "prod-35.westeurope.logic.azure.com:443"); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", JsonConvert.SerializeObject(createGroupParams), ParameterType.RequestBody); var response = client.Execute <CreateGroupResponse>(request); return(response.Data); }
private async Task <DialogTurnResult> StartAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { stepContext.Context.Activity.Text = stepContext.Context.Activity.Text.Replace("<at>Flowy</at>", ""); // Call LUIS and gather intent (Note the TurnContext has the response to the prompt.) var luisResult = await _teamsActionRecognizer.RecognizeAsync <LuisWithFlow>(stepContext.Context, cancellationToken); switch (luisResult.TopIntent().intent) { case LuisWithFlow.Intent.AddGroup: // Initialize CreateGroupParams with any entities we may have found in the response. var groupParams = new CreateGroupParams(); //Add as owner the person who is making the request groupParams.teamOwnersoDatabind = string.Format("https://graph.microsoft.com/v1.0/users/{0}", stepContext.Context.Activity.From.AadObjectId); //Check if groupname comes from LUIS result if (luisResult.TryGetGroupName(out var groupName)) { groupParams.teamDisplayName = groupName; } // Run the AddGroupDialog giving it whatever details we have from the LUIS call, it will fill out the remainder. return(await stepContext.BeginDialogAsync(nameof(AddGroupDialog), groupParams, cancellationToken)); case LuisWithFlow.Intent.Greetings: var greetings = MessageFactory.Text($"Hola, ¿Qué tal {stepContext.Context.Activity.From.Name}?"); await stepContext.Context.SendActivityAsync(greetings, cancellationToken); return(await stepContext.NextAsync(null, cancellationToken)); case LuisWithFlow.Intent.GreetingsPerson: if (luisResult.TryGetPersonName(out var personName)) { var greetingsPerson = MessageFactory.Text( $"Hola {personName}. {stepContext.Context.Activity.From.Name} quiere que te salude ¯\\_(ツ)_/¯"); await stepContext.Context.SendActivityAsync(greetingsPerson, cancellationToken); } return(await stepContext.NextAsync(null, cancellationToken)); default: return(await stepContext.NextAsync(null, cancellationToken)); } }