Skip to content

Directus .NET SDK — .NET and C# Software Development Kit

Notifications You must be signed in to change notification settings

kipergil/sdk-dotnet

Repository files navigation

Directus Logo

Directus .NET/C# SDK

 

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 is automatically generated by the Swagger Codegen project:

  • API version: 1.1
  • SDK version: 1.1.1
  • Build package: io.swagger.codegen.languages.CSharpClientCodegen

Frameworks supported

  • .NET 4.0 or later
  • Windows Phone 7.1 (Mango)

Dependencies

The DLLs included in the package may not be the latest version. We recommend using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:

Install-Package RestSharp
Install-Package Newtonsoft.Json

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742

Installation

Run the following command to generate the DLL

  • [Mac/Linux] /bin/sh build.sh
  • [Windows] build.bat

Then include the DLL (under the bin folder) in the C# project, and use the namespaces:

using IO.Directus.Api;
using IO.Directus.Client;
using IO.Directus.Model;

Packaging

A .nuspec is included with the project. You can follow the Nuget quickstart to create and publish packages.

This .nuspec uses placeholders from the .csproj, so build the .csproj directly:

nuget pack -Build -OutputDirectory out IO.Directus.csproj

Then, publish to a local feed or other host and consume the new package via Nuget as usual.

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 column in a given table
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

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.

About

Directus .NET SDK — .NET and C# Software Development Kit

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages