Gr4vy 1.2.6

dotnet add package Gr4vy --version 1.2.6
                    
NuGet\Install-Package Gr4vy -Version 1.2.6
                    
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="Gr4vy" Version="1.2.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Gr4vy" Version="1.2.6" />
                    
Directory.Packages.props
<PackageReference Include="Gr4vy" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Gr4vy --version 1.2.6
                    
#r "nuget: Gr4vy, 1.2.6"
                    
#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.
#:package Gr4vy@1.2.6
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Gr4vy&version=1.2.6
                    
Install as a Cake Addin
#tool nuget:?package=Gr4vy&version=1.2.6
                    
Install as a Cake Tool

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 code 400.
    • Error401: The request was unauthorized. Status code 401.
    • Error403: The credentials were invalid or the caller did not have permission to act on the resource. Status code 403.
    • Error404: The resource was not found. Status code 404.
    • Error405: The request method was not allowed. Status code 405.
    • Error409: A duplicate record was found. Status code 409.
    • Error425: The request was too early. Status code 425.
    • Error429: Too many requests were made. Status code 429.
    • Error500: The server encountered an error. Status code 500.
    • Error502: The server encountered an error. Status code 502.
    • Error504: The server encountered an error. Status code 504.
    • HTTPValidationError: Validation Error. Status code 422. *

<details><summary>Less common exceptions (2)</summary>

* 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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