Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/michaelnisi/fanboy-kit
Search podcasts via proxy
https://github.com/michaelnisi/fanboy-kit
Last synced: about 2 months ago
JSON representation
Search podcasts via proxy
- Host: GitHub
- URL: https://github.com/michaelnisi/fanboy-kit
- Owner: michaelnisi
- License: mit
- Created: 2015-11-23T20:44:51.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2020-11-22T08:52:46.000Z (about 4 years ago)
- Last Synced: 2024-10-13T18:45:31.354Z (3 months ago)
- Language: Swift
- Homepage:
- Size: 45.9 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# FanboyKit
Search iTunes with FanboyKit. This Swift package provides a client for [fanboy-http](https://github.com/michaelnisi/fanboy-http), a caching proxy for the [iTunes Search API](https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/). FanboyKit is used in the [Podest](https://github.com/michaelnisi/podest) podcast app.
## Example
Querying for suggestions matching the term `"crook"` limiting the result to 10.
```swift
import Foundation
import Patron
import FanboyKitlet url = URL(string: "https://your.endpoint")!
let s = URLSession(configuration: .default)
let p = Patron(URL: url, session: s)
let svc = Fanboy(client: p)try! svc.suggestions(matching: "crook", limit: 10) { result, error in
print(error ?? result)
}
```Please refer to [fanboy-http](https://github.com/michaelnisi/fanboy-http) for details.
## Types
### FanboyError
```swift
enum FanboyError: Error {
case unexpectedResult(result: AnyObject?)
case cancelledByUser
case invalidTerm
}
```### FanboyService
```swift
protocol FanboyService {
var client: JSONService { get }@discardableResult func version(
completionHandler cb: @escaping (_ version: String?, Error?) -> Void
) -> URLSessionTask@discardableResult func search(
term: String,
completionHandler cb: @escaping (
_ podcasts: [[String : AnyObject]]?, _ error: Error?) -> Void
) throws -> URLSessionTask@discardableResult func lookup(
guids: [String],
completionHandler cb: @escaping (
_ podcasts: [[String : AnyObject]]?, _ error: Error?) -> Void
) -> URLSessionTask@discardableResult func suggestions(
matching: String,
limit: Int,
completionHandler cb: @escaping (
_ terms: [String]?, _ error: Error?) -> Void
) throws -> URLSessionTask
}
```#### client
```swift
var client: JSONService { get }
```The client property of the `FanboyService` object gives access to the underlying [Patron](https://github.com/michaelnisi/patron) client, providing hostname and status of the remote service.
## Test
With **fanboy-http** running, do:
```
$ swift test
```## Install
📦 Add `https://github.com/michaelnisi/fanboy-kit` to your package manifest.
## License
[MIT License](https://github.com/michaelnisi/fanboy-kit/blob/master/LICENSE)