Swiftpack.co - Package - JoeyBodnar/Antioch

Antioch

Antioch is an Apple Music API wrapper. I use it in my Apple Music client, Sathorn.

Supported endpoints:

Catalog Endpoints
  • getCatalogResource
  • getMultipleCatalogResources
  • charts
Library Endpointss
  • getLibraryResource
  • getMultipleLibraryResources
  • getAllLibrayResources
  • addItemsToLibrary
  • recommendations
  • songsForPlaylist
  • addItemsToPlaylist
Ratings
  • rate (an catalog or library item)
  • rateWithId
  • multipleRatings (get request)
Search
  • searchCatalog
  • searchLibrary
  • searchHints
History
  • recentStations

Installation

Carthage

Antioch only supports Carthage. Installation with Carthage is simple. Just add github "JoeyBodnar/Antioch" to your Cartfile. then, drag the Antioch.framework file to "Link Binaries and Libraries" in your Xcode project.

Documentation

Initialization

To use Antioch, you must initialize it with your region storefront and your Apple Music developer token. You can use either the method configure(storeFront: String, authenticationHeader: String), or you can set them individually:

 Antioch.shared.storeFront = "us" // or "ca" for canada, "tw" for Taiwan (the real China), etc
 Antioch.shared.authenticationHeader = "<your value here>"

To make user specific requests, such as getting ratings for a user, loving/disliking a song, or getting their recommendations, you will need to set the user's token as well:

 Antioch.shared.musicUserToken = "<user token value here>"

Retrieving Data

To get a catalog song by ID:

Antioch.shared.catalogSong(forId: "id here") { (song, error) in
    if let unwrappedSong = song {

    }
}

You can retrieve any catalog item by ID. Just pass in the ID and the type. Valid types are CatalogSong.self, CatalogPlaylist.self, CatalogAlbum.self, and RadioStation.self:

Antioch.shared.catalogItem(forId: "", ofType: CatalogSong.self) { (song, error) in
    if let unwrappedSong = song {

    }
}

Github

link
Stars: 1

Dependencies

Used By

Total: 0

Releases

Swift Package Manager support - 2020-10-13 08:15:02

  • now supports swift package manager 🥳

Mac support - 2020-03-09 15:55:40

Mac support

Add librarySongs method - 2020-02-26 14:33:22

Adds method to get multiple library songs by their ids

Release 0.5.5 - Fix playParams - 2019-12-13 12:25:15

  • Fix an issue with playParams on CatalogSong
  • Add debug print for failing to parse JSON
  • Add more genres

Add ability to get charts for a genre - 2019-12-05 10:17:37

Add the ability to get charts for specific genres in the chartsForGenre method

Add documentation - 2019-12-05 04:08:28

  • Adds code comments/documentation
  • Makes "us" the default storeFront
  • Cleans up some code

Deployment target 11.0 - 2019-12-03 12:01:02

Changes the minimum deployment target to iOS 11.0

Fix Carthage xcuserdata - 2019-11-29 15:37:21

Adds xcuserdata to git. There was a previous error with Carthage not being able to build the repository properly.

First release - 2019-11-29 15:14:04

This is the first release of Antioch, a Swift wrapper for the Apple Music REST API.