Skip to content

Repository files navigation

Flickr.Net

NuGetNuGet Downloads

A modern, fully-featured .NET client library for the Flickr API with comprehensive support for photos, albums, galleries, and user management.

✨ Features

  • 🖼️ Photo Management - Upload, download, search, and organize photos
  • 📚 Albums & Collections - Create and manage photo albums and collections
  • 🎨 Galleries - Browse and interact with Flickr galleries
  • 👥 User Management - Access user profiles, contacts, and favorites
  • 🔍 Advanced Search - Powerful search capabilities with filtering
  • 🏷️ Tags & Metadata - Full support for tags, EXIF data, and metadata
  • 🔐 OAuth Authentication - Secure authentication with OAuth 1.0a
  • Async/Await - Modern async API throughout
  • 📦 Strongly Typed - Type-safe API with comprehensive models
  • 🔄 Rate Limiting - Built-in rate limit handling

📦 Installation

Install via NuGet Package Manager:

dotnet add package Flickr.Net

Or via Package Manager Console:

Install-Package Flickr.Net

🚀 Quick Start

Authentication

usingFlickr.Net;// Initialize with API keyvarflickr=newFlickrNet("your-api-key","your-api-secret");// OAuth authenticationvarrequestToken=awaitflickr.OAuthGetRequestTokenAsync("oob");varauthUrl=flickr.OAuthCalculateAuthorizationUrl(requestToken.Token,AuthLevel.Read);// Open authUrl in browser, get verification codevaraccessToken=awaitflickr.OAuthGetAccessTokenAsync(requestToken,"verification-code");// Now you're authenticated!

Search Photos

varoptions=newPhotoSearchOptions{Text="sunset",Tags="nature,landscape",PerPage=20,Page=1,Extras=PhotoSearchExtras.All};varphotos=awaitflickr.PhotosSearchAsync(options);foreach(varphotoinphotos.Photos){Console.WriteLine($"{photo.Title} by {photo.OwnerName}");Console.WriteLine($"URL: {photo.LargeUrl}");}

Upload Photos

varuploadOptions=newUploadOptions{Title="My Vacation Photo",Description="Beautiful sunset at the beach",Tags=new[]{"vacation","sunset","beach"},IsPublic=true,IsFamily=false,IsFriend=false};varphotoId=awaitflickr.UploadPictureAsync("path/to/photo.jpg",uploadOptions);Console.WriteLine($"Photo uploaded with ID: {photoId}");

Get User Photos

varuserId="123456789@N00";// Flickr user IDvarphotos=awaitflickr.PeopleGetPhotosAsync(userId,SafetyLevel.Safe,1,50);foreach(varphotoinphotos.Photos){Console.WriteLine($"{photo.Title} - {photo.DateTaken}");}

Manage Albums

// Create an albumvaralbumId=awaitflickr.PhotosetsCreateAsync("Vacation 2024","Summer vacation photos","primary-photo-id");// Add photos to albumawaitflickr.PhotosetsAddPhotoAsync(albumId,"photo-id-1");awaitflickr.PhotosetsAddPhotoAsync(albumId,"photo-id-2");// Get album photosvaralbumPhotos=awaitflickr.PhotosetsGetPhotosAsync(albumId);

📚 Advanced Usage

Custom Photo Search with Filters

varsearchOptions=newPhotoSearchOptions{UserId="user-id",MinUploadDate=DateTime.Now.AddMonths(-1),MaxUploadDate=DateTime.Now,MediaType=MediaType.Photos,ContentType=ContentType.Photo,SafetyLevel=SafetyLevel.Safe,SortOrder=PhotoSearchSortOrder.DatePostedDesc,PerPage=100,Extras=PhotoSearchExtras.DateUploaded|PhotoSearchExtras.DateTaken|PhotoSearchExtras.Url_O};varresults=awaitflickr.PhotosSearchAsync(searchOptions);

Favorites Management

// Add to favoritesawaitflickr.FavoritesAddAsync("photo-id");// Get user's favoritesvarfavorites=awaitflickr.FavoritesGetListAsync("user-id",perPage:50);// Remove from favoritesawaitflickr.FavoritesRemoveAsync("photo-id");

Comments and Notes

// Add a commentvarcommentId=awaitflickr.PhotosCommentsAddCommentAsync("photo-id","Great photo!");// Get all commentsvarcomments=awaitflickr.PhotosCommentsGetListAsync("photo-id");// Add a note to a photoawaitflickr.PhotosNotesAddAsync("photo-id",100,100,50,50,"This is a note");

🔧 Configuration

Rate Limiting

varflickr=newFlickrNet("api-key","api-secret"){HttpTimeout=TimeSpan.FromSeconds(30),InstanceCacheDisabled=false};

Proxy Support

varproxy=newWebProxy("proxy-server:port");flickr.Proxy=proxy;

📖 Documentation

For detailed API documentation, visit:

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📋 Requirements

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Original FlickrNet library by Sam Judson

**Built with ❤️ for the .NET

About

No description, website, or topics provided.

Resources

Code of conduct

Security policy

Stars

4 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages