{"id":16461541,"url":"https://github.com/unnikked/notiongas","last_synced_at":"2025-07-07T04:01:56.091Z","repository":{"id":206571620,"uuid":"717206372","full_name":"unnikked/NotionGAS","owner":"unnikked","description":"A convenient way to interact with Notion databases in Google Apps Script.","archived":false,"fork":false,"pushed_at":"2023-11-10T20:19:27.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-10T05:16:25.165Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unnikked.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-11-10T20:04:27.000Z","updated_at":"2023-11-10T20:28:12.000Z","dependencies_parsed_at":"2023-11-10T21:27:33.197Z","dependency_job_id":"ead94716-6b42-4efc-8c80-366c9680df11","html_url":"https://github.com/unnikked/NotionGAS","commit_stats":null,"previous_names":["unnikked/notiongas-"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unnikked%2FNotionGAS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unnikked%2FNotionGAS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unnikked%2FNotionGAS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unnikked%2FNotionGAS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unnikked","download_url":"https://codeload.github.com/unnikked/NotionGAS/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240988685,"owners_count":19889546,"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-10-11T11:08:34.430Z","updated_at":"2025-02-27T06:24:01.945Z","avatar_url":"https://github.com/unnikked.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NotionGAS\n\n## Overview\n\nThe NotionGAS provides a convenient way to interact with Notion databases in Google Apps Script. It enables users to perform various operations such as creating, updating, deleting, and querying database pages with ease.\n\n## Getting Started\n\n### Prerequisites\n\nTo use the NotionGAS, you need the following:\n\n1. A Notion integration token.\n2. Google Apps Script environment.\n3. [Load the library](https://developers.google.com/apps-script/guides/libraries#add_a_library_to_your_script_project) with script id `1Vj2DDUHd1CXlBelJdzDCR1ttFLj4tmb35R_lrmxRal-dGPU-mOgqqtoF`\n\n### Integration\n\n```javascript\n// Include the Notion API library\nconst TOKEN = 'your_notion_integration_token';\nconst notion = new NotionV1(TOKEN);\n\n// Create a Notion database instance\nconst tasks = database(notion, 'database-id');\n```\n\n## Class: `Database`\n\n### Constructor\n\n```javascript\nconst tasks = new Database(notion, 'database-id');\n```\n\nCreates a new `Database` instance.\n\n- `notion`: Notion API instance.\n- `database`: Notion database ID or name.\n\n### Methods\n\n#### `schema()`\n\n```javascript\nconst properties = tasks.schema();\n```\n\nRetrieves the schema (properties) of the Notion database.\n\n#### `typeOfProperty(property)`\n\n```javascript\nconst propertyType = tasks.typeOfProperty('task');\n```\n\nGets the type of a specific property in the database schema.\n\n#### `property(name, value)`\n\n```javascript\nconst formattedProperty = tasks.property('task', 'Complete task');\n```\n\nFormats a property based on its type.\n\n#### `create(page)`\n\n```javascript\nconst newPage = tasks.create({ task: 'New Task', due_date: '2023-12-31' });\n```\n\nCreates a new page in the database with the provided properties.\n\n#### `update(page_id, properties)`\n\n```javascript\nconst updatedPage = tasks.update('page_id', { task: 'Updated Task' });\n```\n\nUpdates an existing page in the database.\n\n#### `delete(page_id)`\n\n```javascript\ntasks.delete('page_id');\n```\n\nDeletes a page from the database.\n\n#### `mapFilter(filters)`\n\n```javascript\nconst filter = tasks.mapFilter({\n  task: { equals: 'New Task' },\n  done: { equals: false }\n});\n```\n\nMaps filter criteria to Notion API filter format.\n\n#### `findById(id)`\n\n```javascript\nconst page = tasks.findById('page_id');\n```\n\nFinds a database page by ID.\n\n#### `findFirstById(id)`\n\n```javascript\nconst page = tasks.findFirstById('page_id');\n```\n\nFinds the first database page by ID.\n\n#### `findAll(filters)`\n\n```javascript\nconst allPages = tasks.findAll({\n  task: { contains: 'Task' },\n  done: { equals: true }\n});\n```\n\nFinds all pages in the database based on filter criteria.\n\n#### `findAllAndSort(filters, sorts)`\n\n```javascript\nconst sortedPages = tasks.findAllAndSort(\n  { task: { contains: 'Task' } },\n  { property: 'due_date', direction: 'ascending' }\n);\n```\n\nFinds and sorts all pages in the database.\n\n#### `to_csv(columns, params)`\n\n```javascript\nconst csvData = tasks.to_csv(['task', 'due_date'], { done: { equals: false } });\n```\n\nExports database content to CSV with optional column selection and filter parameters.\n\n#### `to_csv_custom(columns, params)`\n\n```javascript\nconst csvData = tasks.to_csv_custom(['task', 'due_date'], { done: { equals: false } });\n```\n\nExports database content to CSV with custom export parameters.\n\n## Example Usage\n\n```javascript\n// Example: Creating, updating, and deleting a task\nconst newTask = tasks.create({ task: 'New Task', due_date: '2023-12-31' });\nnewTask.update({ task: 'Updated Task' });\nnewTask.delete();\n```\n\n# License\nThis project is licensed under the MIT License - see the LICENSE file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funnikked%2Fnotiongas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funnikked%2Fnotiongas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funnikked%2Fnotiongas/lists"}