{"id":20174316,"url":"https://github.com/samsymons/redditkit","last_synced_at":"2025-04-06T10:14:08.212Z","repository":{"id":11726138,"uuid":"14248891","full_name":"samsymons/RedditKit","owner":"samsymons","description":"An Objective-C wrapper for the reddit API","archived":false,"fork":false,"pushed_at":"2018-05-25T17:32:23.000Z","size":1062,"stargazers_count":295,"open_issues_count":13,"forks_count":41,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-30T09:08:28.429Z","etag":null,"topics":["reddit-api","unmaintained"],"latest_commit_sha":null,"homepage":"https://redditkit.com/","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/samsymons.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2013-11-09T01:25:37.000Z","updated_at":"2025-01-17T15:58:01.000Z","dependencies_parsed_at":"2022-09-06T05:10:46.286Z","dependency_job_id":null,"html_url":"https://github.com/samsymons/RedditKit","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samsymons%2FRedditKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samsymons%2FRedditKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samsymons%2FRedditKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samsymons%2FRedditKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samsymons","download_url":"https://codeload.github.com/samsymons/RedditKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247464226,"owners_count":20942970,"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":["reddit-api","unmaintained"],"created_at":"2024-11-14T01:42:15.859Z","updated_at":"2025-04-06T10:14:08.194Z","avatar_url":"https://github.com/samsymons.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RedditKit [![Build Status](https://travis-ci.org/samsymons/RedditKit.svg?branch=master)](https://travis-ci.org/samsymons/RedditKit)\n\nRedditKit is a [reddit API](http://www.reddit.com/dev/api) wrapper, written in Objective-C.\n\n## Documention\n\nDocumentation for RedditKit is [available on CocoaDocs](http://cocoadocs.org/docsets/RedditKit/1.3.0/).\n\n## Installation\n\n### CocoaPods\n\nAdd this to your Podfile:\n\n\tpod 'RedditKit', '~\u003e 1.3'\n\nThen run:\n\n\tpod install\n\n### Submodules\n\n**Adding RedditKit:**\n\n1. Add RedditKit as a git submodule of your project: `git submodule add https://github.com/samsymons/RedditKit.git`\n2. Fetch its dependencies with `git submodule update --init --recursive`\n\n**Adding AFNetworking:**\n\nInside the newly created `RedditKit` directory, there exists an `External` directory containing its dependencies which the `git submodule update` command will have populated. Drag AFNetworking's `Classes` directory into your project.\n\n**Adding Mantle:**\n\nFollow [Mantle's instructions on getting the project set up](https://github.com/Mantle/Mantle#importing-mantle).\n\nOnce you have everything set up, you may need to restart Xcode to have it pick up your changes.\n\n## Getting Started\n\nRedditKit is structured around the `RKClient` class. This class manages authentication for a single reddit account and performs HTTP requests on that user's behalf. `RKClient` can be used as a singleton with its `sharedClient` class method, or as a standalone object.\n\n```obj-c\n[[RKClient sharedClient] signInWithUsername:@\"name\" password:@\"password\" completion:^(NSError *error) {\n    if (!error)\n    {\n        NSLog(@\"Successfully signed in!\");\n    }\n}];\n```\n\nOnce you're signed in, `RKClient` will keep track of any necessary authentication state. You can then call methods which require authentication, such as getting the subreddits you are subscribed to.\n\n**Note:** RedditKit does not persist your authentication credentials itself; you'll have to do this manually via the Keychain, and call `signInWithUsername:password:completion:` on your application's launch.\n\n```obj-c\n[[RKClient sharedClient] subscribedSubredditsWithCompletion:^(NSArray *subreddits, NSError *error) {\n    NSLog(@\"Subreddits: %@\", subreddits);\n}];\n```\n\nRetrieving the current top links in a subreddit is simple.\n\n```obj-c\nRKSubreddit *subreddit = [[self subreddits] firstObject];\n\n[[RKClient sharedClient] linksInSubreddit:subreddit pagination:nil completion:^(NSArray *links, RKPagination *pagination, NSError *error) {\n    NSLog(@\"Links: %@\", links);\n}];\n```\n\nYou can then upvote a link.\n\n```obj-c\nRKLink *link = [[self links] firstObject];\n\n[[RKClient sharedClient] upvote:link completion:^(NSError *error) {\n    NSLog(@\"Upvoted the link!\");\n}];\n```\n\n\u003e RedditKit doesn't have any built-in rate limiting. reddit's API rules require that you make no more than 30 requests per minute and try to avoid requesting the same page more than once every 30 seconds. You can read up on the API rules [on their wiki page](https://github.com/reddit/reddit/wiki/API).\n\n## More Examples\n\n**Get the top comments for a link:**\n\n```obj-c\nRKLink *link = [[self links] firstObject];\n\n[[RKClient sharedClient] commentsForLink:link completion:^(NSArray *comments, NSError *error) {\n\tif (comments)\n\t{\n\t\tNSLog(@\"Comments: %@\", comments);\n\t}\n}];\n```\n\n**Fetch a user's account:**\n\n```obj-c\n[[RKClient sharedClient] userWithUsername:@\"name\" completion:^(RKUser *account, NSError *error) {\n\tif (account)\n\t{\n\t\tNSLog(@\"%@\", account);\n\t}\n}];\n```\n\n**Send private messages:**\n\n```obj-c\n[[RKClient sharedClient] sendMessage:@\"Hello!\" subject:nil recipient:@\"samsymons\" completion:nil];\n```\n\n**Canceling a request:**\n\nEach of RedditKit's methods return a `NSURLSessionDataTask`, which can be used to cancel a request before it has completed.\n\n```obj-c\nNSURLSessionDataTask *task = [[RKClient sharedClient] frontPageLinksWithCompletion:nil];\n[task cancel];\n```\n\n\u003e When using RedditKit's APIs, it's important to remember that users who have reddit gold may have settings which affect the response from the server. For example, users who have disabled promoted links will see an empty array returned when retrieving links from the promoted category of a subreddit.\n\n## Pagination\n\nMethods which are paginated can accept `RKPagination` objects.\n\n`RKPagination` lets you change the sorting of returned objects. For example, when fetching the top 25 links in a subreddit, setting the `subredditCategory` property changes whether you get the top 25 links right now or the top links overall.\n\nIn addition to letting you change the pagination of your requests, RedditKit also gives you pagination information for any requests made. A request for links in a subreddit has a pagination object as an argument in its completion block.\n\nDue to the way reddit's API is structured, comments do not have support for pagination. Instead, comment listings will return `RKMoreComments` object which can then be used to retrieve the comments in question.\n\n\u003e The [example project](Example/) implements pagination in a table view controller, loading new links when the user scrolls to the bottom.\n\n## Multiple Accounts\n\n`RKClient` manages a single reddit account. When supporting multiple accounts, all you need to do is switch from using the `sharedClient` method to using one `RKClient` instance per account.\n\nFor example, this code:\n\n```obj-c\n[[RKClient sharedClient] signInWithUsername:@\"username\" password:@\"password\" completion:nil];\n[[RKClient sharedClient] upvote:someLink completion:nil];\n```\n\nBecomes this:\n\n```obj-c\nRKClient *client = [[RKClient alloc] init];\n\n[client signInWithUsername:@\"username\" password:@\"password\" completion:nil];\n[client upvote:someLink completion:nil];\n```\n\nHow you manage the various `RKClient` instances is up to you. Probably with an `NSDictionary`, using reddit usernames as keys.\n\n## Configuration\n\nYou can configure various aspects of RedditKit, including its default API endpoint and user agent. Check out the `RKClient` header file for more.\n\n**You should set your user agent to the name and version of your app, along with your reddit username. That way, if you ever have a buggy version of your app in the wild, the reddit admins will know who to contact.**\n\nIf you do not set one manually, the user agent will be provided by [AFNetworking](AFNetworking).\n\n## Requirements\n\nRedditKit requires either iOS 7.0+ or Mac OS X 10.9+. Xcode 5 or greater is required in order to run its test suite.\n\nARC is required. For projects that don't use ARC, you can set the `-fobjc-arc` compiler flag on the RedditKit source files.\n\n## Dependencies\n\n* [AFNetworking](AFNetworking)\n* [Mantle](https://github.com/github/Mantle)\n\n## Credits\n\n[SAMCategories](https://github.com/soffes/SAMCategories) by Sam Soffes is used for unescaping HTML entities in reddit link titles.\n\nAlso, a big thanks to [all of the contributors](https://github.com/samsymons/RedditKit/graphs/contributors) to RedditKit.\n\n## Need Help?\n\nOpen an [issue](https://github.com/samsymons/RedditKit/issues), or hit me up on [Twitter](http://twitter.com/sam_symons).\n\n[AFNetworking]: https://github.com/AFNetworking/AFNetworking\n\n## License\n\nCopyright (c) 2013 Sam Symons (http://samsymons.com/)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamsymons%2Fredditkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamsymons%2Fredditkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamsymons%2Fredditkit/lists"}