Gr4vy 1.2.6
dotnet add package Gr4vy --version 1.2.6
NuGet\Install-Package Gr4vy -Version 1.2.6
<PackageReference Include="Gr4vy" Version="1.2.6" />
<PackageVersion Include="Gr4vy" Version="1.2.6" />
<PackageReference Include="Gr4vy" />
paket add Gr4vy --version 1.2.6
#r "nuget: Gr4vy, 1.2.6"
#:package Gr4vy@1.2.6
#addin nuget:?package=Gr4vy&version=1.2.6
#tool nuget:?package=Gr4vy&version=1.2.6
gr4vy
SDK Example Usage
Example
using Gr4vy;
using Gr4vy.Models.Components;
using System.Collections.Generic;
var sdk = new Gr4vySDK(
merchantAccountId: "default",
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>"
);
var res = await sdk.AccountUpdater.Jobs.CreateAsync(accountUpdaterJobCreate: new AccountUpdaterJobCreate() {
PaymentMethodIds = new List<string>() {
"ef9496d8-53a5-4aad-8ca2-00eb68334389",
"f29e886e-93cc-4714-b4a3-12b7a718e595",
},
});
// handle response
Authentication
Per-Client Security Schemes
This SDK supports the following security scheme globally:
Name | Type | Scheme |
---|---|---|
BearerAuth |
http | HTTP Bearer |
To authenticate with the API the BearerAuth
parameter must be set when initializing the SDK client instance. For example:
using Gr4vy;
using Gr4vy.Models.Components;
using System.Collections.Generic;
var sdk = new Gr4vySDK(
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
merchantAccountId: "default"
);
var res = await sdk.AccountUpdater.Jobs.CreateAsync(accountUpdaterJobCreate: new AccountUpdaterJobCreate() {
PaymentMethodIds = new List<string>() {
"ef9496d8-53a5-4aad-8ca2-00eb68334389",
"f29e886e-93cc-4714-b4a3-12b7a718e595",
},
});
// handle response
Global Parameters
A parameter is configured globally. This parameter may be set on the SDK client instance itself during initialization. When configured as an option during SDK initialization, This global value will be used as the default on the operations that use it. When such operations are called, there is a place in each to override the global value, if needed.
For example, you can set merchant_account_id
to `` at SDK initialization and then you do not have to pass the same value on calls to operations like Get
. But if you want to do so you may, which will locally override the global setting. See the example code below for a demonstration.
Available Globals
The following global parameter is available.
Name | Type | Description |
---|---|---|
merchantAccountId | string | The ID of the merchant account to use for this request. |
Example
using Gr4vy;
using Gr4vy.Models.Components;
var sdk = new Gr4vySDK(
merchantAccountId: "default",
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>"
);
var res = await sdk.MerchantAccounts.GetAsync(merchantAccountId: "merchant-12345");
// handle response
Pagination
Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the
returned response object will have a Next
method that can be called to pull down the next group of results. If the
return value of Next
is null
, then there are no more pages to be fetched.
Here's an example of one such pagination call:
using Gr4vy;
using Gr4vy.Models.Components;
using Gr4vy.Models.Requests;
var sdk = new Gr4vySDK(
merchantAccountId: "default",
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>"
);
ListBuyersRequest req = new ListBuyersRequest() {
Cursor = "ZXhhbXBsZTE",
Search = "John",
ExternalIdentifier = "buyer-12345",
};
ListBuyersResponse? res = await sdk.Buyers.ListAsync(req);
while(res != null)
{
// handle items
res = await res.Next!();
}
Retries
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
To change the default retry strategy for a single API call, simply pass a RetryConfig
to the call:
using Gr4vy;
using Gr4vy.Models.Components;
using Gr4vy.Models.Requests;
var sdk = new Gr4vySDK(
merchantAccountId: "default",
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>"
);
ListBuyersRequest req = new ListBuyersRequest() {
Cursor = "ZXhhbXBsZTE",
Search = "John",
ExternalIdentifier = "buyer-12345",
};
ListBuyersResponse? res = await sdk.Buyers.ListAsync(
retryConfig: new RetryConfig(
strategy: RetryConfig.RetryStrategy.BACKOFF,
backoff: new BackoffStrategy(
initialIntervalMs: 1L,
maxIntervalMs: 50L,
maxElapsedTimeMs: 100L,
exponent: 1.1
),
retryConnectionErrors: false
),
request: req
);
while(res != null)
{
// handle items
res = await res.Next!();
}
If you'd like to override the default retry strategy for all operations that support retries, you can use the RetryConfig
optional parameter when intitializing the SDK:
using Gr4vy;
using Gr4vy.Models.Components;
using Gr4vy.Models.Requests;
var sdk = new Gr4vySDK(
retryConfig: new RetryConfig(
strategy: RetryConfig.RetryStrategy.BACKOFF,
backoff: new BackoffStrategy(
initialIntervalMs: 1L,
maxIntervalMs: 50L,
maxElapsedTimeMs: 100L,
exponent: 1.1
),
retryConnectionErrors: false
),
merchantAccountId: "default",
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>"
);
ListBuyersRequest req = new ListBuyersRequest() {
Cursor = "ZXhhbXBsZTE",
Search = "John",
ExternalIdentifier = "buyer-12345",
};
ListBuyersResponse? res = await sdk.Buyers.ListAsync(req);
while(res != null)
{
// handle items
res = await res.Next!();
}
Error Handling
BaseException
is the base exception class for all HTTP error responses. It has the following properties:
Property | Type | Description |
---|---|---|
Message |
string | Error message |
StatusCode |
int | HTTP status code |
Headers |
HttpResponseHeaders | HTTP headers |
ContentType |
string? | HTTP content type |
RawResponse |
HttpResponseMessage | HTTP response object |
Body |
string | HTTP response body |
Some exceptions in this SDK include an additional Payload
field, which will contain deserialized custom error data when present. Possible exceptions are listed in the Error Classes section.
Example
using Gr4vy;
using Gr4vy.Models.Components;
using Gr4vy.Models.Errors;
using System.Collections.Generic;
var sdk = new Gr4vySDK(
merchantAccountId: "default",
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>"
);
try
{
var res = await sdk.AccountUpdater.Jobs.CreateAsync(accountUpdaterJobCreate: new AccountUpdaterJobCreate() {
PaymentMethodIds = new List<string>() {
"ef9496d8-53a5-4aad-8ca2-00eb68334389",
"f29e886e-93cc-4714-b4a3-12b7a718e595",
},
});
// handle response
}
catch (BaseException ex) // all SDK exceptions inherit from BaseException
{
// ex.ToString() provides a detailed error message
System.Console.WriteLine(ex);
// Base exception fields
HttpResponseMessage rawResponse = ex.RawResponse;
HttpResponseHeaders headers = ex.Headers;
int statusCode = ex.StatusCode;
string? contentType = ex.ContentType;
var responseBody = ex.Body;
if (ex is Error400) // different exceptions may be thrown depending on the method
{
// Check error data fields
Error400Payload payload = ex.Payload;
string Type = payload.Type;
string Code = payload.Code;
// ...
}
// An underlying cause may be provided
if (ex.InnerException != null)
{
Exception cause = ex.InnerException;
}
}
catch (System.Net.Http.HttpRequestException ex)
{
// Check ex.InnerException for Network connectivity errors
}
Error Classes
Primary exceptions:
BaseException
: The base class for HTTP error responses.Error400
: The request was invalid. Status code400
.Error401
: The request was unauthorized. Status code401
.Error403
: The credentials were invalid or the caller did not have permission to act on the resource. Status code403
.Error404
: The resource was not found. Status code404
.Error405
: The request method was not allowed. Status code405
.Error409
: A duplicate record was found. Status code409
.Error425
: The request was too early. Status code425
.Error429
: Too many requests were made. Status code429
.Error500
: The server encountered an error. Status code500
.Error502
: The server encountered an error. Status code502
.Error504
: The server encountered an error. Status code504
.HTTPValidationError
: Validation Error. Status code422
. *
<details><summary>Less common exceptions (2)</summary>
System.Net.Http.HttpRequestException
: Network connectivity error. For more details about the underlying cause, inspect theex.InnerException
.Inheriting from
BaseException
:ResponseValidationError
: Thrown when the response data could not be deserialized into the expected type. </details>
* Refer to the relevant documentation to determine whether an exception applies to a specific operation.
Server Selection
Select Server by Name
You can override the default server globally by passing a server name to the server: string
optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the names associated with the available servers:
Name | Server | Variables | Description |
---|---|---|---|
sandbox |
https://api.sandbox.{id}.gr4vy.app |
id |
|
production |
https://api.{id}.gr4vy.app |
id |
If the selected server has variables, you may override its default values through the additional parameters made available in the SDK constructor:
Variable | Parameter | Default | Description |
---|---|---|---|
id |
id: string |
"example" |
The subdomain for your Gr4vy instance. |
Example
using Gr4vy;
using Gr4vy.Models.Components;
using System.Collections.Generic;
var sdk = new Gr4vySDK(
server: SDKConfig.Server.Production,
id: "<id>",
merchantAccountId: "default",
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>"
);
var res = await sdk.AccountUpdater.Jobs.CreateAsync(accountUpdaterJobCreate: new AccountUpdaterJobCreate() {
PaymentMethodIds = new List<string>() {
"ef9496d8-53a5-4aad-8ca2-00eb68334389",
"f29e886e-93cc-4714-b4a3-12b7a718e595",
},
});
// handle response
Override Server URL Per-Client
The default server can also be overridden globally by passing a URL to the serverUrl: string
optional parameter when initializing the SDK client instance. For example:
using Gr4vy;
using Gr4vy.Models.Components;
using System.Collections.Generic;
var sdk = new Gr4vySDK(
serverUrl: "https://api.sandbox.example.gr4vy.app",
merchantAccountId: "default",
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>"
);
var res = await sdk.AccountUpdater.Jobs.CreateAsync(accountUpdaterJobCreate: new AccountUpdaterJobCreate() {
PaymentMethodIds = new List<string>() {
"ef9496d8-53a5-4aad-8ca2-00eb68334389",
"f29e886e-93cc-4714-b4a3-12b7a718e595",
},
});
// handle response
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 was computed. 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 was computed. 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. |
-
net8.0
- newtonsoft.json (>= 13.0.3)
- nodatime (>= 3.1.9)
- System.IdentityModel.Tokens.Jwt (>= 8.9.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.2.6 | 119 | 9/11/2025 |
1.2.5 | 113 | 9/11/2025 |
1.2.4 | 121 | 9/9/2025 |
1.2.3 | 113 | 9/9/2025 |
1.2.2 | 158 | 9/3/2025 |
1.2.1 | 186 | 8/28/2025 |
1.2.0 | 175 | 8/27/2025 |
1.1.31 | 225 | 8/21/2025 |
1.1.30 | 128 | 8/20/2025 |
1.1.29 | 130 | 8/20/2025 |
1.1.28 | 128 | 8/18/2025 |
1.1.27 | 314 | 8/14/2025 |
1.1.26 | 134 | 8/13/2025 |
1.1.25 | 128 | 8/11/2025 |
1.1.24 | 208 | 8/7/2025 |
1.1.23 | 210 | 8/7/2025 |
1.1.22 | 210 | 8/6/2025 |
1.1.21 | 223 | 8/5/2025 |
1.1.20 | 156 | 8/4/2025 |
1.1.19 | 142 | 8/4/2025 |
1.1.18 | 101 | 7/31/2025 |
1.1.17 | 100 | 7/30/2025 |
1.1.16 | 100 | 7/30/2025 |
1.1.15 | 102 | 7/28/2025 |
1.1.14 | 100 | 7/28/2025 |
1.1.13 | 100 | 7/28/2025 |
1.1.12 | 452 | 7/24/2025 |
1.1.11 | 447 | 7/24/2025 |
1.1.10 | 517 | 7/23/2025 |
1.1.9 | 508 | 7/22/2025 |
1.1.8 | 414 | 7/21/2025 |
1.1.7 | 143 | 7/16/2025 |
1.1.6 | 144 | 7/15/2025 |
1.1.5 | 145 | 7/14/2025 |
1.1.4 | 145 | 7/9/2025 |
1.1.3 | 144 | 7/8/2025 |
1.1.2 | 146 | 7/8/2025 |
1.1.1 | 93 | 7/4/2025 |
1.1.0 | 147 | 7/3/2025 |
1.0.4 | 149 | 6/26/2025 |
1.0.3 | 253 | 6/25/2025 |
1.0.2 | 148 | 6/24/2025 |
1.0.1 | 233 | 6/23/2025 |
1.0.0 | 110 | 6/20/2025 |
1.0.0-beta.21 | 200 | 6/16/2025 |
1.0.0-beta.20 | 122 | 6/16/2025 |
1.0.0-beta.19 | 126 | 6/5/2025 |
1.0.0-beta.18 | 122 | 6/5/2025 |
1.0.0-beta.17 | 130 | 6/5/2025 |
1.0.0-beta.16 | 123 | 6/4/2025 |
1.0.0-beta.15 | 128 | 6/4/2025 |
1.0.0-beta.14 | 126 | 6/4/2025 |
1.0.0-beta.13 | 126 | 6/3/2025 |
1.0.0-beta.12 | 126 | 6/3/2025 |
1.0.0-beta.11 | 127 | 6/3/2025 |
1.0.0-beta.10 | 127 | 6/3/2025 |
1.0.0-beta.9 | 92 | 5/30/2025 |
1.0.0-beta.8 | 132 | 5/29/2025 |
1.0.0-beta.7 | 129 | 5/29/2025 |
1.0.0-beta.6 | 128 | 5/28/2025 |
1.0.0-beta.5 | 132 | 5/27/2025 |
1.0.0-beta.4 | 135 | 5/21/2025 |
1.0.0-beta.3 | 138 | 5/20/2025 |
1.0.0-beta.2 | 132 | 5/19/2025 |
1.0.0-beta.1 | 168 | 5/16/2025 |
0.0.18 | 210 | 5/16/2025 |
0.0.13 | 257 | 5/12/2025 |
0.0.12 | 222 | 5/12/2025 |
0.0.11 | 226 | 5/12/2025 |
0.0.10 | 223 | 5/12/2025 |
0.0.5 | 231 | 5/12/2025 |
0.0.4 | 225 | 5/12/2025 |