Putio

public final class Putio

The main PutioKit class. Set your clientId, redirectUri, and accessToken here.

  • The client ID used for OAuth Authentication

    Declaration

    Swift

    public static var clientId: Int?
  • The access token used by the user to authorise requests

    Declaration

    Swift

    public static var accessToken: String?
  • The redirect URI registered with Put.io

    Declaration

    Swift

    public static var redirectUri: String?
  • The URL used for authentication with Put.io

    Declaration

    Swift

    public static var authenticationUrl: URL?
  • Get account information from Put.io

    Parameter

    Parameter completionHandler: The response handler

    Declaration

    Swift

    public class func getAccountInfo(completionHandler: @escaping (Account?, Error?) -> Void)

    Parameters

    completionHandler

    The response handler

  • Fetch settings from the API

    Parameter

    Parameter completionHandler: The response handler

    Declaration

    Swift

    public class func getSettings(completionHandler: @escaping (Settings?, Error?) -> Void)

    Parameters

    completionHandler

    The response handler

  • Get a list of events from Put.io

    Parameter

    Parameter completionHandler: The response handler

    Declaration

    Swift

    public class func getEvents(completionHandler: @escaping ([Event], Error?) -> Void)

    Parameters

    completionHandler

    The response handler

  • Clear all events from Put.io

    Parameter

    Parameter completionHandler: The response handler

    Declaration

    Swift

    public class func deleteEvents(completionHandler: @escaping (Bool) -> Void)

    Parameters

    completionHandler

    The response handler

  • Fetch a list of files from the API

    • Parameters:
      • fromParent: The parent to retreive files from. By default this is 0 meaning the root directory.
      • completionHandler: The response handler

    Declaration

    Swift

    public class func getFiles(fromParent: Int = 0, completionHandler: @escaping ([File], Error?) -> Void)

    Parameters

    fromParent

    The parent to retreive files from. By default this is 0 meaning the root directory.

    completionHandler

    The response handler

  • Delete files from the API

    • Parameters:
      • files: The files to delete
      • completionHandler: The response handler

    Declaration

    Swift

    public class func delete(files: [File], completionHandler: @escaping (Bool) -> Void)

    Parameters

    files

    The files to delete

    completionHandler

    The response handler

  • Move the selected files to a new parent directory

    • Parameters:
      • files: The files to move
      • to: The ID of the directory to move files to
      • completionHandler: The response handler

    Declaration

    Swift

    public class func move(files: [File], to: Int, completionHandler: @escaping (Bool) -> Void)

    Parameters

    files

    The files to move

    to

    The ID of the directory to move files to

    completionHandler

    The response handler

  • Create a new folder

    • Parameters:
      • folder: The name of the folder to create.
      • parent: The ID of the parent directory it should be placed in. This defaults to the root directory (0).
      • completionHandler: The response handler

    Declaration

    Swift

    public class func create(folder: String, parent: Int = 0, completionHandler: @escaping (Bool) -> Void)

    Parameters

    folder

    The name of the folder to create.

    parent

    The ID of the parent directory it should be placed in. This defaults to the root directory (0).

    completionHandler

    The response handler

  • Share files with other users on Put.io

    • Parameters:
      • files: The files to share
      • with: The usernames to share files with
      • completionHandler: The response handler

    Declaration

    Swift

    public class func share(files: [File], with friends: [String], completionHandler: @escaping (Bool) -> Void)

    Parameters

    files

    The files to share

    with

    The usernames to share files with

    completionHandler

    The response handler

  • Fetch transfers from the API

    Parameter

    Parameter completionHandler: The response handler

    Declaration

    Swift

    public class func getTransfers(completionHandler: @escaping ([Transfer], Error?) -> Void)

    Parameters

    completionHandler

    The response handler

  • Add a new transfer from a URL string

    • Parameters:
      • url: The URL the transfer should be added from.
      • parent: The parent directory the file should be added to. Defaults to the root directory.
      • extract: Whether zip files should be extracted. Defaults to false.
      • completionHandler: The response handler

    Declaration

    Swift

    public class func addTransfer(fromUrl url: String, parent: Int = 0, extract: Bool = false, completionHandler: @escaping (Transfer?, Error?) -> Void)

    Parameters

    url

    The URL the transfer should be added from.

    parent

    The parent directory the file should be added to. Defaults to the root directory.

    extract

    Whether zip files should be extracted. Defaults to false.

    completionHandler

    The response handler

  • Clean up all completed transfers

    Parameter

    Parameter completionHandler: The response handler

    Declaration

    Swift

    public class func cleanTransfers(completionHandler: @escaping (Bool) -> Void)

    Parameters

    completionHandler

    The response handler

  • Cancel the selected transfers

    • Parameters:
      • transfers: The transfers to cancel
      • completionHandler: The response handler

    Declaration

    Swift

    public class func cancel(transfers: [Transfer], completionHandler: @escaping (Bool) -> Void)

    Parameters

    transfers

    The transfers to cancel

    completionHandler

    The response handler