https://github.com/alfredosalzillo/foora
A forem (dev.to) api client for Deno
https://github.com/alfredosalzillo/foora
Last synced: 8 months ago
JSON representation
A forem (dev.to) api client for Deno
- Host: GitHub
- URL: https://github.com/alfredosalzillo/foora
- Owner: alfredosalzillo
- Created: 2020-11-20T20:22:25.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-21T14:17:57.000Z (almost 5 years ago)
- Last Synced: 2024-05-01T15:58:02.999Z (over 1 year ago)
- Language: TypeScript
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# foora
An api client for [forem](https://github.com/forem/forem) the platform that powers [dev.to](https://dev.to) for [deno](https://deno.land/).
## Usage
```typescript
import { createClient } from 'https://deno.land/x/foora/mod.ts';const client = createClient({
baseUrl: 'https://dev.to/api',
secret: 'my-dev-to-secret'
})
```
## Available apis### articles
- **create** create an article
```typescript
client.articles.create({
title: 'My swag article',
body_markdown: `
#My swag article
Hello world dev.to!
`,
published: true,
tags: ['disc', 'hello'],
})
```
- **update** update an article```typescript
client.articles.update(1234, {
tags: ['disc', 'hello', 'world'],
})
```
- **retrieve** retrieve an article by id```typescript
const article = await client.articles.retrieve(1234);
console.log(`Hello my first article title have ${article.positive_reactions_count} reactions`);
```
- **retrieveAll** retrieve all articles```typescript
const articles = await client.articles.retrieveAll({
page: 25,
per_page: 30,
});
```
- **byPath** retrieve article by path```typescript
const article = await client.articles.byPath('alfredosalzillo/my-swag-article');
console.log(`Hello my first article title have ${article.positive_reactions_count} reactions`);
```
- **mine** retrieve articles of the user how generate the secret```typescript
const articles = await client.articles.mine({
page: 25,
per_page: 30,
});
```
- **minePublished** retrieve published articles of the user how generate the secret```typescript
const articles = await client.articles.minePublished({
page: 25,
per_page: 30,
});
```
- **mineUnpublished** retrieve unpublished articles of the user how generate the secret
```typescript
const articles = await client.articles.mineUnpublished({
page: 25,
per_page: 30,
});
```
- **mineAll** retrieve all articles of the user how generate the secret```typescript
const articles = await client.articles.mineAll({
page: 25,
per_page: 30,
});
```
---
Based on the swagger definition available at [dev-to-swagger](http://alfredosalzillo.me/dev-to-swagger/#/),