Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lbrndnr/soundcloud
The private SoundCloud API v2 in Swift
https://github.com/lbrndnr/soundcloud
combine soundcloud soundcloud-api swift
Last synced: 2 months ago
JSON representation
The private SoundCloud API v2 in Swift
- Host: GitHub
- URL: https://github.com/lbrndnr/soundcloud
- Owner: lbrndnr
- License: mit
- Created: 2020-12-20T15:45:23.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-01-16T07:28:53.000Z (11 months ago)
- Last Synced: 2024-10-10T00:43:46.867Z (2 months ago)
- Topics: combine, soundcloud, soundcloud-api, swift
- Language: Swift
- Homepage:
- Size: 116 KB
- Stars: 34
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SoundCloud
[![Twitter: @lbrndnr](https://img.shields.io/badge/[email protected]?style=flat)](https://twitter.com/lbrndnr)
[![License](http://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/lbrndnr/SoundCloud/blob/master/LICENSE)## About
`SoundCloud` is a Swift package that implements the private SoundCloud API v2. It allows you to login and request the user stream or system playlists, among others. Note that this API is private. I was not granted access to the API nor its documentation, so this package could break at any given moment. This also means that you should definitely use your own client id, since it's likely to expire at some point.
## Usage
You can login using the following request:
```swift
@State private var subscriptions = Set()SoundCloud.login(username: username, password: password)
.receive(on: RunLoop.main)
.sink(receiveCompletion: { completion in
}, receiveValue: { accessToken in
print("Logged in with access token: \(accessToken)")
})
.store(in: &subscriptions)
```Note that it's currently not possible to login using Google accounts that have been granted access to SoundCloud.
A typical request to fetch recommendations on whom to follow can be implemented as follows:
```swift
@State private var users = [User]()
@State private var subscriptions = Set()SoundCloud.shared.get(.whoToFollow())
.map { $0.collection }
.replaceError(with: [])
.receive(on: RunLoop.main)
.map { $0.map { $0.user } }
.assign(to: \.users, on: self)
.store(in: &subscriptions)
```
## Requirements
`SoundCloud` is built using Swift 5 and Combine.## Author
I'm Laurin Brandner, I'm on [Twitter](https://twitter.com/lbrndnr).## License
`SoundCloud` is licensed under the [MIT License](http://opensource.org/licenses/mit-license.php).