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 handlerDeclaration
Swift
public class func getAccountInfo(completionHandler: @escaping (Account?, Error?) -> Void)Parameters
completionHandlerThe response handler
-
Fetch settings from the API
Parameter
Parameter completionHandler: The response handlerDeclaration
Swift
public class func getSettings(completionHandler: @escaping (Settings?, Error?) -> Void)Parameters
completionHandlerThe response handler
-
Get a list of events from Put.io
Parameter
Parameter completionHandler: The response handlerDeclaration
Swift
public class func getEvents(completionHandler: @escaping ([Event], Error?) -> Void)Parameters
completionHandlerThe response handler
-
Clear all events from Put.io
Parameter
Parameter completionHandler: The response handlerDeclaration
Swift
public class func deleteEvents(completionHandler: @escaping (Bool) -> Void)Parameters
completionHandlerThe 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
fromParentThe parent to retreive files from. By default this is 0 meaning the root directory.
completionHandlerThe response handler
- Parameters:
-
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
filesThe files to delete
completionHandlerThe response handler
- Parameters:
-
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
filesThe files to move
toThe ID of the directory to move files to
completionHandlerThe response handler
- Parameters:
-
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
folderThe name of the folder to create.
parentThe ID of the parent directory it should be placed in. This defaults to the root directory (0).
completionHandlerThe response handler
- Parameters:
-
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
filesThe files to share
withThe usernames to share files with
completionHandlerThe response handler
- Parameters:
-
Fetch transfers from the API
Parameter
Parameter completionHandler: The response handlerDeclaration
Swift
public class func getTransfers(completionHandler: @escaping ([Transfer], Error?) -> Void)Parameters
completionHandlerThe 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
urlThe URL the transfer should be added from.
parentThe parent directory the file should be added to. Defaults to the root directory.
extractWhether zip files should be extracted. Defaults to false.
completionHandlerThe response handler
- Parameters:
-
Clean up all completed transfers
Parameter
Parameter completionHandler: The response handlerDeclaration
Swift
public class func cleanTransfers(completionHandler: @escaping (Bool) -> Void)Parameters
completionHandlerThe 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
transfersThe transfers to cancel
completionHandlerThe response handler
- Parameters:
Putio Class Reference