Latest 0.1.0
Homepage https://github.com/pJes2/Cirrus
License MIT
Platforms ios 9.0, requires ARC
Authors

CloudApp API (v3) wrapper written in Swift.

CloudApp API documentation is available here.

[CocoaPods]()

Requirements:

  • iOS 9 or later

Installation

Using CocoaPods

CocoaPods is a dependency manager for Cocoa projects.

$ gem install cocoapods

To integrate Cirrus into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

pod "Cirrus", "~> 0.1.0"

Then, run the following command:

$ pod install

Usage

First, initialize Cirrus with username and password:

let cirrus = Cirrus(username: "[email protected]", password: "p4ssw0rd")

Now, lets get first (newest) 20 user’s items:

cirrus.getItems(perPage: 20, page: nil) { (items, error, prevPageURL, nextPageURL) in
    // items: array of CItems.
    // error: NSError if something went wrong.
    // prevPageURL: URL to previous 20 items, to use with "page" parameter.
    // nextPageURL: URL to next 20 items, to use with "page" parameter.

    // Save the nextPageURL to property:
    self.nextPage = nextPageURL
}

// Now that we have nextPage available, lets fetch it:
// You don't have to provide perPage parameter, as it is already provided in nextPage, you can overwrite it though if you'd like to.
cirrus.getItems(perPage: nil, page:nextPage) { (items, error, prevPageURL, nextPageURL) in
  // ...
}

Uploading new item:

To upload new item, you need to provide the file’s data (NSData) and, while not required, it is HIGHLY recommended to provide both, a filename WITH extension and file size.
Upload progress is available in a CirrusProgressBlock.

cirrus.addItem(itemData, fileName: "filename.png", fileSize: 1337, progress: { (progress) in
    // progress
    }) { (item, error) in
        // item, error
}

CItem struct

CItem is used to represent CloudApp item ("drop") fetched from API. CItem has following properties:

id: String?
name: String?
createdAt: NSDate?
updatedAt: NSDate?
isPrivate: Bool?
longLink: Bool?
itemType: CItemType?
viewCounter: Int?
contentURL: String?
redirectURL: String?
remoteURL: String?
source: String?
isFavorite: Bool?

Available methods

getItems(_:)
getItems(perPage:page:completion:)
getItem(_:completion:)
addItem(_:fileName:fileSize:progress:completion:)
updateItem(_:name:longLink:completion:)
deleteItem(_:completion:)
addBookmark(_:completion:)
itemIsFavorite(_:completion:)
addItemToFavorites(_:completion:)
removeItemFromFavorites(_:completion:)
itemExpiration(_:completion:)
addItemExpiration(_:expiresAt:expiresAfterViews:completion:)
removeItemExpiration(_:completion:)
shareItemByEmail(_:recipients:message:completion:)

Aliased completion blocks

CirrusGetItemsRequestCompletion = ((items: [CItem]?, error: NSError?, prevPageUrl: String?, nextPageUrl: String?) -> ())?
CirrusGetItemRequestCompletion = ((item: CItem?, error: NSError?) -> ())?
CirrusDeleteRequestCompletion = ((success: Bool, error: NSError?) -> ())?
CirrusFavoriteItemRequestCompletion = ((favorite: Bool?, error: NSError?) -> ())?
CirrusUpdateItemRequestCompletion = CirrusGetItemRequestCompletion
CirrusPostItemRequestCompletion = CirrusGetItemRequestCompletion
CirrusEmailShareRequestCompletion = ((recipients: [String]?, error: NSError?) -> ())?
CirrusExpirationRequestCompletion = ((expiration: [String: AnyObject]?, error: NSError?) -> ())?
CirrusProgressBlock = ((progress: Double) -> ())?

License

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

Latest podspec

{
    "name": "Cirrus",
    "version": "0.1.0",
    "summary": "CloudApp API wrapper written in Swift.",
    "description": "CloudApp is more than just screenshots & quick recording. Share images, videos, music, documents, code snippets, markdown files directly from Photoshop, Sketch and dozens of other apps!",
    "homepage": "https://github.com/pJes2/Cirrus",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "pJes2": "[email protected]"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/pJes2/Cirrus.git",
        "tag": "0.1.0"
    },
    "source_files": "Source/*.{swift}",
    "requires_arc": true
}

Pin It on Pinterest

Share This