Package Exports
- grepper-node
- grepper-node/dist/index.js
- grepper-node/dist/index.mjs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (grepper-node) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Grepper Node
A Node.js library for interacting with the Grepper API to browse and manage code snippets. This library provides an intuitive interface to search, retrieve, and update code snippets programmatically.
Features
- Search Answers: Find answers based on a query string.
- Retrieve an Answer: (Currently unavailable) Refer to the official documentation.
- Update an Answer: (Currently unavailable) Refer to the official documentation.
Requirements
- A Grepper Account.
- A valid Grepper API Key.
Installation
Install the library using npm or yarn:
npm install grepper-node
# or
yarn add grepper-node
Getting Started
Authentication
Create a new client instance using your Grepper API key:
import { Client } from 'grepper-node'
const client = new Client({
api_key: '<your_api_key>'
});
Usage Examples
Search Answers
Use the search
method to find answers by a query string:
const answers = await client.search('how to build docker image');
console.log(answers);
// output:
// [
// {
// object: string,
// id: number,
// content: string,
// author_name: string,
// title: string,
// upvotes: number,
// downvotes: number
// }
// ]
Retrieve an Answer
This endpoint is currently unavailable. Refer to the official documentation.
// Example usage when available:
const answer = await client.answer(343661);
console.log(answer);
// output:
// {
// object: string,
// id: number,
// content: string,
// author_name: string,
// title: string,
// upvotes: number,
// downvotes: number
// }
Update an Answer
This endpoint is currently unavailable. Refer to the official documentation.
// Example usage when available:
const status = await client.update(343661, 'new answer content here');
console.log(status);
// output:
// {
// id: number,
// success: boolean
// }
Contributing
We welcome contributions! To get started: CONTRIBUTING
License
This project is licensed under the MIT License.