Documentation ¶
Overview ¶
The publish package provides a publishing service and requires initialization by the caller.
To use the publish package, import the package and its dependencies, such as register, as shown in the following example:
package main import ( _ "github.com/wabarc/wayback/publish/register" "github.com/wabarc/wayback/publish" ) func main() { // Initialize the publish service with configuration options and a context. opts := &config.Options{} ctx := context.Background() pub := publish.New(ctx, opts) go pub.Start() defer pub.Stop() // Use the publish service to publish data. // ... }
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Collects = []wayback.Collect{ { Arc: config.SLOT_IA, Dst: "https://web.archive.org/web/20211000000001/https://example.com/", Src: "https://example.com/", Ext: config.SLOT_IA, }, { Arc: config.SLOT_IS, Dst: "http://archive.today/abcdE", Src: "https://example.com/", Ext: config.SLOT_IS, }, { Arc: config.SLOT_IP, Dst: "https://ipfs.io/ipfs/QmTbDmpvQ3cPZG6TA5tnar4ZG6q9JMBYVmX2n3wypMQMtr", Src: "https://example.com/", Ext: config.SLOT_IP, }, { Arc: config.SLOT_PH, Dst: "http://telegra.ph/title-01-01", Src: "https://example.com/", Ext: config.SLOT_PH, }, }
Functions ¶
func Artifact ¶ added in v0.19.0
func Artifact(ctx context.Context, rdx reduxer.Reduxer, cols []wayback.Collect) (art reduxer.Artifact, err error)
Artifact returns an artifact from the reduxer that corresponds to the first collect in the provided slice of collects. If the artifact is not found in the reduxer, an error is returned.
Types ¶
type Flag ¶ added in v0.16.0
type Flag uint8
Flag represents a type of uint8
const ( FlagWeb Flag = iota // FlagWeb publish from httpd service FlagTelegram // FlagTelegram publish from telegram service FlagTwitter // FlagTwitter publish from twitter srvice FlagMastodon // FlagMastodon publish from mastodon service FlagDiscord // FlagDiscord publish from discord service FlagMatrix // FlagMatrix publish from matrix service FlagSlack // FlagSlack publish from slack service FlagNostr // FlagSlack publish from nostr FlagIRC // FlagIRC publish from relaychat service FlagNotion // FlagNotion is a flag for notion publish service FlagGitHub // FlagGitHub is a flag for github publish service FlagMeili // FlagMeili is a flag for meilisearch publish service )
type Module ¶ added in v0.19.0
Module is a struct embeds the Publisher interface and holds a pointer to config.Options.
type Publish ¶ added in v0.19.0
type Publish struct {
// contains filtered or unexported fields
}
Publish handles options for publish service.
func New ¶ added in v0.19.0
New creates a Publish struct with the given context and configuration options. It initializes a new pooling with the context and options, and parses all available modules.
Returns a new Publish with the provided options and pooling.
func (*Publish) Spread ¶ added in v0.19.0
func (p *Publish) Spread(ctx context.Context, rdx reduxer.Reduxer, cols []wayback.Collect, from Flag, args ...string)
Spread accepts calls from services that with collections and various parameters. It prepare all available publishers and put them into pooling.
type Publisher ¶ added in v0.14.0
type Publisher interface {
Publish(context.Context, reduxer.Reduxer, []wayback.Collect, ...string) error
}
Publisher is the interface that wraps the basic Publish method.
Publish publish message to serveral media platforms, e.g. Telegram channel, GitHub Issues, etc. The cols must either be a []wayback.Collect, args use for specific service.