ChuteSDK-iOS 1.0.0

ChuteSDK-iOS 1.0.0

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release May 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Oliver Dimitrov.


Downloads

Total2
Week0
Month0

Installs

Apps1
Test Targets1
powered by Segment

GitHub

Stars0
Watchers6
Forks0
Issues0
Contributors2
Pull Requests0

Code

Files33
LOCLines of Code 1,412


 
Depends on:
Alamofire~> 4.4
AlamofireObjectMapper~> 4.1
SwiftKeychainWrapper~> 3.0
 

  • By
  • Oliver Dimitrov

Chute-SDK-iOS

SDK that allows you to manage your albums and assets

Requirements

  • iOS 9.0+
  • Xcode 8.2+
  • Swift 3.0+

Installation

Dependencies

This SDK has dependencies that it relies on. The list consists of:

  • pod ‘Alamofire’, ‘~> 4.4’
  • pod ‘AlamofireObjectMapper’, ‘~> 4.1’
  • pod ‘SwiftKeychainWrapper’, ‘~> 3.0’

Usage

Just import the SDK on top of your class

import ChuteSDK_iOS

Configuration

If you’re an customer, your application has already been created. To request your credentials, please contact our Support team. First in order the SDK to work, you need to make a copy of GCConfiguration-Sample.plist, located in Configuration directory, and rename it GCConfiguration.plist. Then you need to add it to you project manually. Then in chute-sdk dictionary you need to insert app_id and app_secret provided by our Support team.

Client Authentication

You need a logged in user in order to use the SDK. For that you can use the method of the GCLoginService class:

GCLoginService.login(email: "your_chute_email", password: "your_chute_password",  completion: { (token) in }, failure: { (error) in })

The authentication token is automatically set in your keychain and kept in memory in the shared instance of ClientManager class.

Logout

Simply call method of ClientManager class:

ClientManager.shared.clearAuthorizationToken

Services

The following section contains all available actions that can be performed.

User

The GCUserService class brings methods like:

GCUserService.getMyInfo(completion: { (user) in }, failure: { (error) in })
GCUserService.getUser(id: user_id, completion: { (user) in }, failure: { (error) in })
GCUserService.createUser(email: "user_email", name: "full name", username: "username", title: "proffession", company: "user_company", password: "user_pass", retypePassword: "retype_pass", completion: { (user) in }, failure: { (error) in })
GCUserService.updateMyInfo(email: "new_email", name: "full name", username: "username", title: "proffession", company: "company", completion: { (user) in }, failure: { (error) in })
GCUserService.updateUser(id: user_id, email: "new_email", name: "full_name", username: "username", title: "proffession", company: "company", completion: { (user) in }, failure: { (error) in })

Methods also have some optional parameters, so you can omit them.

Album

The GCAlbumService class brings album manipulation actions:

GCAlbumService.getAlbum(id: album_id, cover: true, completion: { (status, album) in }, failure: { (error) in })
GCAlbumService.getAlbums(cover: true, page: 1, perPage: 100, completion: { (status, albums, pagination) in }, failure: { (error) in })
GCAlbumService.createAlbum(name: "", parentAlbumId: parent_album_id, coverAssetID: cover_asset_id, completion: { (status, album) in }, failure: { (error) in })
GCAlbumService.updateAlbum(id: album_id, name: "updated_album_name", parentAlbumId: parent_id coverAssetID: cover_asset_id, completion: { (status, album) in }, failure: { (error) in })
GCAlbumService.deleteAlbum(id: album_id, completion: { (status) in }, failure: { (error) in })
GCAlbumService.listAllAlbumsForAlbum(id: album_Id, completion: { (sattus, albums) in }, failure: { (error) in })

Methods also have some optional parameters, so you can omit them. (e.g page or perPage. If omitted defaults one are used: page = 1 and perPage = 100)

Asset

The GCAssetService class brings asset manipulation actions:

GCAssetService.getAssets(albumId: album_id, type: .image, username: "specific_user", tags: [list_of_tags], service: .uploaded, page: 1, perPage: 100 completion: { (status, assets, pagination) in }, failure: { (error) in })
GCAssetService.getAsset(id: asset_id, albumId: album_id, completion: { (status, asset) in }, failure: { (error) in })
GCAssetService.moveAsset(id: asset_id, fromAlbum: source_album_id, toAlbum: destination_album_id, completion: { (status, asset) in }, failure: { (error) in })
GCAssetService.copyAsset(id: asset_id, fromAlbum: source_album_id, toAlbum: destination_album_id, completion: { (status, asset) in }, failure: { (error) in })
GCAssetService.removeAsset(id: asset_id, albumId: album_id, completion: { (status) in }, failure: { (error) in })
GCAssetService.importAssets(urls: [list_of_urls], albumId: album_id, completion: { (status, assets, pagination) in }, failure: { (error) in })

Methods also have optional parameters, so you can omit them (e.g. in getAssets, parameter type. If you omit that one, you will get all types returned).

Tags

The GCTagService class brings asset tags manipulation actions:

GCTagService.getTags(id: asset_id, albumId: album_id, completion: { (status, tags) in }, failure: { (error) in })
GCTagService.add(tags: [tags_to_add], assetId: asset_id, albumId: album_id, completion: { (status, tags) in }, failure: { (error) in })
GCTagService.replace(tags: [tags_to_replace], assetId: asset_id, albumId: album_id, completion: { (status, tags) in }, failure: { (error) in })
GCTagService.delete(tags: [tags_to_delete], assetId: asset_id, albumId: album_id, completion: { (status, tags) in }, failure: { (error) in })

Vote

The GCVoteService class brings asset votes manipulation actions:

GCVoteService.getVoteCount(assetId: asset_id, albumId: album_id, completion: { (status, voteCount) in }, failure: { (error) in })
GCVoteService.voteAsset(id: asset_id, albumId: album_id, completion: { (status, vote) in }, failure: { (error) in })
GCVoteService.unVoteAsset(id: asset_id, albumId: album_id, completion: { (status) in }, failure: { (error) in })

Heart

The GCHeartService class brings asset hearts manipulation actions

GCHeartService.getHeartCount(assetId: asset_id, albumId: album_id, completion: { (status, heartCount) in }, failure: { (error) in })
GCHeartService.heartAsset(id: asset_id, albumId: album_id, completion: { (status, heart) in }, failure: { (error) in })
GCHeartService.unheartAsset(id: asset_id, albumId: album_id, completion: { (status) in }, failure: { (error) in })

Licence

ChuteSDK is released under the MIT licence. See LICENSE for details.