https://github.com/toricls/gitlabkit
API client library for GitLab API, written in Swift
https://github.com/toricls/gitlabkit
gitlab-api swift
Last synced: 9 months ago
JSON representation
API client library for GitLab API, written in Swift
- Host: GitHub
- URL: https://github.com/toricls/gitlabkit
- Owner: toricls
- License: mit
- Created: 2015-01-23T18:50:54.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2017-06-18T14:53:52.000Z (over 8 years ago)
- Last Synced: 2025-03-24T05:35:13.157Z (10 months ago)
- Topics: gitlab-api, swift
- Language: Swift
- Homepage:
- Size: 106 KB
- Stars: 57
- Watchers: 5
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
GitLabKit
====
GitLabKit is an API client library for [GitLab API](https://gitlab.com/help/api/README.md), written in Swift.
Based on [this interesting idea](http://developer.hatenastaff.com/entry/smart-api-client-with-swift-using-enum-and-generics).
Notice: Public interfaces may be changed until the project version reaches into v1.0.
## Description
Followings currently implemented.
### GET
Almost all without Labels, Notes, Deploy Keys, System Hooks, Groups.
Testing is not enough.
### POST
Nothing yet.
### DELETE
Nothing yet.
## Requirement
GitLabKit is written as a Cocoa Framework (for OS X) for now.
Tested on OS X 10.12.5 with Xcode 8.3.3 (8E3004b), self hosted GitLab CE 7.5.3 b656b85.
- [Alamofire](https://github.com/Alamofire/Alamofire)
- [Mantle](https://github.com/Mantle/Mantle)
GitLabKit is using libraries listed above.
All dependencies are resolved by [CocoaPods](http://cocoapods.org/) with its version 1.2.0 or newer.
## Usage
```swift
// Init api client
let client: GitLabApiClient = GitLabApiClient(host: "https://git.example.com", privateToken: "YOUR-PRIVATE-TOKEN")
// Get users
let params = UserQueryParamBuilder()
client.get(params, handler: { (response: GitLabResponse?, error: NSError?) -> Void in
println(response!.result!.count)
})
// Get user by Id
let params = UserQueryParamBuilder().id(1)
client.get(params, handler: { (response: GitLabResponse?, error: NSError?) -> Void in
let user: User = response!.result![0]
println(user.name!)
})
```
see [test sources](https://github.com/toricls/GitLabKit/tree/master/GitLabKitTests) to get more usage.
## TODO
- Implement more apis
- Decide on how to deal with 404 responses. I'm just treating them as normal responses and returning an empty array for [now](https://github.com/toricls/GitLabKit/blob/master/GitLabKit/GitLabApiClient.swift#L79).
- More effective and efficient testing with stub or something like that
## Contribution
1. Fork ([https://github.com/toricls/GitLabKit/fork](https://github.com/toricls/GitLabKit/fork))
2. Create a feature branch
3. Commit your changes
4. Rebase your local changes against the master branch
5. Create new Pull Request
## Licence
[MIT](https://github.com/toricls/GitLabKit/blob/master/LICENCE)
## Author
[toricls](https://github.com/toricls)