Ragware.QnapPhotoApi 0.8.1

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

// Install Ragware.QnapPhotoApi as a Cake Tool
#tool nuget:?package=Ragware.QnapPhotoApi&version=0.8.1                

QnapPhotoApi.NET

This is a .NET Web API wrapper around the QNap Photo Station api.

Provides the following capabilities.

  1. An Api which calls Qnap Photo Station's /list.phtp endpoint to retrieve
    • all photos or videos (ListAsync)
    • all albums, smart or otherwise (ListAlbumsAsync)
    • all photos within an album (ListAlbumPhotosAsync)
  2. Single images - This is middleware, acting as a proxy to PhotoStation on your NAS. It just forwards the response stream.
    • /image/{imageId} - Full size image
    • /thumb/{imageId} - Thumbnail of the supplied image. The size of this thumbnail depends on how thumbnails are processed in your NAS.

Configuration

  1. Get the nuget package
  2. Add configuration to your appsettings.json. Username and Password are the credentials you use to login to your nas.
"QnapApi": {
    "BaseUrl": "http://nas",
    "Username": "Rob",
    "Password": "Y0UrP455w0rd!"
}
  1. Install in your web app/api (see below)
// This will register CSharp API client to make the /list calls.
builder.Services.AddQnapPhotoApi(builder.Configuration);

var app = builder.Build();

// This is important to get the /image and /thumb endpoints.
app.UseQnapImageMiddleware();

Usage


app.MapGet("/list/{page:int}", async (int page, [FromServices] IPhotoStationClient qnapClient, CancellationToken cancellationToken) =>
    {
        var request = new ListRequest
        {
            MediaType = MediaType.Photos,
            SortDirection = SortDirection.Descending,
            PageNumber = page,
            PageSize = 100,
        };

        return await qnapClient.ListAsync(request, cancellationToken);
    })
    .WithName("ListPhotos")
    .WithTags("QnapPhotos")
    .WithOpenApi();

app.MapGet("/list-album-photos/{albumId}/{page:int}", async (string albumId, int page, [FromServices] IPhotoStationClient qnapClient, CancellationToken cancellationToken) =>
    {
        var request = new ListAlbumPhotosRequest()
        {
            AlbumId = albumId,
            SortDirection = SortDirection.Descending,
            Sort = Sort.DateAdded,
            PageNumber = page,
            PageSize = 100,
        };

        return await qnapClient.ListAlbumPhotosAsync(request, cancellationToken);
    })
    .WithName("ListAlbumPhotos")
    .WithTags("QnapPhotos")
    .WithOpenApi();

app.MapGet("/list-album/{page:int}", async (int page, [FromServices] IPhotoStationClient qnapClient, CancellationToken cancellationToken) =>
    {
        var request = new ListAlbumsRequest()
        {
            SortDirection = SortDirection.Descending,
            AlbumType = AlbumType.All,
            Sort = AlbumSort.Title,
            PageNumber = page,
            PageSize = 100,
        };

        return await qnapClient.ListAlbumsAsync(request, cancellationToken);
    })
    .WithName("ListAlbums")
    .WithTags("QnapPhotos")
    .WithOpenApi();
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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.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.8.1 96 12/28/2024
0.8.0 81 12/28/2024
0.2.2 77 12/28/2024