RoyalRoadSharp 0.0.2

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

royalroad-sharp

A C# API for RoyalRoad.

Getting Started

Install

dotnet add package RoyalRoadSharp

Create a Client Directly

using RoyalRoadSharp;

IRoyalRoad royalRoad = RoyalRoad.Create(builder => builder
    .WithApiConfig(userAgent: "MyApp/1.0", throwOnError: false, matureContent: true));

var list = await royalRoad.Fictions.List(list: "bestrated", page: 1, perPage: 20);
if (!list.IsSuccess)
{
    Console.WriteLine(list.Error?.Message);
    return;
}

foreach (var fiction in list.Result?.Data ?? [])
{
    Console.WriteLine(fiction.Title);
}

Register with Dependency Injection

using Microsoft.Extensions.DependencyInjection;
using RoyalRoadSharp;

var services = new ServiceCollection();
services.AddRoyalRoad(builder => builder
    .WithApiConfig(userAgent: "MyApp/1.0")
    .WithAccessToken("<access-token>"));

using var provider = services.BuildServiceProvider();
var royalRoad = provider.GetRequiredService<IRoyalRoad>();

Authenticated Calls

Authenticated methods use IRoyalRoadCredentials. Configure a token with WithAccessToken or read it from configuration with WithAccessTokenFromConfig.

var royalRoad = RoyalRoad.Create(builder => builder.WithAccessToken("<access-token>"));
var follows = await royalRoad.Fictions.Follows();

Error Handling

By default, failed HTTP responses are returned as failed ApiResult<T> values.

var result = await royalRoad.Fictions.Information(12345);
if (result.TryGetError(out var error))
{
    Console.WriteLine($"RoyalRoad request failed: {error?.Message}");
}

Set throwOnError: true or call ThrowExceptionOnError to throw RoyalRoadApiException for failed HTTP responses.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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
0.0.2 141 7/3/2026