Skip to content

h33n0k/grepper-node

 
 

Repository files navigation

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


Requirements

  1. A Grepper Account.
  2. 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.

About

node client library

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • TypeScript 98.4%
  • JavaScript 1.6%