/// <summary> /// Get complex types that are polymorphic and have recursive references /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <Fish> GetValidAsync(this IPolymorphicrecursiveOperations operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetValidWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Initializes client properties. /// </summary> private void Initialize() { this.Basic = new BasicOperations(this); this.Primitive = new PrimitiveOperations(this); this.Array = new ArrayOperations(this); this.Dictionary = new DictionaryOperations(this); this.Inheritance = new InheritanceOperations(this); this.Polymorphism = new PolymorphismOperations(this); this.Polymorphicrecursive = new PolymorphicrecursiveOperations(this); this.BaseUri = new Uri("http://localhost"); this.SubscriptionId = "123456"; this.AcceptLanguage = "en-US"; this.LongRunningOperationRetryTimeout = 30; this.GenerateClientRequestId = true; 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() } }; SerializationSettings.Converters.Add(new ResourceJsonConverter()); DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = DateTimeZoneHandling.Utc, NullValueHandling = NullValueHandling.Ignore, ReferenceLoopHandling = ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <Fish>("fishtype")); DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter <Fish>("fishtype")); DeserializationSettings.Converters.Add(new ResourceJsonConverter()); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); }
/// <summary> /// Get complex types that are polymorphic and have recursive references /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> public static Fish GetValid(this IPolymorphicrecursiveOperations operations) { return(operations.GetValidAsync().GetAwaiter().GetResult()); }
/// <summary> /// Put complex types that are polymorphic and have recursive references /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='complexBody'> /// Please put a salmon that looks like this: /// { /// "fishtype": "salmon", /// "species": "king", /// "length": 1, /// "age": 1, /// "location": "alaska", /// "iswild": true, /// "siblings": [ /// { /// "fishtype": "shark", /// "species": "predator", /// "length": 20, /// "age": 6, /// "siblings": [ /// { /// "fishtype": "salmon", /// "species": "coho", /// "length": 2, /// "age": 2, /// "location": "atlantic", /// "iswild": true, /// "siblings": [ /// { /// "fishtype": "shark", /// "species": "predator", /// "length": 20, /// "age": 6 /// }, /// { /// "fishtype": "sawshark", /// "species": "dangerous", /// "length": 10, /// "age": 105 /// } /// ] /// }, /// { /// "fishtype": "sawshark", /// "species": "dangerous", /// "length": 10, /// "age": 105 /// } /// ] /// }, /// { /// "fishtype": "sawshark", /// "species": "dangerous", /// "length": 10, /// "age": 105 /// } /// ] /// } /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task PutValidAsync(this IPolymorphicrecursiveOperations operations, Fish complexBody, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.PutValidWithHttpMessagesAsync(complexBody, null, cancellationToken).ConfigureAwait(false)).Dispose(); }
/// <summary> /// Put complex types that are polymorphic and have recursive references /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='complexBody'> /// Please put a salmon that looks like this: /// { /// "fishtype": "salmon", /// "species": "king", /// "length": 1, /// "age": 1, /// "location": "alaska", /// "iswild": true, /// "siblings": [ /// { /// "fishtype": "shark", /// "species": "predator", /// "length": 20, /// "age": 6, /// "siblings": [ /// { /// "fishtype": "salmon", /// "species": "coho", /// "length": 2, /// "age": 2, /// "location": "atlantic", /// "iswild": true, /// "siblings": [ /// { /// "fishtype": "shark", /// "species": "predator", /// "length": 20, /// "age": 6 /// }, /// { /// "fishtype": "sawshark", /// "species": "dangerous", /// "length": 10, /// "age": 105 /// } /// ] /// }, /// { /// "fishtype": "sawshark", /// "species": "dangerous", /// "length": 10, /// "age": 105 /// } /// ] /// }, /// { /// "fishtype": "sawshark", /// "species": "dangerous", /// "length": 10, /// "age": 105 /// } /// ] /// } /// </param> public static void PutValid(this IPolymorphicrecursiveOperations operations, Fish complexBody) { operations.PutValidAsync(complexBody).GetAwaiter().GetResult(); }
/// <summary> /// Get complex types that are polymorphic and have recursive references /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> public static Fish GetValid(this IPolymorphicrecursiveOperations operations) { return(Task.Factory.StartNew(s => ((IPolymorphicrecursiveOperations)s).GetValidAsync(), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
/// <summary> /// Put complex types that are polymorphic and have recursive references /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='complexBody'> /// Please put a salmon that looks like this: /// { /// "fishtype": "salmon", /// "species": "king", /// "length": 1, /// "age": 1, /// "location": "alaska", /// "iswild": true, /// "siblings": [ /// { /// "fishtype": "shark", /// "species": "predator", /// "length": 20, /// "age": 6, /// "siblings": [ /// { /// "fishtype": "salmon", /// "species": "coho", /// "length": 2, /// "age": 2, /// "location": "atlantic", /// "iswild": true, /// "siblings": [ /// { /// "fishtype": "shark", /// "species": "predator", /// "length": 20, /// "age": 6 /// }, /// { /// "fishtype": "sawshark", /// "species": "dangerous", /// "length": 10, /// "age": 105 /// } /// ] /// }, /// { /// "fishtype": "sawshark", /// "species": "dangerous", /// "length": 10, /// "age": 105 /// } /// ] /// }, /// { /// "fishtype": "sawshark", /// "species": "dangerous", /// "length": 10, /// "age": 105 /// } /// ] /// } /// </param> public static void PutValid(this IPolymorphicrecursiveOperations operations, Fish complexBody) { Task.Factory.StartNew(s => ((IPolymorphicrecursiveOperations)s).PutValidAsync(complexBody), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
/// <summary> /// Put complex types that are polymorphic and have recursive references /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='complexBody'> /// Please put a salmon that looks like this: /// { /// "fishtype": "salmon", /// "species": "king", /// "length": 1, /// "age": 1, /// "location": "alaska", /// "iswild": true, /// "siblings": [ /// { /// "fishtype": "shark", /// "species": "predator", /// "length": 20, /// "age": 6, /// "siblings": [ /// { /// "fishtype": "salmon", /// "species": "coho", /// "length": 2, /// "age": 2, /// "location": "atlantic", /// "iswild": true, /// "siblings": [ /// { /// "fishtype": "shark", /// "species": "predator", /// "length": 20, /// "age": 6 /// }, /// { /// "fishtype": "sawshark", /// "species": "dangerous", /// "length": 10, /// "age": 105 /// } /// ] /// }, /// { /// "fishtype": "sawshark", /// "species": "dangerous", /// "length": 10, /// "age": 105 /// } /// ] /// }, /// { /// "fishtype": "sawshark", /// "species": "dangerous", /// "length": 10, /// "age": 105 /// } /// ] /// } /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async System.Threading.Tasks.Task PutValidAsync(this IPolymorphicrecursiveOperations operations, Fish complexBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { await operations.PutValidWithHttpMessagesAsync(complexBody, null, cancellationToken).ConfigureAwait(false); }