Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ipavlidakis/putiokit
A wrapper around Put.io api
https://github.com/ipavlidakis/putiokit
combine ios ios13 ipados macos putio tvos watchos zero-dependencies
Last synced: about 2 months ago
JSON representation
A wrapper around Put.io api
- Host: GitHub
- URL: https://github.com/ipavlidakis/putiokit
- Owner: ipavlidakis
- License: mit
- Created: 2019-07-21T15:59:07.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-05T19:22:47.000Z (over 4 years ago)
- Last Synced: 2024-10-19T15:58:22.895Z (2 months ago)
- Topics: combine, ios, ios13, ipados, macos, putio, tvos, watchos, zero-dependencies
- Language: Swift
- Homepage: https://api.put.io
- Size: 114 KB
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PutioKit
A simple wrapper around put.io api. PutioKit wraps all available endpoints and provides an easy and typesafe way to interact with it.
Supports:
- macOS(>=10.15)
- iOS(>=13.0)
- iPadOS(>=13.0)
- watchOS(>=6.0)
- tvOS(>=13.0)# Installation
## SPM
Add the following in the _dependencies_ array in Package.swift
> .package(url: "https://github.com/ipavlidakis/PutioKit.git", from: "1.0.0")# Architecture
The kit is splitting the available endpoints from the API into seperate services: Currently you can find the following available services:
* Account
* Authentication
* Config
* Events
* Files
* Friends
* RSS
* Shares
* Transfers
* ZipEach services requires 3 things:
1. An instance of the `ApiClientModel`
2. An instance conforming to the `NetworkHandling` protocol
3. An instance confroming to the `CredentialsStoring` protocol## ApiClientModel
The `ApiClientModel` struct represents your put.io application. It contains values like:
* id
* secret
* nameThe `ApiClientModel` is used to fill in the required information to communicate with the API.
## NetworkHandling
The instance that will passed to the services will be used to perform all the network operations. The object is responsible to provide - additionally to the task execution role - a jsonDecoder responsible to parse the data received from the API but also a `decode` method that is used to seperate the different types of available results that may happen per request (e.g on a response for a File object the response may error. In that case the result is an `ErrorModel`. The decode method in `URLSession` is already hanlind those cases for you, so it can always return a meaningful result)
> For ease of use, `URLSession` conforms to `NetworkHandling`
## CredentialsStoring
The instance that will passed to the service will be used to as a provider for the access token, required to communicate with the API
# Next Steps
- [ ] Write documentation
- [ ] Provide a playground app
- [ ] Setup actions on the repo
- [ ] Write unit tests
- [ ] Implement retry logic on failures
- [ ] Add progress on uploadTasks
- [ ] Add progress on dataTasks# Author
Ilias Pavlidakis
- [mail]([email protected])
- [twitter](https://twitter.com/3liaspav)# License
PutioKit is released under the MIT license. See LICENSE for details.