ElCamino.PayPalHttp
2.5.0
Prefix Reserved
dotnet add package ElCamino.PayPalHttp --version 2.5.0
NuGet\Install-Package ElCamino.PayPalHttp -Version 2.5.0
<PackageReference Include="ElCamino.PayPalHttp" Version="2.5.0" />
<PackageVersion Include="ElCamino.PayPalHttp" Version="2.5.0" />
<PackageReference Include="ElCamino.PayPalHttp" />
paket add ElCamino.PayPalHttp --version 2.5.0
#r "nuget: ElCamino.PayPalHttp, 2.5.0"
#:package ElCamino.PayPalHttp@2.5.0
#addin nuget:?package=ElCamino.PayPalHttp&version=2.5.0
#tool nuget:?package=ElCamino.PayPalHttp&version=2.5.0
ElCamino.PayPalHttp
Improved regex and threading performance and current .NET frameworks over deprecated/forked PayPalHttp library.
PayPal HttpClient
PayPalHttp is a generic HTTP Client used with generated server SDKs.
In it's simplest form, an HttpClient exposes an Execute method which takes an HTTP request, executes it against the domain described in an Environment, and returns an HTTP response.
Environment
An Environment describes a domain that hosts a REST API, against which an HttpClient will make requests. Environment is a simple interface that wraps one method, BaseUrl.
var env = new Environment('https://example.com')
Requests
HTTP requests contain all the information needed to make an HTTP request against the REST API. Specifically, one request describes a path, a method, any path/query/form parameters, headers, attached files for upload, and body data.
These objects are constructed in code generated by the sdkgen project. Instructions for using generated HTTP request subclasses is provided in that project.
Responses
HTTP responses contain information returned by a server in response to a request as described above. They are simple objects which contain a status code, headers, and any data returned by the server.
var client = new HttpClient(env);
var request = new HttpRequest("/", HttpMethod.Get);
request.Body = "some data";
var response = await client.Execute(request);
var statusCode = response.StatusCode;
var headers = response.Headers;
var data = response.Result<String>();
Injectors
Injectors are blocks that can be used for executing arbitrary pre-flight logic, such as modifying a request or logging data. Injectors are attached to an HttpClient using the AddInjector method.
The HttpClient executes its injectors in a first-in, first-out order, before each request.
class LogInjector : IInjector
{
public void Inject(HttpRequest request)
{
// Do some logging here
}
}
var logInjector = new LogInjector();
client.AddInjector(logInjector);
...
Error Handling
HttpClient#Execute may throw an HttpException if something went wrong during the course of execution. If the server returned a non-200 response, HttpException will be thrown, that will contain a status code and headers you can use for debugging.
try
{
client.Execute(request);
}
catch (HttpException ex)
{
var statusCode = ex.StatusCode;
var headers = ex.Headers;
var message = ex.response<String>();
}
License
PayPalHttp-Dotnet is open source and available under the MIT license. See the LICENSE file for more information.
Contributing
Pull requests and issues are welcome. Please see CONTRIBUTING.md for more details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on ElCamino.PayPalHttp:
| Package | Downloads |
|---|---|
|
ElCamino.PayPalCheckoutSdk
.NET SDK for Checkout RESTful APIs with recurring billing support via products, plans and subscriptions. Webhooks support now available. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Release based on PayPalHttp library.