wadewegner / Force.com-Toolkit-for-NET

The Force.com Toolkits for .NET provides an easy way for .NET developers to interact with the Force.com & Chatter REST APIs using native libraries.
BSD 3-Clause "New" or "Revised" License
373 stars 395 forks source link

Method FormatUrl with Api Gateway #398

Open douglasbcosta opened 3 years ago

douglasbcosta commented 3 years ago

Here I have an API Gateway before access salesforce, wich makes a query calling something like {baseUrl}/{path}/services/data/... I found that if I try to set the InstanceUrl like {baseUrl}/{path} it wont work because of method FormatUrl called in ForceClient wont get the path. The final url will just be {baseUrl}/services/data/... without the path of Api Gateway. I had to inhite a new class from IForceClient to substitute just this method.

Instead of using the Common class I wrote a similar method that instead of returning: new Uri(new Uri(instanceUrl), string.Format("/services/data/{0}/{1}", apiVersion, resourceName)); I return new Uri("{0}/services/data/{1}/{2}", instanceUrl, apiVersion, resourceName);

The same for the other url formats. As I dont use much other endpoints I dont know the impacts of that in other cases or if it would have an easier way to solve.