Rocket.Unsplash 0.0.1

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

Rocket.Unsplash

A modern, fully-typed .NET wrapper for the Unsplash API, built for .NET 10 with C# 14.

Features

  • Full API coverage — all documented endpoints including read and write operations
  • Modern C# — record types, primary constructors, nullable reference types
  • Dependency injectionservices.AddUnsplash() with IHttpClientFactory integration
  • PaginationPaginatedResult<T> with metadata from response headers
  • Search — photos, collections, and users with full filter support
  • Auth — public (Client-ID) and user (Bearer) authentication
  • Error handling — typed UnsplashApiException with status codes and error messages

Installation

dotnet add package Rocket.Unsplash

Quick Start

Dependency Injection

builder.Services.AddUnsplash(options =>
{
    options.AccessKey = "YOUR_ACCESS_KEY";
});

// For user-authenticated actions:
builder.Services.AddUnsplash(options =>
{
    options.AccessKey = "YOUR_ACCESS_KEY";
    options.BearerToken = "USER_BEARER_TOKEN";
});

Standalone Usage

var client = new UnsplashClient(new HttpClient
{
    BaseAddress = new Uri("https://api.unsplash.com")
});

Inject and Use

public class MyService(IUnsplashClient unsplash)
{
    public async Task DoWorkAsync()
    {
        var photos = await unsplash.Photos.ListAsync(page: 1, perPage: 20);
        var photo = await unsplash.Photos.GetAsync("Dwu85P9SOIk");
        var random = await unsplash.Photos.GetRandomAsync(query: "coffee", orientation: Orientation.Portrait);
        var many = await unsplash.Photos.GetRandomAsync(count: 5, query: "nature");

        var results = await unsplash.Search.SearchPhotosAsync("mountains", perPage: 15);
        var user = await unsplash.Users.GetProfileAsync("jimmyexample");
        var stats = await unsplash.Stats.GetTotalsAsync();
    }
}

API Coverage

Service Endpoints
Current User Get profile, update profile
Users Get profile, list photos, list collections, get statistics
Photos List, get, random (single & batch), statistics, track download, update
Search Search photos, search collections, search users
Collections List, get, get photos, get related, create, update, delete, add/remove photo
Topics List, get, get topic photos
Stats Totals, month

Examples

Search Photos with Filters

var results = await unsplash.Search.SearchPhotosAsync(
    query: "ocean",
    page: 2,
    perPage: 20,
    orderBy: SearchPhotosOrderBy.Latest,
    color: "blue",
    orientation: Orientation.Landscape,
    contentFilter: ContentFilter.High);

Collections CRUD

var collection = await unsplash.Collections.CreateAsync(
    title: "My Favorites",
    description: "Best photos",
    @private: false);

await unsplash.Collections.AddPhotoAsync(collection.Id!.Value, "Dwu85P9SOIk");
await unsplash.Collections.RemovePhotoAsync(collection.Id.Value, "Dwu85P9SOIk");
await unsplash.Collections.DeleteAsync(collection.Id.Value);

Pagination

var page1 = await unsplash.Photos.ListAsync(page: 1, perPage: 30);

Console.WriteLine($"Total: {page1.Total}");
Console.WriteLine($"Total Pages: {page1.TotalPages}");

foreach (var photo in page1.Results)
{
    Console.WriteLine($"{photo.Id}: {photo.Urls?.Regular}");
}

Current User (requires Bearer token)

var me = await unsplash.Me.GetCurrentUserAsync();

var updated = await unsplash.Me.UpdateCurrentUserAsync(
    new UpdateCurrentUserRequest
    {
        FirstName = "New Name",
        Bio = "Updated bio"
    });

Error Handling

try
{
    var photo = await unsplash.Photos.GetAsync("invalid_id");
}
catch (UnsplashApiException ex)
{
    Console.WriteLine($"Status: {ex.StatusCode}");
    Console.WriteLine($"Errors: {string.Join(", ", ex.Errors)}");
}

Configuration

Option Default Description
AccessKey null Your Unsplash application access key
BearerToken null User bearer token for authenticated actions
BaseUrl https://api.unsplash.com API base URL (can be overridden for testing)

Requirements

License

MIT

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.1 152 4/6/2026