{"id":13906097,"url":"https://github.com/jindulys/GithubPilot","last_synced_at":"2025-07-18T03:33:12.528Z","repository":{"id":56912765,"uuid":"52173192","full_name":"jindulys/GithubPilot","owner":"jindulys","description":"Github API V3 Swifty Wrapper","archived":false,"fork":false,"pushed_at":"2016-10-08T21:15:50.000Z","size":376,"stargazers_count":55,"open_issues_count":1,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-31T16:25:36.019Z","etag":null,"topics":["api","github","swift"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jindulys.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-20T20:11:25.000Z","updated_at":"2024-08-15T04:57:12.000Z","dependencies_parsed_at":"2022-08-20T20:50:26.652Z","dependency_job_id":null,"html_url":"https://github.com/jindulys/GithubPilot","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jindulys%2FGithubPilot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jindulys%2FGithubPilot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jindulys%2FGithubPilot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jindulys%2FGithubPilot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jindulys","download_url":"https://codeload.github.com/jindulys/GithubPilot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226344517,"owners_count":17610152,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","github","swift"],"created_at":"2024-08-06T23:01:29.318Z","updated_at":"2024-11-25T14:30:52.750Z","avatar_url":"https://github.com/jindulys.png","language":"Swift","readme":"# GithubPilot - Github API V3 Swifty Wrapper\n[![Build Status](https://travis-ci.org/jindulys/GithubPilot.svg)](https://travis-ci.org/jindulys/GithubPilot)\n\nThis is a Swift Github API Wrapper, it could make your life a little easier if you want to make an App with Github's wonderful data.\n\n# Installation\n\n## CocoaPods\n\nAdd a `Podfile` to your project, then edit it by adding:\n\n    use_frameworks!\n    pod 'GithubPilot', '~\u003e1.0.3'\n\nthen, run the following command:\n\n    $ pod install\n\nFrom now on you should use `{Project}.xcworkspace` to open your project\n\n# Before You start\n\n## Setup Your developer applications\n\nGo to your Github homepage, tap your avatar -\u003e Setting, on your left choose **Applications** -\u003e **Developer applications**, then you should tap **register a new OAuth application** on your top right side.\n\nRemember you should use a custom **Authorization callback URL**, which will be used later, eg. FunnyGithubTest://random\nAfter registration, you could get your **Client ID** and **Client Secret**.\n\n## Setup Your Project\n\nTo allow your user to be re-directed back to your app after OAuth dance, you'll need to associate a custom URL scheme with your app.\n\nOpen your Xcode then open **Info.plist** of your project. copy and paste following code to your Info.plist source code.\n\n      \u003ckey\u003eCFBundleURLTypes\u003c/key\u003e\n      \u003carray\u003e\n          \u003cdict\u003e\n              \u003ckey\u003eCFBundleURLSchemes\u003c/key\u003e\n              \u003carray\u003e\n                  \u003cstring\u003eyour.custom.scheme(eg. FunnyGithubTest)\u003c/string\u003e\n              \u003c/array\u003e\n          \u003cdict\u003e\n      \u003carray\u003e\n\n# Usage\n\n## Authentication\nFirst, add `import GithubPilot` at the top of your **AppDelegate**. You could then add `application(_: didFinishLaunchingWithOptions:)` with following to authenticate your client. You also should take care of `scope` parameter that your client will use, refer to [Github Scope](https://developer.github.com/v3/oauth/#scopes)\n\n    Github.setupClientID(\"YourClientID\", clientSecret: \"YourClientSecret\", scope: [\"user\", \"repo\"], redirectURI: \"YourCustomCallBackURL\")\n    Github.authenticate()\n\nSecond, add following code to your **AppDelegate** to get Github _**access token**_\n\n    func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -\u003e Bool \n    {\n        Github.requestAccessToken(url)\n        return true\n    }\n\n## Used in Code\n\n### Users\n\n#### Get the authenticated user\n\n    if let client = Github.authorizedClient {\n            client.users.getAuthenticatedUser().response({ user, requestError in\n                if let me = user {\n                    print(me.description)\n                } else {\n                    print(requestError?.description)\n                }\n            })\n    }\n#### Get a user with username\n\n    if let client = Github.authorizedClient {\n            client.users.getUser(username: \"onevcat\").response({ (githubUser, error) -\u003e Void in\n                if let user = githubUser {\n                    print(user.description)\n                } else {\n                    print(error?.description)\n                }\n            })\n    }\n\n#### Get a page of users from `since` id\n\n    if let client = Github.authorizedClient {\n            client.users.getAllUsers(\"1209\").response({ (httpResponse, users, requestError) -\u003e Void in\n                if let response = httpResponse {\n                    // next `since` id\n                    print(\"Since   :\\(response)\")\n                }\n                if let result = users {\n                    for user in result {\n                        print(user.description)\n                    }\n                } else {\n                    print(requestError?.description)\n                }\n            })\n    }\n    \n### Repositories\n\n#### Get repositories of authenticated user\n\n    if let client = Github.authorizedClient {\n            client.repos.getAuthenticatedUserRepos().response({ (result, error) -\u003e Void in\n                if let repos = result {\n                    print(repos.count)\n                    for i in repos {\n                        print(i.name)\n                        print(i.stargazersCount)\n                    }\n                }\n                if let requestError = error {\n                    print(requestError.description)\n                }\n            })\n    }\n    \n#### Get a repo by repo name and repo owner name\n\n    if let client = Github.authorizedClient {\n            client.repos.getRepo(\"Yep\", owner: \"CatchChat\").response({ (result, error) -\u003e Void in\n                if let repo = result {\n                    print(repo.name)\n                }\n                if let requestError = error {\n                    print(requestError.description)\n                }\n            })\n    }\n\n#### Get repos belong to a user\n\n    if let client = Github.authorizedClient {\n        client.repos.getRepoFrom(owner: \"onevcat\").response({ (nextPage, result, error) -\u003e Void in\n            if let page = nextPage {\n                print(\"Next Page is \\(page)\")\n            }\n            if let repos = result {\n                print(repos.count)\n                for r in repos {\n                    print(r.name)\n                    print(r.stargazersCount)\n                }\n            }\n            if let requestError = error {\n                print(requestError.description)\n            }\n        })\n    }\n    \n### Events\n\n#### Get received events for a user\n\n    if let client = Github.authorizedClient {\n        client.events.getReceivedEventsForUser(\"someUser\", page: \"1\").response({ (nextpage, results, error) -\u003e Void in\n            if let events = results {\n                // New events\n            }\n        })\n    }\n\n# Example \n\nYou could refer to one of my project [GitPocket](https://github.com/jindulys/GitPocket) as an example.\n\n# Credits\n\n[SwiftyDropbox](https://github.com/dropbox/SwiftyDropbox)\n\n# Future Work\n\nThere all tons of other API I haven't implementated, like **Search**. I will continuously make this repo better. Welcome to pull request and open issues.\n","funding_links":[],"categories":["HarmonyOS"],"sub_categories":["Windows Manager"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjindulys%2FGithubPilot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjindulys%2FGithubPilot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjindulys%2FGithubPilot/lists"}