/// <summary> /// Creates a sample action plan object. /// </summary> public static ActionPlanV2 CreateSleepActionPlan() { var objective = CreateSleepObjective(); // Use this if you want to create the task with the plan in one call. // You can also create tasks in a separate call after the action plan is created. var scheduledTask = CreateSleepScheduledActionPlanTask(objective.Id); var frequencyTask = CreateSleepFrequencyActionPlanTask(objective.Id); var plan = new ActionPlanV2 { Name = "Sleep better", Description = "Improve the quantity and quality of your sleep.", ImageUrl = "https://img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RE10omP?ver=59cf", ThumbnailImageUrl = "https://img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RE10omP?ver=59cf", Category = ActionPlanCategory.Sleep.ToString(), Objectives = new Collection <Objective> { objective }, AssociatedTasks = new Collection <ActionPlanTaskV2> { scheduledTask, frequencyTask } }; return(plan); }
public static ActionPlanV2 CreateWeightActionPlan() { var objective = new Objective { Id = Guid.NewGuid().ToString(), Name = "Manage your weight", Description = "Manage your weight better by measuring daily. ", State = ActionPlanObjectiveStatus.Active.ToString(), OutcomeName = "Better control over your weight", OutcomeType = ActionPlanOutcomeType.Other.ToString() }; // Use this if you want to create the task with the plan in one call. // You can also create tasks in a separate call after the action plan is created. var task = CreateDailyWeightMeasurementActionPlanTask(objective.Id); var plan = new ActionPlanV2 { Name = "Track your weight", Description = "Daily weight tracking can help you be more conscious of what you eat. ", ImageUrl = "https://img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RW680a?ver=b227", ThumbnailImageUrl = "https://img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RW6fN6?ver=6479", Category = ActionPlanCategory.Health.ToString(), Objectives = new Collection <Objective> { objective }, AssociatedTasks = new Collection <ActionPlanTaskV2> { task } }; return(plan); }
/// <summary> /// Post an action plan instance /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='actionPlan'> /// The instance of the plan to create. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <object> CreateAsync(this IActionPlans operations, ActionPlanV2 actionPlan, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { using (var _result = await operations.CreateWithHttpMessagesAsync(actionPlan, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
private static ActionPlanV2 CreateWeightActionPlan(Guid objectiveId) { var plan = new ActionPlanV2(); var objective = new Objective { Id = objectiveId.ToString(), Name = ObjectiveName, Description = "Manage your weight better by measuring daily. ", State = "Active", OutcomeName = "Better control over your weight", OutcomeType = "Other" }; // Use this if you want to create the task with the plan in one call. // You can also create tasks in a separate call after the action plan is created. var task = CreateDailyWeightMeasurementActionPlanTask(objective.Id); plan.Name = PlanName; plan.Description = "Daily weight tracking can help you be more conscious of what you eat. "; plan.ImageUrl = "https://img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RW680a?ver=b227"; plan.ThumbnailImageUrl = "https://img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RW6fN6?ver=6479"; plan.Category = "Health"; plan.Objectives = new Collection <Objective> { objective }; plan.AssociatedTasks = new Collection <ActionPlanTaskV2> { task }; return(plan); }
/// <summary> /// Post an action plan instance /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='actionPlan'> /// The instance of the plan to create. /// </param> public static object Create(this IActionPlans operations, ActionPlanV2 actionPlan) { return(operations.CreateAsync(actionPlan).GetAwaiter().GetResult()); }