Unsplasharp Documentation

A modern, asynchronous, and feature-rich .NET library for the Unsplash API. This comprehensive documentation will help you get started quickly and make the most of Unsplasharp's powerful features.

🚀 Quick Start

New to Unsplasharp? Start here:

  1. Getting Started Guide - Complete setup guide with examples
  2. API Key Setup - How to get your Unsplash API credentials
  3. Basic Examples - Simple code examples to get you started

📚 Core Documentation

Essential Guides

Advanced Topics

Integration & Configuration

🎯 Quick Navigation

By Use Case

I want to... Go to
Get started quickly Getting Started Guide
Search for photos Search Examples
Handle errors properly Error Handling Guide
Download images Download Examples
Build a web app Web Integration
Test my code Testing Guide
Optimize performance Advanced Patterns
Migrate from older version Migration Guide

By Experience Level

Level Recommended Reading
Beginner Getting StartedBasic ExamplesError Handling
Intermediate API ReferenceAdvanced PatternsModel Reference
Advanced Testing GuidePerformance OptimizationMigration Guide

🔧 API Overview

Unsplasharp provides access to all major Unsplash API endpoints:

Core Features

  • Photos: Get random photos, search, retrieve by ID
  • Collections: Browse curated collections
  • Users: Access photographer profiles and portfolios
  • Search: Powerful search with filters and pagination
  • Statistics: Platform usage statistics

Modern .NET Features

  • Async/Await: Full async support with cancellation tokens
  • Exception Handling: Specific exception types with rich context
  • Dependency Injection: Built-in DI container support
  • IHttpClientFactory: Proper HTTP client lifecycle management
  • Structured Logging: Microsoft.Extensions.Logging integration
  • Performance: Connection pooling and intelligent caching

🎨 Code Examples

Quick Example

using Unsplasharp;

// Create client
var client = new UnsplasharpClient("YOUR_APPLICATION_ID");

// Get a random photo
try
{
    var photo = await client.GetRandomPhotoAsync();
    Console.WriteLine($"Photo by {photo.User.Name}: {photo.Urls.Regular}");
}
catch (UnsplasharpException ex)
{
    Console.WriteLine($"Error: {ex.Message}");
}

Search Photos

// Search with filters
var photos = await client.SearchPhotosAsync(
    query: "mountain landscape",
    orientation: Orientation.Landscape,
    color: "blue",
    perPage: 20
);

foreach (var photo in photos)
{
    Console.WriteLine($"{photo.Description} by {photo.User.Name}");
}

More examples: Code Examples & Recipes

🛠️ Installation

Package Manager Console

Install-Package Unsplasharp

.NET CLI

dotnet add package Unsplasharp

PackageReference

<PackageReference Include="Unsplasharp" Version="*" />

🔗 External Resources

💡 Need Help?

📝 Contributing

Unsplasharp is an open-source project. Contributions are welcome! Please see the contribution guidelines for more information.


Ready to get started?Getting Started Guide