Directus.SDK 1.0.3

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

Directus 9 .NET SDK

This project is a library for using the Directus API. It provides clients for interacting with the various API endpoints, including items, files, and collections.

Installation

The Directus SDK library is available on NuGet. You can install it via the Package Manager Console in Visual Studio or via the command line:

PM> Install-Package Directus.SDK

Work in progress

  • Authentification
  • Items
  • Files (WIP)
  • Collections (WIP)
  • Dashboards (WIP)
  • Extensions (WIP)
  • Fields (WIP)
  • Flows (WIP)
  • Folders (WIP)
  • Notifications (WIP)
  • Operations (WIP)
  • Panels (WIP)
  • Permissions (WIP)
  • Presets (WIP)
  • Relations (WIP)
  • Revisions (WIP)
  • Roles (WIP)
  • Shema (WIP)
  • Server (WIP)
  • Settings (WIP)
  • Users (WIP)
  • Utilities (WIP)
  • Webhooks (WIP

Usage

To use the Directus SDK library, you must provide authentication information for your Directus instance. Here is an example configuration:


var apiUrl = "https://example.com";
var email = "test@example.com";
var password = "password";

//Authentification
var authenticator = new DirectusAuthenticator(apiUrl);
var tokenProvider = new authenticator.TokenProvider(email, password);
var directusSDK = new DirectusSDK(apiUrl, tokenProvider);

You can then use the `directusSDKinstance to interact with the various Directus API endpoints.

Here is an example of using the Directus SDK library to retrieve all items in a collection:

using Newtonsoft.Json;   
public class Blog
{ 
    [JsonProperty("id")]
    public int Id { get; set; }
    [JsonProperty("title")]
    public string Title { get; set; }
    [JsonProperty("content")]
    public string Content { get; set; }
 }

//Create new item
var item = new Blog() { Content= "content_test", Title="title_test" };
var itemCreated = await directusSDK.Items.CreateItemAsync<Blog>("Blog", item);

//Update Item
var itemToUpdate = await directusSDK.Items.GetItemAsync<Blog>("Blog", "item_id");
itemToUpdate.Title = "title_test_2";

var item = await directusSDK.Items.UpdateItemAsync<Blog>("Blog", "item_id", itemToUpdate);

//Delete Item
var isDeleted = await directusSDK.Items.DeleteItemAsync("Blog", "item_id");

//Custom queries
DirectusQueryBuilder queryBuilder = new DirectusQueryBuilder();
var customFilter = new OrFilter(new EqFilter("content", "content_test_2"), new EqFilter("title", "title_test_3"));
queryBuilder.CustomFilter(customFilter);

var items = await directusSDK.Items.GetItemsAsync<Blog>("Blog", queryBuilder);


Contribution

Contributions are welcome! Feel free to open a pull request to propose modifications or additions to the Directus SDK library.

License

This project is licensed under the MIT license. See the LICENSE file for more information.

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 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.0.3 202 11/2/2024
1.0.2 153 11/2/2024
1.0.1 165 10/30/2024
1.0.0 157 10/30/2024