CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

VisualSwift 0.1.4

VisualSwift 0.1.4

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Nov 2016
SwiftSwift Version 2.3
SPMSupports SPM

Maintained by Kalle Kabell.



 
Depends on:
Alamofire~> 3.0
IDZSwiftCommonCrypto~> 0.6.8
 

Swift library for interfacing with the TwentyThree API.

Usage

After installation, import VisualSwift and init an API object with the domain and protocol of you TwentyThree account:

import VisualSwift

let visualAPI = VisualSwift(domain: "video.twentythree.net", scheme: "https")

If you need authorized access and have obtained the required API credentials, include these as a third argument when initializing the API object:

let credentials = [
    "consumer_key": "<consumer key>",
    "consumer_secret": "<consumer secret>",
    "access_token": "<access token>",
    "access_token_secret": "<access token secret>"
]
let visualAPI = VisualSwift(domain: "video.twentythree.net", scheme: "https", credentials: credentials)

Make requests

Now you're ready to start making requests against the API by calling the request() method of your API object. Read the API documentation on https://www.twentythree.net/api to get a list of available endpoints.

// Simple request
visualAPI.request("/api/photo/list") {
    result in
    if result.isSuccess {
        print(result.value)
    }
}

// Request with parameters
let parameters = [
    "album_id": "123456"
]
visualAPI.request("/api/photo/list", parameters: parameters) {...}

// Specify request method
let method = "GET"
visualAPI.request("/api/photo/list", parameters: parameters, method: method) {...}

// Specify cache usage
let useCache = true
visualAPI.request("/api/photo/list", parameters: parameters, method: method, useCache: useCache) {...}

Upload videos

let parameters = [
    "title": "My new video"
]
let fileURL: NSURL = <NSURL object>
visualAPI.uploadFile("/api/photo/upload", parameters: parameters, fileURL: fileURL, progressCallback: {
    progress in
    dispatch_async(dispatch_get_main_queue(), {
        print(progress)
    })
}) {
    result in
    if result.isSuccess {
        print(result.value)
    }
}

Installation

Manual

Copy VisualSwift.swift and VisualSwiftUtils.swift from /Pod/Classes/ into your Xcode project.

Author

Kalle Kabell, [email protected]

License

VisualSwift is available under the MIT license. See the LICENSE file for more info.