Directus .NET/C# SDK
Website • Docs • API Reference • User Guide • Demo • Contribute
This codebase is a work-in-progress. The repo is here as a placeholder for anyone interested in contributing to the software development kit. Pull-requests and contributions are welcome!
This C# SDK was initially automatically generated by the Swagger Codegen project, and later adapted by @mghextreme to support .NET Core and .NET Standard.
- API version: 1.1
- SDK version: 2.0.0
- Build package: io.swagger.codegen.languages.CSharpClientCodegen
Frameworks supported
- .NET Standard 2.0
- .NET Core 2.0 or later
- .NET Framework 4.6.1 or later
Dependencies
- Microsoft.CSharp - 4.5.0 or later
- RestSharp - 106.6.9 or later
- Json.NET - 12.0.2 or later
- System.ComponentModel.Annotations - 4.5.0 or later
To restore the latest versions using [NuGet] (https://docs.nuget.org/consume/installing-nuget), run the following command:
dotnet restore
Building
To build the package, either run the VSCode key shortcut Ctrl + Shift + B or run the dotnet build command.
Packaging
A .nuspec is included with the project. You can follow the Nuget quickstart to create and publish packages.
If you use VSCode, you can easily pack by using the
Ctrl + Shift + Pkey shortcut,Run Taskand selectingpack
It is not mandatory, but you may publish to a local feed or other host and consume the new package via Nuget as usual.
Installation
The package may now be installed in your project using either dotnet add (.NET CLI) or Install-Package (Package Manager).
In your project, use the following namespaces to use the Directus SDK.
using IO.Directus.Api;
using IO.Directus.Client;
using IO.Directus.Model;Getting Started
using System;
using System.Diagnostics;
using IO.Directus.Api;
using IO.Directus.Client;
using IO.Directus.Model;
namespace Example
{
public class Example
{
public void main()
{
// Configure API key authorization: api_key
Configuration.Default.ApiKey.Add("access_token", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("access_token", "Bearer");
Configuration.Default.BasePath = "https://myinstance.directus.io/api/1.1";
var apiInstance = new ActivityApi();
try
{
// Returns activity
GetActivity result = apiInstance.GetActivity();
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling ActivityApi.GetActivity: " + e.Message );
}
}
}
}Documentation for API Endpoints
All URIs are relative to your configured base path, as per example.
| Class | Method | HTTP request | Description |
|---|---|---|---|
| ActivityApi | GetActivity | GET /activity | Returns activity |
| BookmarksApi | AddBookmark | POST /bookmarks | Create a bookmark |
| BookmarksApi | DeleteBookmark | DELETE /bookmarks/{bookmarkId} | Deletes specific bookmark |
| BookmarksApi | GetBookmark | GET /bookmarks/{bookmarkId} | Returns specific bookmark |
| BookmarksApi | GetBookmarks | GET /bookmarks | Returns bookmarks |
| BookmarksApi | GetBookmarksSelf | GET /bookmarks/self | Returns bookmarks of current user |
| FilesApi | CreateFile | POST /files | Creates file |
| FilesApi | GetFile | GET /files/{fileId} | Returns specific file by id |
| FilesApi | GetFiles | GET /files | Returns files |
| FilesApi | UpdateFile | PUT /files/{fileId} | Creates file |
| GroupsApi | AddGroup | POST /groups | Add a new group |
| GroupsApi | AddPrivilege | POST /privileges/{groupId} | Create new table privileges for the specified user group |
| GroupsApi | GetGroup | GET /groups/{groupId} | Returns specific group |
| GroupsApi | GetGroups | GET /groups | Returns groups |
| GroupsApi | GetPrivileges | GET /privileges/{groupId} | Returns group privileges |
| GroupsApi | GetPrivilegesForTable | GET /privileges/{groupId}/{tableNameOrPrivilegeId} | Returns group privileges by tableName |
| GroupsApi | UpdatePrivileges | PUT /privileges/{groupId}/{tableNameOrPrivilegeId} | Update privileges by privilegeId |
| MessagesApi | GetMessage | GET /messages/{messageId} | Returns specific message |
| MessagesApi | GetMessages | GET /messages/self | Returns messages |
| PreferencesApi | GetPreferences | GET /tables/{tableId}/preferences | Returns table preferences |
| PreferencesApi | UpdatePreferences | PUT /tables/{tableId}/preferences | Update table preferences |
| SettingsApi | GetSettings | GET /settings | Returns settings |
| SettingsApi | GetSettingsFor | GET /settings/{collectionName} | Returns settings for collection |
| SettingsApi | UpdateSettings | PUT /settings/{collectionName} | Update settings |
| TablesApi | AddColumn | POST /tables/{tableId}/columns | Create a column in a given table |
| TablesApi | AddRow | POST /tables/{tableId}/rows | Add a new row |
| TablesApi | AddTable | POST /tables | Add a new table |
| TablesApi | DeleteColumn | DELETE /tables/{tableId}/columns/{columnName} | Delete row |
| TablesApi | DeleteRow | DELETE /tables/{tableId}/rows/{rowId} | Delete row |
| TablesApi | DeleteTable | DELETE /tables/{tableId} | Delete Table |
| TablesApi | GetTable | GET /tables/{tableId} | Returns specific table |
| TablesApi | GetTableColumn | GET /tables/{tableId}/columns/{columnName} | Returns specific table column |
| TablesApi | GetTableColumns | GET /tables/{tableId}/columns | Returns table columns |
| TablesApi | GetTableRow | GET /tables/{tableId}/rows/{rowId} | Returns specific table row |
| TablesApi | GetTableRows | GET /tables/{tableId}/rows | Returns table rows |
| TablesApi | GetTables | GET /tables | Returns tables |
| TablesApi | UpdateColumn | PUT /tables/{tableId}/columns/{columnName} | Update column |
| TablesApi | UpdateRow | PUT /tables/{tableId}/rows/{rowId} | Update row |
| UtilsApi | GetHash | POST /hash | Get a hashed value |
| UtilsApi | GetRandom | POST /random | Returns random alphanumeric string |
Documentation for Models
- Model.GetActivity
- Model.GetActivityData
- Model.GetActivityMeta
- Model.GetBookmark
- Model.GetBookmarks
- Model.GetBookmarksData
- Model.GetBookmarksMeta
- Model.GetFile
- Model.GetFiles
- Model.GetFilesData
- Model.GetGroup
- Model.GetGroups
- Model.GetGroupsData
- Model.GetGroupsDataData
- Model.GetGroupsDataMeta
- Model.GetMessage
- Model.GetMessages
- Model.GetMessagesData
- Model.GetMessagesMeta
- Model.GetMessagesResponses
- Model.GetPreferences
- Model.GetPreferencesData
- Model.GetPrivileges
- Model.GetPrivilegesData
- Model.GetPrivilegesForTable
- Model.GetSettings
- Model.GetSettingsData
- Model.GetSettingsDataFiles
- Model.GetSettingsDataGlobal
- Model.GetSettingsFor
- Model.GetSettingsForMeta
- Model.GetTable
- Model.GetTableColumn
- Model.GetTableColumnData
- Model.GetTableColumns
- Model.GetTableColumnsData
- Model.GetTableData
- Model.GetTableRow
- Model.GetTableRows
- Model.GetTableRowsData
- Model.GetTableRowsMeta
- Model.GetTables
- Model.GetTablesData
- Model.GetTablesMeta
Documentation for Authorization
api_key
- Type: API key
- API key parameter name: access_token
- Location: URL query string
Directus is released under the GPLv3 license. RANGER Studio LLC owns all Directus trademarks and logos on behalf of our project's community. Copyright © 2006-2018, RANGER Studio LLC.