{"id":33248408,"url":"https://github.com/elvisperlika/notion-kit","last_synced_at":"2025-11-16T22:00:59.976Z","repository":{"id":321602761,"uuid":"1086440587","full_name":"elvisperlika/notion-kit","owner":"elvisperlika","description":"🔌 Unofficial iOS/macOS SDK for the Notion API.","archived":false,"fork":false,"pushed_at":"2025-11-13T10:33:27.000Z","size":1935,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-13T11:25:07.635Z","etag":null,"topics":["api","ios","kit","library","macos","notion","package","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elvisperlika.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-30T12:26:47.000Z","updated_at":"2025-11-13T10:33:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"982a3a13-6c11-4e85-9f31-60b8aa8b04bb","html_url":"https://github.com/elvisperlika/notion-kit","commit_stats":null,"previous_names":["elvisperlika/alexis","elvisperlika/notion-kit"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/elvisperlika/notion-kit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elvisperlika%2Fnotion-kit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elvisperlika%2Fnotion-kit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elvisperlika%2Fnotion-kit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elvisperlika%2Fnotion-kit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elvisperlika","download_url":"https://codeload.github.com/elvisperlika/notion-kit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elvisperlika%2Fnotion-kit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284783255,"owners_count":27062608,"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","status":"online","status_checked_at":"2025-11-16T02:00:05.974Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","ios","kit","library","macos","notion","package","swift"],"created_at":"2025-11-16T22:00:37.179Z","updated_at":"2025-11-16T22:00:59.963Z","avatar_url":"https://github.com/elvisperlika.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ``NotionKit``\n\n[![CI](https://github.com/elvisperlika/notion-kit/workflows/CI/badge.svg)](https://github.com/elvisperlika/notion-kit/actions)\n![Notion API Version](https://img.shields.io/badge/Notion%20API%20Version-2025--09--03-white.svg)\n![Swift](https://img.shields.io/badge/Swift-6.1-blue.svg)\n![Platform](https://img.shields.io/badge/Platform-iOS%20%7C%20macOS-lightgrey.svg)\n![License](https://img.shields.io/github/license/elvisperlika/notion-kit.svg)\n![SPM](https://img.shields.io/badge/SPM-compatible-brightgreen.svg)\n\n![Notion x Swift](Resources/notionkit.png)\n\nUnofficial iOS/macOS SDK for the Notion API.\n\n## Overview\n\nThis SDK provides a Swift interface to interact with the Notion API up to \"**2025-09-03**\" version with baseURL `https://api.notion.com/v1`.\n\n## Setup\n\nThis SDK requires a [Notion Integration](https://www.notion.so/my-integrations).\n\n1. Create a new integration in Notion.  \n2. Copy the **Integration Key**.  \n3. Save it as an environment variable in your codebase:\n\n    ```swift\n    NOTION_TOKEN=your_integration_key_here\n    ```\n\n4. Add the SDK to your project:\n\n    ```swift\n    .package(url: \"https://github.com/elvisperlika/notion-kit\", from: \"1.0.0\")\n    ```\n  \n5. Create your Notion Client with the API key:\n\n    ```swift\n    guard let apiKey: String = ProcessInfo.processInfo.environment[\"NOTION_TOKEN\"] else {\n      fatalError(\"Missing NOTION_TOKEN environment variable\")\n    }\n    let client = try NotionClient(apiKey: apiKey)\n    ```\n\n## Guide\n\nNote: this SDK requires a Notion Integration.\nCreate an integration in Notion, copy its key,\nand save it as an environment variable in your codebase.\nKeep in mind that the integration can only access\npages or databases you have manually shared with it.\n\n### Users\n\nTo get the list of users in your Notion workspace, use the following code:\n\n```swift\nlet users: [NotionUser]? = try await client?.users()\n```\n\nFilter by user type:\n\n- **`bots`**: Get only bot users.\n\n  ```swift\n  let bots: [NotionUser]? = try await client?.users().bots()\n  ```\n\n- **`persons`**: Get only person users.\n\n  ```swift\n  let persons: [NotionUser]? = try await client?.users().persons()\n  ```\n\nGet the current user (the integration itself):\n\n```swift\nlet me: NotionUser? = try await client?.me()\n```\n\nGet a user by their ID:\n\n```swift\nlet userId: String = \"user_id_here\"\nlet user = try await client?.user(id: userId)\n```\n\n### Search\n\nGet all pages shared with the integration:\n\n```swift\n/// Get all pages shared with the integration\nlet pages = try await client?.search().results\n```\n\nIt's possible to pass some parameters to filter the results:\n\n- **`query`**: A string to search for in page and database titles.\n- **`filter`**: An optional ``SearchFilter`` to filter results by object type.\n  - Possible values for `SearchFilter.value` are `.page` or `.database`.\n  - Possible values for `SearchFilter.property` is `.object`.\n- **`sort`**: An optional ``SearchSort`` to sort results by last edited time.\n  - Possible values for `SearchSort.direction` are `.ascending` or `.descending`.\n  - Possible values for `SearchSort.timestamp` is `.lastEditedTime`.\n- **`startCursor`**: An optional string representing the cursor for pagination.\n- **`pageSize`**: An optional integer representing the number of results to return per page.\n\n#### Pagination\n\nThe search method supports pagination through the `startCursor` and `pageSize` parameters.\n\n```swift\nlet firstResponse = try await client?.search(pageSize: 10)\nlet pages = firstResponse?.results\nif let nextCursor = firstResponse?.nextCursor {\n    let secondResponse = try await client?.search(startCursor: nextCursor, pageSize: 10)\n    let otherPages = secondResponse?.results\n}\n```\n\nTo have a more convenient way to handle pagination, you can use the\n``SearchPaginator`` helper:\n\n```swift\nlet paginator = SearchPaginator(client: client!, size: 5)\n/// Default page size is 10, but you can customize it.\nlet response = try await paginator.nextResponse()\nlet nextResponse = try await paginator.nextResponse()\nlet nextNextResponse = try await paginator.nextResponse()\n```\n\nDo you want to fetch all pages at once? Use the\n``fetchAllPages()`` method (it will handle pagination for you):\n\n```swift\nlet paginator = SearchPaginator(client: client!)\nlet allPages = try await paginator.fetchAllPages()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felvisperlika%2Fnotion-kit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felvisperlika%2Fnotion-kit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felvisperlika%2Fnotion-kit/lists"}