Skip to content

jordanbtucker/DasKeyboard.Q

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DasKeyboard.Q

A .NET Core library for accessing the Das Keyboard Q REST API.

WARNING: This is a work-in-progress, and the Das Keyboard team is still making changes to the Q REST API. Use at your own risk.

Usage

Create a client that uses password credentials

var client = new Client
{
    AuthenticationMode = AuthenticationMode.Password,
    Credentials = new NetworkCredential("user@example.com", "Passw0rd!"),
};

Create a client that uses client credentials

var client = new Client
{
    AuthenticationMode = AuthenticationMode.ClientCredentials,
    Credentials = new NetworkCredential(
        "FQg6sYYcTyWTk2YK3qlBWy8k",  // client_id
        "5ulXkuK84cILsQMsIJl2usyK"), // client_secret
};

Create a client that uses a refresh token

var client = new Client
{
    AuthenticationMode = AuthenticationMode.RefreshToken,
    Credentials = new NetworkCredential(
        "FQg6sYYcTyWTk2YK3qlBWy8k",          // client_id
        "e45aab00c7b5f68761147d9b6118d4e6"), // refresh_token
};

Create a client that accesses the local API

var client = new Client
{
    AuthenticationMode = AuthenticationMode.None,
    ApiEndPoint = Client.LocalEndPoint,
};

Get a list of registered devices

foreach(var device in await client.GetDevices())
{
    Console.WriteLine($"PID: {device.Pid}, Description: {device.Description}");
}

Create a signal

var signal = new Signal
{
    Name = "Apple Stock increase",
    Pid = "DK5QPID",
    ZoneId = "KEY_A",
    Color = "#008000",
};

await client.CreateSignal(signal); // This also updates the signal object.

Console.WriteLine($"ID: {signal.Id}, Name: {signal.Name}");

Update a signal

signal.IsRead = true;

await client.UpdateSignal(signal);

Console.WriteLine($"ID: {signal.Id}, Read: {signal.IsRead}");

Delete a signal

await client.DeleteSignal(signal);

// or delete by Id
await client.DeleteSignal(469359);

Get authorized client apps

foreach(var appName in await client.GetAuthorizedClients())
{
    Console.WriteLine(appName);
}

Revoke an authorized client app

await client.RevokeAuthorizedClient("IFTTT");

About

A .NET Core library for accessing the Das Keyboard Q REST API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages