An open API service indexing awesome lists of open source software.

https://github.com/moo-w/geasty

Simple and easy to use Gist API client
https://github.com/moo-w/geasty

api api-client gist github typescript-library

Last synced: about 1 year ago
JSON representation

Simple and easy to use Gist API client

Awesome Lists containing this project

README

          

# geasty

Simple and easy to use TypeScript library for interacting with GitHub [Gist](https://gist.github.com) API.

## Features

- Full CRUD operations for gists
- Support for forks, stars, and commits
- Type-safe API with proper TypeScript definitions
- Error handling with custom error classes
- Authentication via GitHub access tokens

## Installation

```bash
npm install geasty
```

## Usage

```typescript
import Geasty from 'geasty'

// Initialize with your GitHub access token
const geasty = new Geasty({ access_token: 'your-github-token' })

// Example: Create a gist
const newGist = await geasty.createAGist({
files: {
'hello.txt': { content: 'Hello World!' }
},
public: true,
description: 'My first gist'
})

// Example: Get all gists
const myGists = await geasty.getAllGists()
```

## API Methods

### Gist Management
- `createAGist(options)`
- `deleteAGist(gistId)`
- `updateAGist(options)`
- `getAGist(gistId)`
- `getAllGists(options)`
- `getPublicGists(options)`
- `getStarredGists(options)`

### User Gists
- `getGistsForUser(options)`

### Forks & Commits
- `getGistForks(options)`
- `getGistCommits(options)`
- `forkAGist(gistId)`

### Stars
- `isGistStarred(gistId)`
- `starAGist(gistId)`
- `unstarAGist(gistId)`

## Error Handling

The library throws custom `GeastyError` for authentication issues and wraps GitHub API errors.

## License

MIT