GustoEmbedded 0.1.4
dotnet add package GustoEmbedded --version 0.1.4
NuGet\Install-Package GustoEmbedded -Version 0.1.4
<PackageReference Include="GustoEmbedded" Version="0.1.4" />
<PackageVersion Include="GustoEmbedded" Version="0.1.4" />
<PackageReference Include="GustoEmbedded" />
paket add GustoEmbedded --version 0.1.4
#r "nuget: GustoEmbedded, 0.1.4"
#addin nuget:?package=GustoEmbedded&version=0.1.4
#tool nuget:?package=GustoEmbedded&version=0.1.4
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 | 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)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.