|
| 1 | +// |
| 2 | +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. |
| 3 | +// |
| 4 | +using System; |
| 5 | +using System.Collections.Generic; |
| 6 | +using System.Linq; |
| 7 | +using System.Text; |
| 8 | +using System.Text.Json; |
| 9 | +using System.Text.Json.Serialization; |
| 10 | +using Algolia.Search.Serializer; |
| 11 | + |
| 12 | +namespace Algolia.Search.Models.Composition; |
| 13 | + |
| 14 | +/// <summary> |
| 15 | +/// ExternalInjection |
| 16 | +/// </summary> |
| 17 | +public partial class ExternalInjection |
| 18 | +{ |
| 19 | + /// <summary> |
| 20 | + /// Initializes a new instance of the ExternalInjection class. |
| 21 | + /// </summary> |
| 22 | + [JsonConstructor] |
| 23 | + public ExternalInjection() { } |
| 24 | + |
| 25 | + /// <summary> |
| 26 | + /// Initializes a new instance of the ExternalInjection class. |
| 27 | + /// </summary> |
| 28 | + /// <param name="objectID">An objectID injected into an external source. (required).</param> |
| 29 | + public ExternalInjection(string objectID) |
| 30 | + { |
| 31 | + ObjectID = objectID ?? throw new ArgumentNullException(nameof(objectID)); |
| 32 | + } |
| 33 | + |
| 34 | + /// <summary> |
| 35 | + /// An objectID injected into an external source. |
| 36 | + /// </summary> |
| 37 | + /// <value>An objectID injected into an external source.</value> |
| 38 | + [JsonPropertyName("objectID")] |
| 39 | + public string ObjectID { get; set; } |
| 40 | + |
| 41 | + /// <summary> |
| 42 | + /// User-defined key-values that will be added to the injected item in the response. This is identical to Hits metadata defined in Composition or Composition Rule, with the benefit of being set at runtime. |
| 43 | + /// </summary> |
| 44 | + /// <value>User-defined key-values that will be added to the injected item in the response. This is identical to Hits metadata defined in Composition or Composition Rule, with the benefit of being set at runtime. </value> |
| 45 | + [JsonPropertyName("metadata")] |
| 46 | + public Dictionary<string, object> Metadata { get; set; } |
| 47 | + |
| 48 | + /// <summary> |
| 49 | + /// Returns the string presentation of the object |
| 50 | + /// </summary> |
| 51 | + /// <returns>String presentation of the object</returns> |
| 52 | + public override string ToString() |
| 53 | + { |
| 54 | + StringBuilder sb = new StringBuilder(); |
| 55 | + sb.Append("class ExternalInjection {\n"); |
| 56 | + sb.Append(" ObjectID: ").Append(ObjectID).Append("\n"); |
| 57 | + sb.Append(" Metadata: ").Append(Metadata).Append("\n"); |
| 58 | + sb.Append("}\n"); |
| 59 | + return sb.ToString(); |
| 60 | + } |
| 61 | + |
| 62 | + /// <summary> |
| 63 | + /// Returns the JSON string presentation of the object |
| 64 | + /// </summary> |
| 65 | + /// <returns>JSON string presentation of the object</returns> |
| 66 | + public virtual string ToJson() |
| 67 | + { |
| 68 | + return JsonSerializer.Serialize(this, JsonConfig.Options); |
| 69 | + } |
| 70 | + |
| 71 | + /// <summary> |
| 72 | + /// Returns true if objects are equal |
| 73 | + /// </summary> |
| 74 | + /// <param name="obj">Object to be compared</param> |
| 75 | + /// <returns>Boolean</returns> |
| 76 | + public override bool Equals(object obj) |
| 77 | + { |
| 78 | + if (obj is not ExternalInjection input) |
| 79 | + { |
| 80 | + return false; |
| 81 | + } |
| 82 | + |
| 83 | + return (ObjectID == input.ObjectID || (ObjectID != null && ObjectID.Equals(input.ObjectID))) |
| 84 | + && ( |
| 85 | + Metadata == input.Metadata |
| 86 | + || Metadata != null && input.Metadata != null && Metadata.SequenceEqual(input.Metadata) |
| 87 | + ); |
| 88 | + } |
| 89 | + |
| 90 | + /// <summary> |
| 91 | + /// Gets the hash code |
| 92 | + /// </summary> |
| 93 | + /// <returns>Hash code</returns> |
| 94 | + public override int GetHashCode() |
| 95 | + { |
| 96 | + unchecked // Overflow is fine, just wrap |
| 97 | + { |
| 98 | + int hashCode = 41; |
| 99 | + if (ObjectID != null) |
| 100 | + { |
| 101 | + hashCode = (hashCode * 59) + ObjectID.GetHashCode(); |
| 102 | + } |
| 103 | + if (Metadata != null) |
| 104 | + { |
| 105 | + hashCode = (hashCode * 59) + Metadata.GetHashCode(); |
| 106 | + } |
| 107 | + return hashCode; |
| 108 | + } |
| 109 | + } |
| 110 | +} |
0 commit comments