developerforce/Force.com-Toolkit-for-NET — pull request #11 by JasonRowe (2014-03-18 21:38:42+00:00)
Title: Added support for ApexRest API in ServiceHttpClient.

The ApexRest API has a different URL format than the standard rest API. To use Salesforce.Common when working with ApexRest I added in functionality to specify the ServiceType which controls the URL format. To prevent breaking current implementations the default service type is the standard "data" URL format. With the new functionality people looking to utilize ApexRest can build custom clients based on ServiceHTTPClient and specify the service type ApexRest when creating the ServiceHTTPClient object.

##### Example Usage with ServiceType ApexRest:
new ServiceHttpClient(auth.InstanceUrl, auth.ApiVersion, auth.AccessToken, userAgent, ServiceType.ApexRest, new HttpClient());

##### Example Usage without ServiceType (same as before):
new ServiceHttpClient(auth.InstanceUrl, auth.ApiVersion, auth.AccessToken, userAgent, new HttpClient());

##### Example Usage ServiceType Data (which is the default and doesn't need to be specified):
new ServiceHttpClient(auth.InstanceUrl, auth.ApiVersion, auth.AccessToken, userAgent, ServiceType.Data, new HttpClient());

##### ApexRest Docs:
* http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_rest_code_sample_basic.htm
* http://wiki.developerforce.com/page/Creating_REST_APIs_using_Apex_REST

##### Notes:
* The tests added require setup of a ApexRest class using the salesforce docs example.
* New tests were added for FormatUrl method in Common
* I don't think adding functionality to the ForceClient makes sense but this change does allow people to create custom clients that specify the ApexRest Url format.