private IRestResponse call(Method method, string restPath, object payload, Dictionary <string, string> queryParams) { var request = new RestRequest(OpenfirePlugin + restPath, method); foreach (var entry in queryParams) { request.AddParameter(entry.Key, entry.Value); } request.RequestFormat = DataFormat.Json; request.AddHeader("Accept", "application/json"); if (payload == null) { return(Client.Execute(request)); } request.AddHeader("Content-Type", "application/json"); var jsonSerializer = new RestSharpJsonNetSerializer(); request.JsonSerializer = jsonSerializer; request.AddJsonBody(payload); if (this.isDebug) { Console.WriteLine("--------- DEBUG PAYLOAD OPENFIRECLIENT ---------"); Console.WriteLine(jsonSerializer.Serialize(payload)); Console.WriteLine("--------- DEBUG PAYLOAD OPENFIRECLIENT ---------"); } return(Client.Execute(request)); }
public ConsentService(string appId) { this.appId = appId; client = new RestClient("https://psd2.api.swedbank.com:443"); var serializer = new RestSharpJsonNetSerializer(); client.AddHandler("application/json", () => serializer); client.AddHandler("text/json", () => serializer); client.AddHandler("text/x-json", () => serializer); client.AddHandler("text/javascript", () => serializer); client.AddHandler("*+json", () => serializer); }