Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A wrapper around Put.io api

License

NotificationsYou must be signed in to change notification settings

ipavlidakis/PutioKit

Repository files navigation

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 thedependencies 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
  • Zip

Each services requires 3 things:

  1. An instance of theApiClientModel
  2. An instance conforming to theNetworkHandling protocol
  3. An instance confroming to theCredentialsStoring protocol

ApiClientModel

TheApiClientModel struct represents your put.io application. It contains values like:

  • id
  • secret
  • name

TheApiClientModel 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 adecode 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 anErrorModel. The decode method inURLSession is already hanlind those cases for you, so it can always return a meaningful result)

For ease of use,URLSession conforms toNetworkHandling

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

License

PutioKit is released under the MIT license. See LICENSE for details.


[8]ページ先頭

©2009-2025 Movatter.jp