DeviantArt.Net 0.3.0

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

// Install DeviantArt.Net as a Cake Tool
#tool nuget:?package=DeviantArt.Net&version=0.3.0                

DeviantArt.Net

DeviantArt.Net is a .NET client library for interacting with the DeviantArt API. It provides a simple and easy-to-use interface for accessing various endpoints of the DeviantArt API.

Features

  • OAuth2 authentication
  • Token management
  • Supported Endpoints
    • Browse
    • Collections
    • Comments
    • Data
    • Deviation
    • Feed - Deprecated by DeviantArt and scheduled for removal
    • Gallery
    • Messages
    • Notes - Deprecated by DeviantArt and scheduled for removal
    • Stash
    • User
    • Util

Installation

To install DeviantArt.Net, add the following package to your project:

dotnet add package DeviantArt.Net

Usage

Initialization

To use the client, you need to initialize it with your DeviantArt API credentials:

There are two grant types supported: AuthorizationCode and ClientCredentials.

AuthorizationCode
using DeviantArt.Net.Api;

var clientId = "your-client-id";
var clientSecret = "your-client-secret";
var redirectUri = "your-redirect-uri"; // e.g. "http://localhost:8080/"
var tokenStore = new YourTokenStoreImplementation(); // e.g. JsonTokenStore

var client = new Client(clientId, clientSecret, redirectUri, tokenStore);
ClientCredentials
using DeviantArt.Net.Api;

var clientId = "your-client-id";
var clientSecret = "your-client-secret";
var tokenStore = new YourTokenStoreImplementation(); // e.g. JsonTokenStore

var client = new Client(clientId, clientSecret, tokenStore);

Using API Endpoints

All API endpoints are available as methods on the client object. Methods are well-documented and self-explanatory. for example, to fetch a deviation by its ID::

var deviationId = "some-deviation-id";
Deviation deviation = await Client.GetDeviationAsync(deviationId);
Console.WriteLine(deviation.Url);

Customization

DeviantArt.Net uses ITokenStore interface (originally from kamranayub/igdb-dotnet) to store and retrieve tokens. You can implement your own token store by implementing this interface. currently, there are two implementations available: JsonTokenStore and InMemoryTokenStore. To provide your own token store such as a database, you can implement the ITokenStore interface and pass it to the client constructor.

using namespace DeviantArt.Net.Modules.TokenStore;

class CustomTokenStore : ITokenStore {

  Task<DeviantArtAccessToken> GetTokenAsync() {

    // Get token from database, etc.
    var token = // ...
    return token;
  }

  Task<DeviantArtAccessToken> StoreTokenAsync(DeviantArtAccessToken token) {
    // Store new token in database, etc.
    return token;
  }

}

// Create an DeviantArt API client, passing custom token store
var api = new Client(clientId, clientSecret, new CustomTokenStore());

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

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
0.3.0 133 9/12/2024