{"id":24502979,"url":"https://github.com/reecem/custom-type-api","last_synced_at":"2025-03-15T08:14:33.926Z","repository":{"id":48892255,"uuid":"362743947","full_name":"ReeceM/custom-type-api","owner":"ReeceM","description":"API library to interface with the Custom Types and Slices API for Prismic","archived":false,"fork":false,"pushed_at":"2022-08-26T20:15:46.000Z","size":71,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-21T23:14:37.190Z","etag":null,"topics":["custom-types","prismic","slicemachine"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ReeceM.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":".github/SECURITY.md","support":null}},"created_at":"2021-04-29T08:24:45.000Z","updated_at":"2022-08-26T20:15:49.000Z","dependencies_parsed_at":"2023-01-16T17:00:41.105Z","dependency_job_id":null,"html_url":"https://github.com/ReeceM/custom-type-api","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReeceM%2Fcustom-type-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReeceM%2Fcustom-type-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReeceM%2Fcustom-type-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReeceM%2Fcustom-type-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ReeceM","download_url":"https://codeload.github.com/ReeceM/custom-type-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243701463,"owners_count":20333631,"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":["custom-types","prismic","slicemachine"],"created_at":"2025-01-21T23:14:45.907Z","updated_at":"2025-03-15T08:14:33.899Z","avatar_url":"https://github.com/ReeceM.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# custom-type-api\n\nAPI library to interface with the Custom Types and Slices API for Prismic\n\n## Important\n\nI have intentionally only implemented mainly support for node as I don't see the need to have this ability to interact with the API available client side.\n\n### WIP, please add issues or comments if there is anything that you see :)\n\nThe readme is a WIP and the code could probably have some error handling added.\n\n## Usage\n\nyou can install the package using:\n\n\u003e **Note**\n\u003e you can use yarn, npm, pnpm or the github package registry.\n\n```bash\nnpm i -D @reecem/custom-type-api\n```\n\nBelow is an example of how to use this to interact with the API for the custom types, it gets a type and writes the result to ta json file.\n\n### If using commonJS:\n\n```js\nconst Api = require('@reecem/custom-type-api');\nconst credentials = require('./env.json');\nconst fs = require('fs');\nconst path = require('path')\n\nconst api = new Api('slicemachine-startup', credentials.token)\n\nasync function test() {\n  await api.init()\n\n  try {\n    const type = await api.types().getOne('page');\n\n    console.log(type)\n\n    fs.writeFileSync(path.join(__dirname, 'page.json'), JSON.stringify(type, null, 2))\n  } catch (ex) {\n    console.error(ex)\n  }\n}\n\ntest()\n```\n\n\n### If using modules:\n\n```js\nimport Api from '@reecem/custom-type-api'\n\nimport { createRequire } from \"module\"; // Bring in the ability to create the 'require' method\nconst require = createRequire(import.meta.url); // construct the require method\nconst credentials = require('../env.json');\n\nasync function test() {\n  const api = new Api('slicemachine-startup', credentials.token)\n\n  await api.init()\n\n  try {\n    let slice = await api.slices().getOne('form_slice');\n    console.log(slice)\n    fs.writeFileSync(path.join(__dirname, 'form_slice.json'), JSON.stringify(slice, null, 2))\n  } catch (ex) {\n    console.error(ex)\n  }\n}\n\ntest()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freecem%2Fcustom-type-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freecem%2Fcustom-type-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freecem%2Fcustom-type-api/lists"}