# WISP CMS JS Client

A JavaScript client for wisp - a delightfully simple blogging CMS.

## Installation

```bash
npm i @wisp-cms/client
```

## Documentation

For more detailed information about wisp and its features:

- Visit [wisp website](https://www.wisp.blog/?utm_source=npm&utm_medium=web&utm_campaign=client)
- Read the [JavaScript SDK documentation](https://www.wisp.blog/docs/core-concepts/js-sdk?utm_source=npm&utm_medium=web&utm_campaign=client)
- If you prefer to use the API directly, check out the [Content API documentation](https://www.wisp.blog/docs/core-concepts/content-api?utm_source=npm&utm_medium=web&utm_campaign=client)

## Basic Usage

### Initializing the client

First, import and initialize the wisp client:

```javascript
import { buildWispClient } from "@wisp-cms/client";

export const wisp = buildWispClient({
  baseUrl: process.env.NEXT_PUBLIC_SITE_URL || "https://www.wisp.blog",
  blogId: process.env.NEXT_PUBLIC_BLOG_ID!,
});
```

### Listing All Blog Posts

```javascript
const blogPostResult = await wisp.getPosts({ limit: "all" });
```

### Fetching a Single Blog Post

```javascript
const post = await wisp.getPost({ slug: "your-post-slug" });
```

### More functions

To see the full list of supported function, read the [JS SDK Documentation](https://www.wisp.blog/docs/core-concepts/js-sdk?utm_source=npm&utm_medium=web&utm_campaign=client)

### License

This project is licensed under the MIT License.
