Enclave.Sdk.Api 1.0.3

dotnet add package Enclave.Sdk.Api --version 1.0.3
NuGet\Install-Package Enclave.Sdk.Api -Version 1.0.3
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="Enclave.Sdk.Api" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Enclave.Sdk.Api --version 1.0.3
#r "nuget: Enclave.Sdk.Api, 1.0.3"
#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.
// Install Enclave.Sdk.Api as a Cake Addin
#addin nuget:?package=Enclave.Sdk.Api&version=1.0.3

// Install Enclave.Sdk.Api as a Cake Tool
#tool nuget:?package=Enclave.Sdk.Api&version=1.0.3

Enclave.Sdk.Api

Provides a NuGet package that makes it easier to consume the Enclave Management APIs

Getting Started

Starting to use the API is simple; first you'll want to create a personal access token which can be done on the account page.

Creating an Enclave Client

When creating an Enclave client there are 3 ways to start. The first is to use a credentials.json file found in the .enclave folder in your user directory with the below structure.

{
    "personalAccessToken": "PERSONAL ACCESS TOKEN"
}

You then create a new EnclaveClient as below

var enclaveClient = new EnclaveClient();

Alternatively you can pass the EnclaveClient the personal access token directly, which overrides any value in your credentials file.

var token = "YOUR TOKEN";
var enclaveClient = new EnclaveClient(token);

Finally you can pass in an EnclaveClientOptions object

var enclaveClient = new EnclaveClient(new EnclaveClientOptions
{
    PersonalAccessToken = "YOUR TOKEN",
});

Selecting Your Organisation

Once you're authenticated you can then retrieve a list of orgs by calling the below block of code

// Retrieve all orgs associated to the authenticated User
var organisations = await enclaveClient.GetOrganisationsAsync();

// Select the org you want here we're just getting the first org
var organisation = organisations.FirstOrDefault();

// Create a client for the specified organisation.
var organisationClient = enclaveClient.CreateOrganisationClient(organisation);

Making an API Call

Making a call is really easy from the IOrganisationClient here you have access to all the API calls listed on the Enclave API Docs

To make an organisation call

var currentOrganisation = await organisationClient.GetAsync();

All other areas are properties on IOrganisationClient so for example

var enrolledSystems = await organisationClient.EnrolledSystems.GetSystemsAsync();

var enrolmentKey = await organisationClient.EnrolmentKeys.GetEnrolmentKeysAsync();

Update Requests

When updating an item, we make a call to the relevant Update method this then returns an instance of IPatchClient which has a fluent implementation. So for example;

var dnsZoneId = DnsZoneId.FromInt(123);
var result = await _dnsClient.UpdateZone(dnsZoneId).Set(d => d.Name, "New Name").ApplyAsync();

This code will update the name of the specified DNS Zone. Once you've called ApplyAsync the request will be sent and the returning model will be an updated version of the relevant type in this case the DNS Zone.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
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.0.3 195 6/27/2023
1.0.2 120 6/27/2023
1.0.1 455 4/26/2022
1.0.0 425 3/15/2022