{"id":1892,"url":"https://github.com/sachinkesiraju/UberKit","last_synced_at":"2025-08-02T05:33:04.595Z","repository":{"id":19922168,"uuid":"23188403","full_name":"sachinkesiraju/UberKit","owner":"sachinkesiraju","description":"An easy-to-use Objective-C wrapper for the Uber API (no longer supported)","archived":false,"fork":false,"pushed_at":"2016-02-13T05:02:49.000Z","size":1010,"stargazers_count":94,"open_issues_count":13,"forks_count":22,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-11-16T11:47:15.694Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Objective-C","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/sachinkesiraju.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-21T13:38:15.000Z","updated_at":"2023-12-18T21:10:14.000Z","dependencies_parsed_at":"2022-07-08T01:00:36.762Z","dependency_job_id":null,"html_url":"https://github.com/sachinkesiraju/UberKit","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sachinkesiraju%2FUberKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sachinkesiraju%2FUberKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sachinkesiraju%2FUberKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sachinkesiraju%2FUberKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sachinkesiraju","download_url":"https://codeload.github.com/sachinkesiraju/UberKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228443692,"owners_count":17920769,"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":[],"created_at":"2024-01-05T20:15:58.323Z","updated_at":"2024-12-06T09:30:34.300Z","avatar_url":"https://github.com/sachinkesiraju.png","language":"Objective-C","funding_links":[],"categories":["SDK","Unofficial","非官方"],"sub_categories":["Unofficial","Other free courses"],"readme":"UberKit\n=======\n\nUberKit is a simple Objective-C wrapper for the new \u003ca href = http://developer.uber.com\u003e Uber API \u003c/a\u003e.\n\n\u003ch1\u003e Installation \u003c/h1\u003e\n\u003ch3\u003e Cocoapods \u003c/h3\u003e\nUberKit is available through \u003ca href = \"cocoapods.org\"\u003e Cocoapods\u003c/a\u003e. To install it, simply add the following to your Podfile.\n```\npod 'UberKit'\n```\n\u003ch3\u003e Alternative \u003c/h3\u003e\nAlternatively, you can always just drag and drop the folder 'UberKit' into your project and ``#import \"UberKit.h\"`` and you're good to go.\n\n\u003ch2\u003e Basic API Implementation \u003c/h2\u003e\n\nThis is to implement the Uber API without having users sign in to their Uber account.\n\nTo implement UberKit, first initialize it with your server token.\n\nYou can get your server token from \u003ca href = http://developer.uber.com\u003e Uber Developers\u003c/a\u003e.\n\n```objc\n  UberKit *uberKit = [[UberKit alloc] initWithServerToken:@\"YOUR_SERVER_TOKEN\"];\n```\nAlternatively, you can set your server token to a shared instance of UberKit as follows:\n```objc\n    [[UberKit sharedInstance] setServerToken:@\"YOUR_SERVER_TOKEN\"];\n```\n\nTo get all products available from a particular location\n\n```objc\n [uberKit getProductsForLocation:location withCompletionHandler:^(NSArray *products, NSURLResponse *response, NSError *error)\n     {\n         if(!error)\n         {\n             //Got the array of available products for the location.\n         }\n         else\n         {\n             NSLog(@\"Error %@\", error);\n         }\n     }];\n```\n\nTo get the time for arrival of a product to a particular location\n```objc\n[uberKit getTimeForProductArrivalWithLocation:location withCompletionHandler:^(NSArray *times, NSURLResponse *response, NSError *error)\n     {\n         if(!error)\n         {\n             //Got the array of available products and the time they'll take to reach the mentioned location.\n         }\n         else\n         {\n             NSLog(@\"Error %@\", error);\n         }\n     }];\n```\n\nTo get the price for a trip between two locations\n```objc\n[uberKit getPriceForTripWithStartLocation:location endLocation:endLocation  withCompletionHandler:^(NSArray *prices, NSURLResponse *response, NSError *error)\n     {\n         if(!error)\n         {\n             //Got the array of available products and the price of a trip from the start location to the end location.\n         }\n         else\n         {\n             NSLog(@\"Error %@\", error);\n         }\n     }];\n```\n\nTo get the available promotion for a trip between two locations\n```objc\n[uberKit getPromotionForLocation:location endLocation:endLocation withCompletionHandler:^(UberPromotion *promotion, NSURLResponse *response,  NSError *error)\n     {\n        if(!error)\n        {\n            //Got the promotion as an UberPromotion\n        }\n        else\n        {\n            NSLog(@\"Error %@\", error);\n        }\n     }];\n```\n\n\u003ch2\u003e OAuth implementation \u003c/h2\u003e\n\n\u003ch3\u003e Introduction \u003c/h3\u003e\n\nThis is to implement the Uber API with endpoints that require user authorization such as user history and profile.\nThe authorization process is implemented by:\n\n1. Allowing the users to sign in to their Uber accounts.\n\n2. Obtaining an access token on user approval of app's permissions.\n\n3. Using this access token to make calls to the Uber API.\n\nUberKit automatically redirects to Safari where users enter their Uber login credentials to allow access to their profiles. \n\n\u003cimg src = \"https://github.com/sachinkesiraju/UberKit/blob/master/Login%20screenshot.png\" width = \"320px\"\u003e\n\n\u003ch3\u003e Implementation \u003c/h3\u003e\n\nBefore you can get started using UberKit with login parameters, you must first create an Uber application at \u003ca href = http://developer.uber.com\u003e Uber Developers \u003c/a\u003e and fill in all necessary fields.\n\n\u003cb\u003e [Note: To gain access to the user's profile and history, ensure that you have these permissions enabled in your app's dashboard] \u003c/b\u003e\n\nTo implement UberKit with authorization from the user first initialize it with your client id, client secret, redirect URI and application name from the application you made on Uber Developer.\n\n```objc\nUberKit *uberKit = [[UberKit alloc] initWithClientID:@\"YOUR_CLIENT_ID\" ClientSecret:@\"YOUR_CLIENT_SECRET\" RedirectURL:@\"YOUR_REDIRECT_URL\" ApplicationName:@\"YOUR_APPLICATION_NAME\"]; //Set these fields from your app on Uber Developers.\nuberKit.delegate = self; //Set the delegate (only for login)\n```\n\nAdd the UberKit delegate to the @interface of your view controller to detect when an Uber access token becomes available for use after successful authorization. Then, you must add the following methods to your view controller:\n```objc\n- (void) uberKit: (UberKit *) uberKit didReceiveAccessToken: (NSString *) accessToken\n{\n    //Got the access token, can now make requests for user data\n}\n- (void) uberKit: (UberKit *) uberKit loginFailedWithError: (NSError *) error\n{\n    //An error occurred in the login process\n}\n```\nYou can also retrieve the access token when it is available by using `NSString *token = [[UberKit sharedInstance] getStoredAuthToken];`\n\nTo begin the login process, call the method 'startLogin' using `[uberKit startLogin];`\n\nOnce you've successfully retrieved an access token, you can then make the following calls to the Uber API :\n\nTo get all activity by the user\n```objc\n[uberKit getUserActivityWithCompletionHandler:^(NSArray *activities, NSURLResponse *response, NSError *error)\n         {\n             if(!error)\n             {\n                 //Got an array of the history of activities performed by the user\n             }\n             else\n             {\n                 NSLog(@\"Error %@\", error);\n             }\n         }];\n```\n\nTo get the profile of the user\n```objc\n[uberKit getUserProfileWithCompletionHandler:^(UberProfile *profile, NSURLResponse *response, NSError *error)\n         {\n             if(!error)\n             {\n                 //Got the user's profile as an UberProfile\n             }\n             else\n             {\n                 NSLog(@\"Error %@\", error);\n             }\n         }];\n```\n\nFor more help, check out the \u003ca href = https://github.com/sachinkesiraju/UberKit/tree/master/UberKitDemo\u003e Demo \u003c/a\u003e!\n\nFor any assistance, reach out to me on Twitter \u003ca href = https://twitter.com/sachinkesiraju\u003e @sachinkesiraju \u003c/a\u003e\n\n\u003ch2\u003e Featured In \u003c/h2\u003e\n\n- \u003ca href = http://blindsquare.com/\u003eBlindsquare \u003c/a\u003e\n\nLet me know where you use UberKit so I can add it here!\n\n\u003ch2\u003e Community \u003c/h2\u003e\n\nIf you feel that you can contribute to improving UberKit or add a new feature, feel free to raise an issue/submit a PR.\n\n\u003ch2\u003e License \u003c/h2\u003e\n\nUberKit is available under the MIT License. See the \u003ca href = https://github.com/sachinkesiraju/UberKit/blob/master/LICENSE\u003eLICENSE\u003c/a\u003e for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsachinkesiraju%2FUberKit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsachinkesiraju%2FUberKit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsachinkesiraju%2FUberKit/lists"}