/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='name'> /// </param> /// <param name='strict'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IList <SuperheroModel> > GetByNameAsync(this ISuperheroesOperations operations, string name, bool?strict = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetByNameWithHttpMessagesAsync(name, strict, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <SuperheroModel> GetByIdAsync(this ISuperheroesOperations operations, int id, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetByIdWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Initializes client properties. /// </summary> private void Initialize() { this.SuperheroesOperations = new SuperheroesOperations(this); this.BaseUri = new Uri("https://localhost:5001"); SerializationSettings = new JsonSerializerSettings { Formatting = Formatting.Indented, DateFormatHandling = DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = DateTimeZoneHandling.Utc, NullValueHandling = NullValueHandling.Ignore, ReferenceLoopHandling = ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = DateTimeZoneHandling.Utc, NullValueHandling = NullValueHandling.Ignore, ReferenceLoopHandling = 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='name'> /// </param> /// <param name='strict'> /// </param> public static IList <SuperheroModel> GetByName(this ISuperheroesOperations operations, string name, bool?strict = default(bool?)) { return(Task.Factory.StartNew(s => ((ISuperheroesOperations)s).GetByNameAsync(name, strict), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// </param> public static SuperheroModel GetById(this ISuperheroesOperations operations, int id) { return(Task.Factory.StartNew(s => ((ISuperheroesOperations)s).GetByIdAsync(id), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }