///<Summary> /// Generates a Request JSON object (array syntax) ///</Summary> public static string Request(string id, string methodName, params object[] values) => values == null || values.Length == 0 ? // without any values, this doesn't need parameters ProtocolExtensions.JsonObject(Protocol, methodName.Method(), Id(id)): // with values ProtocolExtensions.JsonObject(Protocol, methodName.Method(), Params(values), Id(id));
///<Summary> /// Generates a Request JSON object (object parameter syntax) ///</Summary> public static string RequestWithObject(string id, string methodName, object parameter) => parameter == null || parameter is string || parameter.IsPrimitive() ? // if you pass in null, a string, or a primitive // this has to be passed as an array ProtocolExtensions.JsonObject(Protocol, methodName.Method(), Params(new[] { parameter }), Id(id)): // pass as an object ProtocolExtensions.JsonObject(Protocol, methodName.Method(), Params(parameter.ToJsonValue()), Id(id));