/// <summary> /// Gets the current query parameters a dictionary. /// </summary> /// <returns>dictionary of query parameters.</returns> public Dictionary <string, string> GetParams() { var result = new Dictionary <string, string>(); if (AuthMethod == AuthMethod.Basic) { result["key"] = AuthValue; } else { result["accessToken"] = AuthValue; } result["v"] = Defaults.ProtocolVersion; result["lib"] = Defaults.LibraryVersion; // Url encode all the params at the time of creating the query string result["format"] = UseBinaryProtocol ? "msgpack" : "json"; result["echo"] = EchoMessages.ToString().ToLower(); if (ConnectionKey.IsNotEmpty()) { result["resume"] = ConnectionKey; if (ConnectionSerial.HasValue) { result["connection_serial"] = ConnectionSerial.Value.ToString(); } } else if (RecoverValue.IsNotEmpty()) { var match = RecoveryKeyRegex.Match(RecoverValue); if (match.Success) { result["recover"] = match.Groups[1].Value; result["connection_serial"] = match.Groups[2].Value; } } if (ClientId.IsNotEmpty()) { result["clientId"] = ClientId; } if (AdditionalParameters?.Any() ?? false) { return(AdditionalParameters.Merge(result)); } return(result); }