{"id":20303109,"url":"https://github.com/vanities/fourchanapi","last_synced_at":"2026-01-07T16:36:44.281Z","repository":{"id":124357202,"uuid":"497190237","full_name":"vanities/FourChanAPI","owner":"vanities","description":"Swift Combine adapter for 4chan's public API","archived":false,"fork":false,"pushed_at":"2024-03-28T23:59:12.000Z","size":29,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-03T11:23:31.112Z","etag":null,"topics":["combine","swift"],"latest_commit_sha":null,"homepage":"","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/vanities.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-28T02:19:45.000Z","updated_at":"2024-08-28T21:40:21.000Z","dependencies_parsed_at":"2024-03-29T00:33:48.948Z","dependency_job_id":"8990bd3e-f378-40b1-a033-6c94e7bab455","html_url":"https://github.com/vanities/FourChanAPI","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanities%2FFourChanAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanities%2FFourChanAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanities%2FFourChanAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanities%2FFourChanAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vanities","download_url":"https://codeload.github.com/vanities/FourChanAPI/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246123051,"owners_count":20726936,"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":["combine","swift"],"created_at":"2024-11-14T16:35:57.418Z","updated_at":"2026-01-07T16:36:44.237Z","avatar_url":"https://github.com/vanities.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FourChan\n\nA Swift package for the [4chan.org Read-only HTTP/JSON API](https://github.com/4chan/4chan-API).\n\n# Features\n\n- Typesafe URLs for\n  - the 4chan API (FourChanAPIEndpoint)\n  - the experimental 4chan mobile search API (FourChanAPIEndpoint.search)\n  - the 4chan web site. (FourChanWebEndpoint)\n- Codable structs for all the 4chan API result types (e.g. Post).\n  - the structs implement Identifiable where possible.\n- Helpers for making network requests in a variety of styles:\n  - using callbacks.\n  - using Combine publishers.\n  - using Combine/SwiftUI ObsevableObjects.\n\n\n# Usage\n\nThis package supports both callback and Combine-based networking.\n\nIf you load the package in an environment (like Linux) that doesn't support Combine, then the Combine APIs won't be available.\n\nAn example of using the API with minimal helper functions:\n\n```\nimport Foundation\nimport FourChan\n\nlet boards = try? JSONDecoder().decode(Boards.self,\n                                       from:Data(contentsOf:FourChanAPIEndpoint.boards.url()))\n\n```\n\nAn example of callback-based networking is:\n\n```\nimport FourChan\n\nFourChanAPIService.shared.GET(endpoint:.boards) { (result: Result\u003cBoards, FourChanAPIService.APIError\u003e) in\n  print(result)\n}\n```\n\nAn example of Combine-based networking:\n\n```\nimport Combine\n\nFourChanService.shared.posts(board:\"w\")\n  .tryMap{ postInContext in\n    postInContext.imageURL\n  }\n  .sink(\n    receiveCompletion: { completion in\n    if case .failure(_) = completion {\n        print(\".sink() failed \", String(describing: completion))\n      }\n    },\n    receiveValue: { imageURL in\n      print(imageURL)\n    }\n  )\n```\n\nA SwiftUI example:\n\n```\nimport FourChan\nimport SwiftUI\n\nstruct FourChanBoardsView : View {\n  var loader: FourChanLoader = FourChanLoader()\n\n  var body: some View {\n    var categories = loader.data?.categories ?? []\n  \n    return List {\n      ForEach(0..\u003ccategories.count, id:\\.self) { i in\n        Text(categories[i].title)\n      }\n    }\n  }\n}\n```\n\n# Versioning\n\nThis module's API is not yet stable, pin to a particular version if you want stability.\n\n# Quality\n\nThere are no known bugs. And the library is in use by the \"Kleene Star\" 4Chan browser app.\n\nBe aware that 4Chan does not provide any guarentees about their API being stable or supported.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvanities%2Ffourchanapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvanities%2Ffourchanapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvanities%2Ffourchanapi/lists"}