intake/README.md

2.1 KiB

Providers are modules that export: CONFIG = { "config key": "optional | required", ... }

update(config, state) -> list[items]

And optionally: action_NAME(config, state, item) -> None

on_create(config, state, item) -> None

on_delete(config, state, item) -> None

Sources are folders in the data directory with: config: user-modified configuration values, drawn from the provider state: provider-modified data *.item: feed items

config reserved keys: "provider": the provider the source uses "name": given to sources by default, individuates sources from same provider

GET /config Edit subfeed configs

GET /config/[feedname] Edit config values for feedname

GET /feed/[feedname] Feed view for feedname

CLI: intake create [provider] [--config KEY VALUE] [-c KEY VALUE] ... load the provider verify that the provider's config is satisfied create the source and set the config values

intake update [source] [--reset]
    load the source's config and state
    use config.provider to load the provider
    verify the source config against the provider config
    call provider.update(config, state) to get current items
    merge new items into current items
        if --reset, new items overwrite everything, including active

intake deactivate [source] [--tag TAG] [--title TITLE]
    load each item in the source and deactivate it

intake add [--id ID] [--title TITLE] [--link LINK] [--time TIME] [--author AUTHOR] [--body BODY] [--tags TAGS] [--ttl TTL] [--ttd TTD] [--tts TTS]
    create the item and add it to the default source

intake feed [--json]
    Dump active item feed to stdout

intake action [source] [item] [action]
    load config, state, item
    verify item supports this action
    load config.provider
    verify config
    verify provider supports this action
    action_[action](config, state, item)