ElCamino.PayPalHttp 2.0.0

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
dotnet add package ElCamino.PayPalHttp --version 2.0.0
NuGet\Install-Package ElCamino.PayPalHttp -Version 2.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ElCamino.PayPalHttp" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ElCamino.PayPalHttp --version 2.0.0
#r "nuget: ElCamino.PayPalHttp, 2.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ElCamino.PayPalHttp as a Cake Addin
#addin nuget:?package=ElCamino.PayPalHttp&version=2.0.0

// Install ElCamino.PayPalHttp as a Cake Tool
#tool nuget:?package=ElCamino.PayPalHttp&version=2.0.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 Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ElCamino.PayPalHttp:

Package Downloads
ElCamino.PayPalCheckoutSdk The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

.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.

Version Downloads Last updated
2.0.0 1,003 4/10/2023
1.9.0 650 4/7/2023
1.8.0 1,006 11/23/2022
1.7.0 901 11/21/2022

Release based on PayPalHttp library.