BynderSDK 1.0.1

BynderSDK 1.0.1

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Oct 2017
SwiftSwift Version 4.0
SPMSupports SPM

Maintained by Jesse Ros.


Downloads

Total1
Week0
Month0

Installs

Apps1
powered by Segment

GitHub

Stars0
Watchers30
Forks0
Issues0
Contributors1
Pull Requests0

Code

Files82
LOCLines of Code 4,372


BynderSDK 1.0.1

Bynder Swift SDK

The main goal of this SDK is to speed up the integration of Bynder customers who use Objective-C and Swift; making it easier to connect to the Bynder API (http://docs.bynder.apiary.io/) and executing requests on it.

Requirements

  • iOS 8.0+ / macOS 10.10+

BynderClient

public var sessionManager: BynderSessionManager { get }

public required init(configuration: Configuration)

public func authoriseCalls(accessToken: String, accessSecret: String)

public func removeUserSession()

public func userSessionAcquired() -> Bool

public var userController: UserController { get }

public var brandController: BrandController { get }

public var categoryController: CategoryController { get }

public var collectionController: CollectionController { get }

public var assetBankController: AssetBankController { get }

public var metapropertyController: MetapropertyController { get }

public var tagController: TagController { get }

public var uploadController: UploadController { get }

open func uploadController(maxConcurrentOperationCount: Int, qualityOfService: QualityOfService) -> UploadController

public var downloadController: DownloadController { get }

UserController

open func retrieveRequestToken(_ completed: @escaping ((_ oauthToken: String, _ oauthTokenSecret: String) -> Void), failed: ControllerFailedClosure?) -> DataRequest?

open func retrieveAuthorizeURL(requestToken: String, callBackURL: String?) throws -> URLRequest?

open func retrieveAccessToken(_ requestToken: String, requestSecret: String, completed: ((_ accessToken: String, _ accessSecret: String) -> Void)?, failed: ControllerFailedClosure?) -> DataRequest?

open func retrieveCurrentUser(_ completed: ((UserProfile) -> Void)?, failed: ControllerFailedClosure?) -> DataRequest?

open func retrieveAccount(_ completed: ((Account?) -> Void)?, failed: ControllerFailedClosure?) -> DataRequest?

open func retrieveSecurityProfiles(_ completed: (([SecurityProfile]) -> Void)?, failed: ControllerFailedClosure?) -> DataRequest?

open func retrieveCurrentSecurityProfile(user: UserProfile!, completed: ((SecurityProfile) -> Void)?, failed: ControllerFailedClosure?) -> DataRequest?

open func retrieveDomainUsers(includeInActive: Bool = default, completed: ((_ users: [UserProfile]) -> Void)?, failed: ControllerFailedClosure?) -> DataRequest?

open func modifyLoginTermsAccepted(user: UserProfile, completed: @escaping (() -> Void), failed: ControllerFailedClosure?) -> DataRequest?

AssetBankController

open func generalAssetResponseClosure(_ completed: @escaping (([Asset]) -> Void), failed: ControllerFailedClosure?) -> ((DataResponse<Any>) -> Void)

open func retrieveAssetCount(settings: AssetFilterQuery, completed: @escaping ((AssetCount) -> Void), failed: ControllerFailedClosure?) -> DataRequest

open func retrieveAssetCount(params: [String : Any], completed: @escaping ((AssetCount) -> Void), failed: ControllerFailedClosure?) -> DataRequest

open func retrieveAssets(settings: AssetFilterQuery, completed: @escaping (([Asset]) -> Void), failed: ControllerFailedClosure?) -> DataRequest

open func retrieveAssets(params: [String : Any]?, completed: @escaping (([Asset]) -> Void), failed: ControllerFailedClosure?) -> DataRequest

open func retrieveAssetInfo(id: String, versions: Bool = default, completed: @escaping (([Asset]) -> Void), failed: ControllerFailedClosure?) -> DataRequest?

open func retrieveAssets(ids: [String], completed: @escaping (([Asset]) -> Void), failed: ControllerFailedClosure?) -> DataRequest?

open func retrieveAssetDownloadURL(assetId: String, type: DownloadType, completed: @escaping ((DownloadInfo) -> Void), failed: ControllerFailedClosure?) -> DataRequest?

open func modifyAsset(assetId: String, updateInfo: AssetUpdateQuery, completed: @escaping (() -> Void), failed: ControllerFailedClosure?) -> DataRequest?

open func deleteAsset(assetId: String, completed: @escaping (() -> Void), failed: ControllerFailedClosure?) -> DataRequest?

CollectionController

open func retrieveCollectionCount(settings: CollectionFilterQuery, completed: @escaping (([Collection], Int) -> Void), failed: ControllerFailedClosure?) -> DataRequest

open func retrieveCollectionCount(params: [String : Any], completed: @escaping (([Collection], Int) -> Void), failed: ControllerFailedClosure?) -> DataRequest

open func retrieveCollections(settings: CollectionFilterQuery, completed: @escaping (([Collection]) -> Void), failed: ControllerFailedClosure?) -> DataRequest

open func retrieveCollections(params: [String : Any]?, completed: @escaping (([Collection]) -> Void), failed: ControllerFailedClosure?) -> DataRequest

open func createCollection(name: String, description: String?, completed: ((Collection) -> Void)?, failed: ControllerFailedClosure?) -> DataRequest?

open func addAssets(assetIds: [String], toCollectionId collectionId: String, completed: @escaping (() -> Void), failed: ControllerFailedClosure?)

open func shareCollection(_ collection: Collection, shareInfo: ShareCollectionQuery, completed: @escaping (() -> Void), failed: ControllerFailedClosure?) -> DataRequest?

open func removeAssets(assets: [Asset], fromCollection collection: Collection, completed: (() -> Void)?, failed: ControllerFailedClosure?) -> DataRequest?

open func deleteCollection(_ collection: Collection, completed: ((Collection) -> Void)?, failed: ((Collection, Error) -> Void)?) -> DataRequest?

open func modifyCollection(_ collection: Collection, completed: @escaping (() -> Void), failed: ControllerFailedClosure?) -> DataRequest?

open func modifyCollection(id: String, name: String?, description: String?, completed: @escaping (() -> Void), failed: ControllerFailedClosure?) -> DataRequest?

open func modifyCollection(id: String, params: [String : Any], completed: @escaping (() -> Void), failed: ControllerFailedClosure?) -> DataRequest?

BrandController

open func retrieveBrands(_ completed: @escaping (([Brand]) -> Void), failed: ControllerFailedClosure?) -> DataRequest?

CategoryController

open func retrieveCategories(_ completed: @escaping ((_ users: [Category]) -> Void), failed: ControllerFailedClosure?) -> DataRequest?

MetapropertyController

open func retrieveMetaproperties(_ completed: @escaping (([Metaproperty]) -> Void), failed: ControllerFailedClosure?) -> DataRequest?

TagController

open func retrieveTags(settings: TagFilterQuery, completed: @escaping (([Tag]) -> Void), failed: ControllerFailedClosure?) -> DataRequest

open func retrieveTags(params: [String : Any]?, completed: @escaping (([Tag]) -> Void), failed: ControllerFailedClosure?) -> DataRequest

UploadController

internal let uploadOpQueue: OperationQueue

public required init(sessionManager: BynderSessionManager)

public init(sessionManager: BynderSessionManager, maxConcurrentOperationCount: Int, qualityOfService: QualityOfService)

open func cancelAllOperations()

open func setMaxConcurrentOperationCount(_ max: Int)

open func setQualityOfService(_ service: QualityOfService)

open func generalUploadCompletionClosure(completed: UploadSaveCompletionClosure?) -> UploadSaveCompletionClosure

open func uploadNewAsset(securityProfile: SecurityProfile, filePath: String, uploadInfo: UploadInfoQuery, progress: UploadFileProgressClosure?, completed: UploadSaveCompletionClosure?) -> UploadAssetOperation?

open func uploadAssetVersion(securityProfile: SecurityProfile, filePath: String, assetId: String, uploadInfo: UploadInfoQuery, progress: UploadFileProgressClosure?, completed: UploadSaveCompletionClosure?) -> UploadAssetVersionOperation?

open func uploadAdditionalAsset(securityProfile: SecurityProfile, filePath: String, assetId: String, uploadInfo: UploadInfoQuery, progress: UploadFileProgressClosure?, completed: UploadSaveCompletionClosure?) -> UploadAssetAdditionalOperation?

internal func startNewOperation(_ newOp: UploadSaveOperation)

internal func isValidFilePath(_ path: String) -> Bool

open func updateNumberOfUploads()

open func isUploading() -> Bool

DownloadController

internal var locationHTTPOperationManager: Alamofire.SessionManager?

internal var downloadHTTPOperationManager: Alamofire.SessionManager?

public let downloadBatchOperationQueue: OperationQueue

public required init(sessionManager: BynderSessionManager)

public init(sessionManager: BynderSessionManager, maxConcurrentLocationRequests: Int, maxConcurrentDownloadRequests: Int)

public func createHTTPOperationManagers(maxConcurrentLocationRequests: Int, maxConcurrentDownloadRequests: Int)

open func download(tasks: [DownloadTask], disclaimer: @escaping DisclaimerClosure, progress: DownloadProgressClosure?, completed: @escaping DownloadCompletionClosure) -> DownloadBatchOperation

Installation

Manually

If you prefer not to use any of the aforementioned dependency managers, you can integrate BynderSDK into your project manually.

Usage

Retrieve assets

import BynderSDK

// Create configuration instance
var configuration: Configuration? = nil

do {
    configuration = try Configuration(consumerToken: "_CONSUMER_KEY_",
      consumerSecret: "_CONSUMER_SECRET_",
      accessToken: "_ACCESS_TOKEN_",
      accessSecret: "_ACCESS_SECRET_",
      baseURL: URL(string: "example.getbynder.com")!)
} catch {
    loggingPrint("ERROR: %@", error)
}

// Create client using your configuration
let client = BynderClient(configuration: configuration)

// Retrieve assets
let query = AssetFilterQuery()
query.limit = 5
        
client.assetBankController.retrieveAssets(settings: query, completed: { (assets) in
	for asset in assets {
		loggingPrint(asset.name)
	}
}) { (error) -> (Void) in
	loggingPrint("Error: \(error)")
}