TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Dec 2016 |
SPMSupports SPM | ✗ |
Maintained by George Kye.
https://dribbble.com/account/applications/new
pod 'DribbbleSwift', :git => "https://github.com/gkye/DribbbleSwift.git"
https://github.com/gkye/DribbbleSwift/tree/swift2
REQUIRED FOR ANY GET REQUEST TO WORK (AccessToken must be set before each GET request)
ConfigDS.setAccessToken("YOUR ACCESS TOKEN")
BucketDS.getBucket(bucketId: 377694){
bucket in
print(bucket.bucket?.name)
print(bucket.bucket?.user.username)
}
BucketDS.getShots(bucketId: 377694){
shots in
print(shots.shots?.count)
print(shots.shots?[0].title)
}
ProjectDS.getProject(projectId: 3){
project in
print(project.project?.name)
print(project.project?.user.username)
}
ProjectDS.getShots(projectId: 3){
shots in
print(shots.shots?.count)
print(shots.shots?[0].title)
}
Parameters
/**
List shots
- parameter perPage: Resources per page, maximum = 100
-parameter page: Current page of resource. Default = 1
- parameter list: Limit the results to a specific type with the following possible values: animated, attachments, debuts, playoffs, rebounds, teams teams
- parameter sort: The sort field with the following possible values: comments, recent, views. Default = .views
- parameter timeframe: A period of time to limit the results to with the following possible values: week, month, year, ever
- parameter date: Limit the timeframe to a specific date, week, month, or year. Must be in the format of YYYY-MM-DD.
- parameter completionHandler: return NSError, JSON and an array of shots.
*/
ShotsDS.getShots(perPage: 50, list: .animated, sort: .recent){
shotz in
print(shotz.shots?.count)
print(shotz.shots?[0].title)
}
ShotsDS.getAttachments(shotID: 2694049){
atts in
print(atts.0.json)
print(atts.attachments?[0].url)
}
ShotsDS.getBuckets(shotID: 2694049, perPage: 50){
bucks in
print(bucks.buckets?[0].description)
}
ShotsDS.getComments(shotID: 2694049, perPage: 50){
cmnts in
print(cmnts.comments?[0].body)
}
ShotsDS.getLikes(shotID: 2694049, perPage: 50){
lks in
print(lks.likes?[0].created_at)
print(lks.likes?[0].user.username)
}
ShotsDS.getProjects(shotID: 2698163, perPage: 50){
projs in
print(projs.projects?[0].name)
}
ShotsDS.getRebounds(shotID: 2691323, perPage: 50){
rbs in
print(rbs.rebounds?[0].title)
}
TeamDS.getTeamMembers("Dribbble"){
api in
print(api.members?[0].username)
}
TeamDS.getTeamShots("Dribbble", perPage: 10, page: 1){
api in
print(api.shots?[0].title)
}
UserDS.getUser("Ramotion"){
api in
print(api.user?.bio)
}
UserDS.getBuckets("SergeyValiukh"){
api in
print(api.buckets?[0].name)
}
UserDS.getFollowers("simplebits", page: 1){
api in
print(api.followers?[0].follower.username)
print(api.followers?[0].follower.name)
}
UserDS.getFollowing("simplebits", perPage: 20, page: 1){
api in
print(api.followees?[0].followee.username)
print(api.followees?[0].followee.bio)
}
returns true if following, else false.
UserDS.checkIfUserFollowingUser("dannpetty", targetUser: "SergeyValiukh"){
api in
print(api.isFollowing)
}
UserDS.getLikes("simplebits", perPage: 20, page: 1){
api in
print(api.likes?[0].shot.title)
print(api.likes?[0].shot.user.username)
}
UserDS.getProjects("simplebits", perPage: 10, page: 1){
api in
print(api.projects?[0].name)
}
UserDS.getShots("simplebits", perPage: 10, page: 3){
api in
print(api.shots?[0].title)
}
UserDS.getTeams("simplebits"){
api in
print(api.teams?[0].name)
print(api.teams?[0].members_count)
}
http://developer.dribbble.com/v1/oauth/ for more information about authentication process.
MUST SET CONFIG TOKEN BEFORE ANY AUTHENTICATED REQUEST CAN BE EXECUTED
ConfigDS.setOAuth2Token("OAUTH2 TOKEN RECEIVED")
UserDS.getAuthUser(){ user in }
UserDS.getAuthUserBuckets(perPage: 10, page: 1){bks in print(bks.0.json) }
UserDS.getAuthUserFollowers(perPage: 10, page: 1){ flwrs in print(flwrs.followers?.count)}
UserDS.getAuthUserFollowing(perPage: 10, page: 2){ fllwee in print(fllwee.followees?.count)}
UserDS.userFollowingShots(){ shots in print(shots.shots?[0].title) }
UserDS.checkIfAuthUserFollowingUser("Ramotion"){ status in print(status.isFollowing) }
UserDS.followUser("wearepanic"){ status in print(status.followed) }
UserDS.unfollowUser("Shopify"){ status in print(status.unfollowed) }
UserDS.getAuthLikes(perPage: 20, page: 1){ likedShots in print(likedShots.likes?[0].shot.title) }
UserDS.getAuthBuckets(){ api in print(api.buckets?[0].name) }
UserDS.getAuthProjects(perPage: 10, page: 1){ api in print(api.projects?[0].name) }
UserDS.getAuthShots(perPage: 10, page: 3){ api in print(api.shots?[0].title) }
Liking and Unliking shot requires the user to be authenticated with the write scope.
ShotsDS.likeShot(shotId: "2678120"){
api in
print(api.statusCode)
print(api.success)
}
ShotsDS.unlikeShot(shotId: "2678120"){
api in
print(api.statusCode)
print(api.unliked)
}
ShotsDS.checkIfShotLiked(shotId: "2687276"){
api in
print(api.statusCode)
print(api.liked)
}