pl-api: works on docs

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-10-29 22:26:53 +01:00
parent 14d75be0de
commit ee0232e2e6
18 changed files with 119 additions and 11 deletions

View File

@ -4,6 +4,25 @@ A JavaScript library for interacting with Mastodon API-compatible servers, focus
`pl-api` attempts to abstract out the implementation details when supporting different backends, implementing the same features in different ways. It uses [Valibot](https://valibot.dev/) to ensure type safety and normalize API responses.
Example:
```ts
import { PlApiClient, type CreateApplicationParams } from 'pl-api';
const { ACCESS_TOKEN } = process.env;
const client = new PlApiClient('https://mastodon.example/', ACCESS_TOKEN, {
fetchInstance: true,
onInstanceFetchSuccess: () => console.log('Instance fetched'),
});
await client.statuses.createStatus({
status: 'Hello, world!',
language: 'en',
});
```
Some sort of documentation is available on https://pl.mkljczk.pl/pl-api-docs
> This project should be considered unstable before the 1.0.0 release. I will not provide any changelog or information on breaking changes until then.
## Projects using `pl-api`