/// <summary> /// Initializes client properties. /// </summary> private void Initialize() { this.BasicOperations = new BasicOperations(this); this.Primitive = new Primitive(this); this.Array = new Array(this); this.Dictionary = new Dictionary(this); this.Inheritance = new Inheritance(this); this.Polymorphism = new Polymorphism(this); this.Polymorphicrecursive = new Polymorphicrecursive(this); this.BaseUri = new Uri("http://localhost"); SerializationSettings = new JsonSerializerSettings { Formatting = Formatting.Indented, DateFormatHandling = DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = DateTimeZoneHandling.Utc, NullValueHandling = NullValueHandling.Ignore, ReferenceLoopHandling = ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver() }; DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = DateTimeZoneHandling.Utc, NullValueHandling = NullValueHandling.Ignore, ReferenceLoopHandling = ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver() }; SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <Fish>("dtype")); DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter <Fish>("dtype")); }
/// <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 IPolymorphicrecursive operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetValidWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <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 IPolymorphicrecursive operations) { return(Task.Factory.StartNew(s => ((IPolymorphicrecursive)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> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task PutValidAsync(this IPolymorphicrecursive operations, Fish complexBody, CancellationToken cancellationToken = default(CancellationToken)) { await operations.PutValidWithHttpMessagesAsync(complexBody, null, cancellationToken).ConfigureAwait(false); }
/// <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 IPolymorphicrecursive operations, Fish complexBody) { Task.Factory.StartNew(s => ((IPolymorphicrecursive)s).PutValidAsync(complexBody), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().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 IPolymorphicrecursive 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> public static void PutValid(this IPolymorphicrecursive operations, Fish complexBody) { operations.PutValidAsync(complexBody).GetAwaiter().GetResult(); }