summary refs log tree commit diff
path: root/lib/index.ts
blob: 3eddf7a36d3dabf52fe41aae5c4d30209887570c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { FeedOptions } from "./interfaces";
import { getPost as apiGetPost } from "./getPost";
import { getPosts as apiGetPosts } from "./getPosts";
import { generateApi as apiGenerateApi } from "./generateApi";
import { generateRss as apiGenerateRss } from "./generateRss";
import Post from "./Post";

export default class Kronikarz {
  postPath: string;

  constructor(postPath: string) {
    this.postPath = postPath;
  }

  getPosts(): Array<Post> {
    return apiGetPosts(this.postPath);
  }

  getPost(year: string, month: string, day: string, title: string): Post {
    return apiGetPost({ year, month, day, title }, this.postPath);
  }

  generateApi(path: string) {
    const posts = this.getPosts();
    apiGenerateApi(posts, path)
  }

  generateRss(path: string, feedOptions: FeedOptions) {
    const posts = this.getPosts();
    apiGenerateRss(posts, path, feedOptions);
  }
}