Skip to content

Commit e935f64

Browse files
committed
Modernised code style
1 parent e3a19ce commit e935f64

130 files changed

Lines changed: 10598 additions & 10547 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 209 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,220 @@
11
# Flickr.Net
22

3-
[![NuGet](https://img.shields.io/nuget/v/Flickr.Net.svg?style=flat-square)](https://www.nuget.org/packages/Flickr.Net)
4-
[![Nuget](https://img.shields.io/nuget/dt/Flickr.Net)](https://www.nuget.org/packages/Flickr.Net)
3+
[![NuGet](https://img.shields.io/nuget/v/Flickr.Net.svg)](https://www.nuget.org/packages/Flickr.Net/)
4+
[![NuGet Downloads](https://img.shields.io/nuget/dt/Flickr.Net.svg)](https://www.nuget.org/packages/Flickr.Net/)
5+
[![License](https://img.shields.io/github/license/st0o0/Flickr.Net.svg)](LICENSE)
56

6-
## How is Flickr.Net Used?
7+
A modern, fully-featured .NET client library for the Flickr API with comprehensive support for photos, albums, galleries, and user management.
78

8-
WIP
9+
## ✨ Features
910

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

12-
| Branch | Status |
13-
| ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
14-
| Master | [![Build Status](https://dev.azure.com/gwittr/Flickr.Net/_apis/build/status%2FRELEASE-Pipeline?branchName=master)](https://dev.azure.com/gwittr/Flickr.Net/_build/latest?definitionId=15&branchName=master) |
15-
| Dev | [![Build Status](https://dev.azure.com/gwittr/Flickr.Net/_apis/build/status%2FCI-Pipeline?branchName=dev)](https://dev.azure.com/gwittr/Flickr.Net/_build/latest?definitionId=14&branchName=dev) |
22+
## 📦 Installation
1623

17-
## Install Flickr.Net via NuGet
24+
Install via NuGet Package Manager:
1825

19-
If you want to include Flickr.Net in your project, you can [install it directly from NuGet](https://www.nuget.org/packages/Flickr.Net/)
26+
```bash
27+
dotnet add package Flickr.Net
28+
```
29+
30+
Or via Package Manager Console:
31+
32+
```powershell
33+
Install-Package Flickr.Net
34+
```
35+
36+
## 🚀 Quick Start
37+
38+
### Authentication
39+
40+
```csharp
41+
using Flickr.Net;
42+
43+
// Initialize with API key
44+
var flickr = new FlickrNet("your-api-key", "your-api-secret");
45+
46+
// OAuth authentication
47+
var requestToken = await flickr.OAuthGetRequestTokenAsync("oob");
48+
var authUrl = flickr.OAuthCalculateAuthorizationUrl(requestToken.Token, AuthLevel.Read);
49+
50+
// Open authUrl in browser, get verification code
51+
var accessToken = await flickr.OAuthGetAccessTokenAsync(requestToken, "verification-code");
52+
53+
// Now you're authenticated!
54+
```
55+
56+
### Search Photos
57+
58+
```csharp
59+
var options = new PhotoSearchOptions
60+
{
61+
Text = "sunset",
62+
Tags = "nature,landscape",
63+
PerPage = 20,
64+
Page = 1,
65+
Extras = PhotoSearchExtras.All
66+
};
67+
68+
var photos = await flickr.PhotosSearchAsync(options);
69+
70+
foreach (var photo in photos.Photos)
71+
{
72+
Console.WriteLine($"{photo.Title} by {photo.OwnerName}");
73+
Console.WriteLine($"URL: {photo.LargeUrl}");
74+
}
75+
```
76+
77+
### Upload Photos
78+
79+
```csharp
80+
var uploadOptions = new UploadOptions
81+
{
82+
Title = "My Vacation Photo",
83+
Description = "Beautiful sunset at the beach",
84+
Tags = new[] { "vacation", "sunset", "beach" },
85+
IsPublic = true,
86+
IsFamily = false,
87+
IsFriend = false
88+
};
89+
90+
var photoId = await flickr.UploadPictureAsync("path/to/photo.jpg", uploadOptions);
91+
Console.WriteLine($"Photo uploaded with ID: {photoId}");
92+
```
93+
94+
### Get User Photos
95+
96+
```csharp
97+
var userId = "123456789@N00"; // Flickr user ID
98+
var photos = await flickr.PeopleGetPhotosAsync(userId, SafetyLevel.Safe, 1, 50);
99+
100+
foreach (var photo in photos.Photos)
101+
{
102+
Console.WriteLine($"{photo.Title} - {photo.DateTaken}");
103+
}
104+
```
105+
106+
### Manage Albums
107+
108+
```csharp
109+
// Create an album
110+
var albumId = await flickr.PhotosetsCreateAsync("Vacation 2024", "Summer vacation photos", "primary-photo-id");
111+
112+
// Add photos to album
113+
await flickr.PhotosetsAddPhotoAsync(albumId, "photo-id-1");
114+
await flickr.PhotosetsAddPhotoAsync(albumId, "photo-id-2");
20115

116+
// Get album photos
117+
var albumPhotos = await flickr.PhotosetsGetPhotosAsync(albumId);
21118
```
22-
PM> Install-Package Flickr.Net
119+
120+
## 📚 Advanced Usage
121+
122+
### Custom Photo Search with Filters
123+
124+
```csharp
125+
var searchOptions = new PhotoSearchOptions
126+
{
127+
UserId = "user-id",
128+
MinUploadDate = DateTime.Now.AddMonths(-1),
129+
MaxUploadDate = DateTime.Now,
130+
MediaType = MediaType.Photos,
131+
ContentType = ContentType.Photo,
132+
SafetyLevel = SafetyLevel.Safe,
133+
SortOrder = PhotoSearchSortOrder.DatePostedDesc,
134+
PerPage = 100,
135+
Extras = PhotoSearchExtras.DateUploaded |
136+
PhotoSearchExtras.DateTaken |
137+
PhotoSearchExtras.Url_O
138+
};
139+
140+
var results = await flickr.PhotosSearchAsync(searchOptions);
23141
```
142+
143+
### Favorites Management
144+
145+
```csharp
146+
// Add to favorites
147+
await flickr.FavoritesAddAsync("photo-id");
148+
149+
// Get user's favorites
150+
var favorites = await flickr.FavoritesGetListAsync("user-id", perPage: 50);
151+
152+
// Remove from favorites
153+
await flickr.FavoritesRemoveAsync("photo-id");
154+
```
155+
156+
### Comments and Notes
157+
158+
```csharp
159+
// Add a comment
160+
var commentId = await flickr.PhotosCommentsAddCommentAsync("photo-id", "Great photo!");
161+
162+
// Get all comments
163+
var comments = await flickr.PhotosCommentsGetListAsync("photo-id");
164+
165+
// Add a note to a photo
166+
await flickr.PhotosNotesAddAsync("photo-id", 100, 100, 50, 50, "This is a note");
167+
```
168+
169+
## 🔧 Configuration
170+
171+
### Rate Limiting
172+
173+
```csharp
174+
var flickr = new FlickrNet("api-key", "api-secret")
175+
{
176+
HttpTimeout = TimeSpan.FromSeconds(30),
177+
InstanceCacheDisabled = false
178+
};
179+
```
180+
181+
### Proxy Support
182+
183+
```csharp
184+
var proxy = new WebProxy("proxy-server:port");
185+
flickr.Proxy = proxy;
186+
```
187+
188+
## 📖 Documentation
189+
190+
For detailed API documentation, visit:
191+
192+
- [Flickr API Documentation](https://www.flickr.com/services/api/)
193+
- [Full API Reference](https://github.com/st0o0/Flickr.Net/wiki)
194+
195+
## 🤝 Contributing
196+
197+
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.
198+
199+
1. Fork the repository
200+
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
201+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
202+
4. Push to the branch (`git push origin feature/AmazingFeature`)
203+
5. Open a Pull Request
204+
205+
## 📋 Requirements
206+
207+
- .NET 8.0 or higher
208+
- Flickr API key and secret ([Get yours here](https://www.flickr.com/services/apps/create/))
209+
210+
## 📝 License
211+
212+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
213+
214+
## 🙏 Acknowledgments
215+
216+
- Original FlickrNet library by Sam Judson
217+
218+
---
219+
220+
**Built with ❤️ for the .NET

src/Flickr.Net.Test/Entities/BlogTests.cs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,27 @@ public class BlogTests
1010
[Fact]
1111
public void JsonStringToBlogs()
1212
{
13-
var json = /*lang=json*/ """
14-
{
15-
"stat": "ok",
16-
"blogs":{
17-
"blog": [
18-
{
19-
"id" : "73",
20-
"name" : "Bloxus test",
21-
"needspassword" : "0",
22-
"url" : "http://remote.bloxus.com/"
23-
},
24-
{
25-
"id" : "74",
26-
"name" : "Manila Test",
27-
"needspassword" : "1",
28-
"url" : "http://flickrtest1.userland.com/"
29-
}
30-
]
31-
}
32-
}
33-
""";
13+
const string json = """
14+
{
15+
"stat": "ok",
16+
"blogs":{
17+
"blog": [
18+
{
19+
"id" : "73",
20+
"name" : "Bloxus test",
21+
"needspassword" : "0",
22+
"url" : "http://remote.bloxus.com/"
23+
},
24+
{
25+
"id" : "74",
26+
"name" : "Manila Test",
27+
"needspassword" : "1",
28+
"url" : "http://flickrtest1.userland.com/"
29+
}
30+
]
31+
}
32+
}
33+
""";
3434

3535
var result = FlickrConvert.DeserializeObject<FlickrResult<Blogs>>(Encoding.UTF8.GetBytes(json));
3636

src/Flickr.Net.Test/Entities/CSVFileTests.cs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,30 @@ public class CSVFileTests
1010
[Fact]
1111
public void JsonStringToCSVFiles()
1212
{
13-
var json = /*lang=json,strict*/ """
14-
{
15-
"stat": "ok",
16-
"stats": {
17-
"csvfiles": [
18-
{
19-
"href": "http://farm4.static.flickr.com/3496/stats/72157623902771865_faaa.csv",
20-
"type": "daily",
21-
"date": "2010-04-01"
22-
},
23-
{
24-
"href": "http://farm4.static.flickr.com/3376/stats/72157624027152370_fbbb.csv",
25-
"type": "monthly",
26-
"date": "2010-04-01"
27-
},
28-
{
29-
"href": "http://farm5.static.flickr.com/4006/stats/72157623627769689_fccc.csv",
30-
"type": "daily",
31-
"date": "2010-03-01"
32-
}
33-
]
34-
}
35-
}
36-
""";
13+
const string json = """
14+
{
15+
"stat": "ok",
16+
"stats": {
17+
"csvfiles": [
18+
{
19+
"href": "http://farm4.static.flickr.com/3496/stats/72157623902771865_faaa.csv",
20+
"type": "daily",
21+
"date": "2010-04-01"
22+
},
23+
{
24+
"href": "http://farm4.static.flickr.com/3376/stats/72157624027152370_fbbb.csv",
25+
"type": "monthly",
26+
"date": "2010-04-01"
27+
},
28+
{
29+
"href": "http://farm5.static.flickr.com/4006/stats/72157623627769689_fccc.csv",
30+
"type": "daily",
31+
"date": "2010-03-01"
32+
}
33+
]
34+
}
35+
}
36+
""";
3737

3838
var result = FlickrConvert.DeserializeObject<FlickrResult<CSVFiles>>(Encoding.UTF8.GetBytes(json));
3939

0 commit comments

Comments
 (0)