From 6116769757ddd88781129e7339fc7ff60a259337 Mon Sep 17 00:00:00 2001 From: Patryk Niedźwiedziński Date: Fri, 7 Aug 2020 21:55:16 +0200 Subject: Add rss feed generation --- lib/index.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'lib/index.ts') diff --git a/lib/index.ts b/lib/index.ts index 4bf4dd3..3eddf7a 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -1,6 +1,8 @@ +import { FeedOptions } from "./interfaces"; import { getPost as apiGetPost } from "./getPost"; import { getPosts as apiGetPosts } from "./getPosts"; -import { generateApi as apiGenerateApi } from "./generateApi" +import { generateApi as apiGenerateApi } from "./generateApi"; +import { generateRss as apiGenerateRss } from "./generateRss"; import Post from "./Post"; export default class Kronikarz { @@ -13,11 +15,18 @@ export default class Kronikarz { getPosts(): Array { 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) + + generateApi(path: string) { + const posts = this.getPosts(); + apiGenerateApi(posts, path) + } + + generateRss(path: string, feedOptions: FeedOptions) { + const posts = this.getPosts(); + apiGenerateRss(posts, path, feedOptions); } } -- cgit 1.4.1