/// <summary> /// Initializes client properties. /// </summary> private void Initialize() { Grocery = new GroceryOperations(this); Meal = new MealOperations(this); BaseUri = new System.Uri("http://localhost:30012/mealplan"); SerializationSettings = new JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented, DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; CustomInitialize(); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='phrase'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IList <Meal> > FindMealsAsync(this IMealOperations operations, string phrase, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.FindMealsWithHttpMessagesAsync(phrase, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='phrase'> /// </param> public static IList <Meal> FindMeals(this IMealOperations operations, string phrase) { return(operations.FindMealsAsync(phrase).GetAwaiter().GetResult()); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> public static IList <Meal> GetMeals(this IMealOperations operations) { return(operations.GetMealsAsync().GetAwaiter().GetResult()); }