C# Library
Download LibraryFrameworks supported
- .NET Core >=2.1
- .NET Framework >=4.6
- Mono/Xamarin >=vNext
Dependencies
- RestSharp - 106.11.4 or later
- Json.NET - 12.0.3 or later
- JsonSubTypes - 1.7.0 or later
- System.ComponentModel.Annotations - 4.7.0 or later
- BouncyCastle - 1.8.1 or later
The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:
1Install-Package RestSharp
2Install-Package Newtonsoft.Json
3Install-Package JsonSubTypes
4Install-Package System.ComponentModel.Annotations
5Install-Package BouncyCastle
NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742
Installation
Generate the DLL using your preferred tool (e.g.dotnet build
)
Then include the DLL (under the bin folder) in the C# project, and use the namespaces:
1using Org.OpenAPITools.Api;
2using Org.OpenAPITools.Client;
3using Org.OpenAPITools.Model;
Usage
Getting Started
1using System.Collections.Generic;
2using System.Diagnostics;
3using Org.OpenAPITools.Api;
4using Org.OpenAPITools.Client;
5using Org.OpenAPITools.Model;
6
7namespace Example
8{
9 public class Example
10 {
11 public static void Main()
12 {
13
14 Configuration config = new Configuration();
15 config.BasePath = "https://gate.qorepay.com/api/v1/";
16 config.AccessToken = "TOKEN";
17 var apiInstance = new PurchasesApi(config);
18 var client = new ClientDetails("[email protected]");
19 var products = new List<Product>();
20 products.Add(new Product("Dog food", "1", 100));
21 var details = new PurchaseDetails(products: products);
22 var data = new Purchase(client, details, brandId: new System.Guid("BRAND_ID"));
23 try
24 {
25 Purchase result = apiInstance.PurchasesCreate(data);
26 Debug.WriteLine(result);
27 }
28 catch (ApiException e)
29 {
30 Debug.Print("Exception when calling PurchasesApi.PurchasesCreate: " + e.Message);
31 Debug.Print("Status Code: " + e.ErrorCode);
32 Debug.Print(e.StackTrace);
33 }
34
35 }
36 }
37}