Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional import of FoundationNetworking #5

Merged
merged 4 commits into from
Jul 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,11 @@ Gravatar doesn't have an official spec of the JSON data, so there is a lot of tr
Check the list below on ideas how to help:

* DocC documentation.
* Port getProfile to FoundationNetwork based platforms (URLSession compatibility).
* Convert Photo.Type and InstantMessenger.Type from String to Enums.
* Support for Github Codespaces (Linux based).
* Separate structures into files.
* Add SwiftNIO download support.
* Add built-in SwiftNIO download support.

# Why use Apple Crypto library?

Expand Down
3 changes: 3 additions & 0 deletions Sources/SwiftGravatar/SwiftGravatar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ extension GravatarProfile {
return "https://en.gravatar.com/\(emailMD5).json"
}

// WISHLIST: Port getProfile to FoundationNetwork based platforms, URLSession compatibility
#if !os(Linux)
// Request JSON Profile Data from Gravatar
// Docs: https://en.gravatar.com/site/implement/profiles/json/
public static func getProfile(using email: String) async throws -> GravatarProfile? {
Expand All @@ -101,6 +103,7 @@ extension GravatarProfile {
}
return nil
}
#endif

/* SWIFTNIO
static func get(using email: String, on request: Request) -> EventLoopFuture<GravatarProfile> {
Expand Down