/// <summary> /// Serialize <see cref="OpenApiOAuthFlow"/> to Open Api v3.0 /// </summary> public void SerializeAsV3(IOpenApiWriter writer) { if (writer == null) { throw Error.ArgumentNull(nameof(writer)); } writer.WriteStartObject(); // authorizationUrl writer.WriteProperty(OpenApiConstants.AuthorizationUrl, AuthorizationUrl?.ToString()); // tokenUrl writer.WriteProperty(OpenApiConstants.TokenUrl, TokenUrl?.ToString()); // refreshUrl writer.WriteProperty(OpenApiConstants.RefreshUrl, RefreshUrl?.ToString()); // scopes writer.WriteRequiredMap(OpenApiConstants.Scopes, Scopes, (w, s) => w.WriteValue(s)); // extensions writer.WriteExtensions(Extensions); writer.WriteEndObject(); }
/// <summary>Serves as the default hash function.</summary> /// <returns>A hash code for the current object.</returns> public override int GetHashCode() { unchecked { var hc = 17L; if (AuthorizationUrl != null) { hc = (hc * 23) + AuthorizationUrl.GetHashCode(); } if (TokenUrl != null) { hc = (hc * 23) + TokenUrl.GetHashCode(); } if (RefreshUrl != null) { hc = (hc * 23) + RefreshUrl.GetHashCode(); } hc = (hc * 23) + Scopes.Count; return(((int)(hc >> 32)) ^ (int)hc); } }