YutoMizutani / BitriseAPI-Swift

A Swift framework for connecting to Bitrise's API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bitrise API for Swift

A framework for connecting to the Bitrise API, which allows you to access your accounts Apps, Builds, and Artifacts.

This framework is not developed by or in any way associated with Bitrise ltd (bitrise.io)

Swift Version Carthage compatible

Features

  • Get your apps
  • Get builds for your apps
  • Get artifacts for your builds
  • Abort builds
  • Full pagination support for results
  • Supports query filters for the builds endpoint
  • Support for iOS, macOS and tvOS (Latter two may need testing)

You can track the progress of Bitrise's API here

Requirements

  • iOS 9.0+
  • Swift 4 +

Installation

Carthage

Create a Cartfile that lists the framework and run carthage update. Follow the instructions to add $(SRCROOT)/Carthage/Build/iOS/BitriseAPI.framework to an iOS project.

github "joeltrew/BitriseAPI-Swift" ~> 1.0

Manually

Download and drop BitriseAPI.xcodeproject in your project.

CocoaPods

Not at the moment, open to a PR

Usage example

        // Create a BitriseService object using your user token
        service = BitriseService(userToken: "your_api_token_here")
        
        // Call methods on the object
        // Getting an app by a specific slug
        service?.getAppBySlug("The_slug/id_of_your_app", completion: { (appResult) in
            if case let .success(apps) = appResult {
                print("App if request was a success: ", app)
            }
        })
        // Listed content is returned wrapped in a `PagedData` wrapper which includes pagination details
        service?.getApps(completion: { (pagedAppsResult) in
            
            switch pagedAppsResult {
            case .success(let pagedApps):
    
                print("Pagination metadata: ", pagedApps.pagination)
                print("Array fo apps: ", pagedApps.data)
                
            case .failure(let error):
                print("Handle the error in some way")
            }
        })
        // You can supply a pagination object for endpoints that support it
        let pagination = Pagination(pageItemLimit: 10, next: "29e37a4844dda34b")
        
        // The get builds enpoint supports providing a query object, which allows you to filter results
        // For example:  only retuning successful builds
        var buildFilterQuery = BuildFilterQuery()
        buildFilterQuery.status = .finished(.success)
        
        service?.getBuildsForApp(app, pagination: pagination, filterQuery: buildFilterQuery, completion: { (buildsResult) in
            if case let .success(builds) = buildsResult {
                print("Builds: ", builds.data)
            }
        })

About

A Swift framework for connecting to Bitrise's API

License:MIT License


Languages

Language:Swift 98.9%Language:Objective-C 1.1%