GustoEmbedded 0.1.4

dotnet add package GustoEmbedded --version 0.1.4
                    
NuGet\Install-Package GustoEmbedded -Version 0.1.4
                    
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="GustoEmbedded" Version="0.1.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GustoEmbedded" Version="0.1.4" />
                    
Directory.Packages.props
<PackageReference Include="GustoEmbedded" />
                    
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 GustoEmbedded --version 0.1.4
                    
#r "nuget: GustoEmbedded, 0.1.4"
                    
#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.
#addin nuget:?package=GustoEmbedded&version=0.1.4
                    
Install GustoEmbedded as a Cake Addin
#tool nuget:?package=GustoEmbedded&version=0.1.4
                    
Install GustoEmbedded as a Cake Tool

GustoEmbedded

SDK Example Usage

Example

using GustoEmbedded;
using GustoEmbedded.Models.Components;

var sdk = new Gusto(companyAccessAuth: "<YOUR_BEARER_TOKEN_HERE>");

var res = await sdk.Introspection.GetInfoAsync(xGustoAPIVersion: VersionHeader.TwoThousandAndTwentyFourMinus04Minus01);

// handle response

Authentication

Per-Client Security Schemes

This SDK supports the following security scheme globally:

Name Type Scheme
CompanyAccessAuth http HTTP Bearer

To authenticate with the API the CompanyAccessAuth parameter must be set when initializing the SDK client instance. For example:

using GustoEmbedded;
using GustoEmbedded.Models.Components;

var sdk = new Gusto(companyAccessAuth: "<YOUR_BEARER_TOKEN_HERE>");

var res = await sdk.Introspection.GetInfoAsync(xGustoAPIVersion: VersionHeader.TwoThousandAndTwentyFourMinus04Minus01);

// handle response

Per-Operation Security Schemes

Some operations in this SDK require the security scheme to be specified at the request level. For example:

using GustoEmbedded;
using GustoEmbedded.Models.Components;
using GustoEmbedded.Models.Requests;

var sdk = new Gusto();

var res = await sdk.Companies.CreatePartnerManagedAsync(
    security: new PostV1PartnerManagedCompaniesSecurity() {
        SystemAccessAuth = "<YOUR_BEARER_TOKEN_HERE>",
    },
    requestBody: new PostV1PartnerManagedCompaniesRequestBody() {
        User = new User() {
            FirstName = "Gail",
            LastName = "Stracke",
            Email = "Emanuel.McClure@gmail.com",
        },
        Company = new Models.Requests.Company() {
            Name = "<value>",
        },
    },
    xGustoAPIVersion: VersionHeader.TwoThousandAndTwentyFourMinus04Minus01
);

// handle response

Error Handling

Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an exception.

By default, an API error will raise a GustoEmbedded.Models.Errors.APIException exception, which has the following properties:

Property Type Description
Message string The error message
Request HttpRequestMessage The HTTP request
Response HttpResponseMessage The HTTP response

When custom error responses are specified for an operation, the SDK may also throw their associated exceptions. You can refer to respective Errors tables in SDK docs for more details on possible exception types for each operation. For example, the CreatePartnerManagedAsync method throws the following exceptions:

Error Type Status Code Content Type
GustoEmbedded.Models.Errors.UnprocessableEntityErrorObject 422 application/json
GustoEmbedded.Models.Errors.APIException 4XX, 5XX */*

Example

using GustoEmbedded;
using GustoEmbedded.Models.Components;
using GustoEmbedded.Models.Errors;
using GustoEmbedded.Models.Requests;

var sdk = new Gusto();

try
{
    var res = await sdk.Companies.CreatePartnerManagedAsync(
        security: new PostV1PartnerManagedCompaniesSecurity() {
            SystemAccessAuth = "<YOUR_BEARER_TOKEN_HERE>",
        },
        requestBody: new PostV1PartnerManagedCompaniesRequestBody() {
            User = new User() {
                FirstName = "Gail",
                LastName = "Stracke",
                Email = "Emanuel.McClure@gmail.com",
            },
            Company = new Models.Requests.Company() {
                Name = "<value>",
            },
        },
        xGustoAPIVersion: VersionHeader.TwoThousandAndTwentyFourMinus04Minus01
    );

    // handle response
}
catch (Exception ex)
{
    if (ex is UnprocessableEntityErrorObject)
    {
        // Handle exception data
        throw;
    }
    else if (ex is GustoEmbedded.Models.Errors.APIException)
    {
        // Handle default exception
        throw;
    }
}

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 Description
demo https://api.gusto-demo.com Demo
prod https://api.gusto.com Prod
Example
using GustoEmbedded;
using GustoEmbedded.Models.Components;

var sdk = new Gusto(
    server: "prod",
    companyAccessAuth: "<YOUR_BEARER_TOKEN_HERE>"
);

var res = await sdk.Introspection.GetInfoAsync(xGustoAPIVersion: VersionHeader.TwoThousandAndTwentyFourMinus04Minus01);

// 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 GustoEmbedded;
using GustoEmbedded.Models.Components;

var sdk = new Gusto(
    serverUrl: "https://api.gusto-demo.com",
    companyAccessAuth: "<YOUR_BEARER_TOKEN_HERE>"
);

var res = await sdk.Introspection.GetInfoAsync(xGustoAPIVersion: VersionHeader.TwoThousandAndTwentyFourMinus04Minus01);

// 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
0.1.4 185 4/16/2025
0.1.3 177 4/3/2025
0.1.2 155 4/2/2025
0.1.1 148 4/1/2025