mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-08-14 23:07:29 +00:00
Add feed discovery plugin
This commit is contained in:
parent
e47616bf9d
commit
5cfeea6b57
37 changed files with 2432 additions and 5 deletions
23
plugins/feed-discovery/src/output/index.ts
Normal file
23
plugins/feed-discovery/src/output/index.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import type { FeedDiscoveryResponse, FeedOutputFormat } from "../types.js";
|
||||
import { renderAtom } from "./atom.js";
|
||||
import { renderJsonFeed } from "./json-feed.js";
|
||||
import { renderOpml } from "./opml.js";
|
||||
import { renderRss } from "./rss.js";
|
||||
|
||||
export function renderDiscoveryOutput(response: FeedDiscoveryResponse, format: FeedOutputFormat) {
|
||||
if (format === "opml") {
|
||||
return renderOpml(response);
|
||||
}
|
||||
if (format === "rss") {
|
||||
return renderRss(response);
|
||||
}
|
||||
if (format === "atom") {
|
||||
return renderAtom(response);
|
||||
}
|
||||
if (format === "json-feed") {
|
||||
return renderJsonFeed(response);
|
||||
}
|
||||
return JSON.stringify(response, null, 2);
|
||||
}
|
||||
|
||||
export { renderAtom, renderJsonFeed, renderOpml, renderRss };
|
||||
Loading…
Add table
Add a link
Reference in a new issue