rpc

package
v1.26.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2026 License: MPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidPluginName = fmt.Errorf("plugin name cannot be empty")
	ErrPluginNameTooLong = fmt.Errorf("plugin name cannot be longer than 100 characters")
)
View Source
var AuthorPattern = regexp.MustCompile(`^[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`)
View Source
var IDPattern = regexp.MustCompile(`^[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`)

Functions

func SerialiseSettings

func SerialiseSettings(s settings.Settings) map[string]any

func ValidateName

func ValidateName(name string) error

Types

type DatagraphRef

type DatagraphRef struct {
	// Resource ID
	ID xid.ID `json:"id"`
	// Resource kind (e.g., 'post', 'node', 'account')
	Kind string `json:"kind"`
}

func DatagraphRefToRPC

func DatagraphRefToRPC(r datagraph.Ref) DatagraphRef

func (*DatagraphRef) ToDomain

func (r *DatagraphRef) ToDomain() datagraph.Ref

type Event

type Event string
const (
	EventEventThreadPublished        Event = "EventThreadPublished"
	EventEventThreadUnpublished      Event = "EventThreadUnpublished"
	EventEventThreadUpdated          Event = "EventThreadUpdated"
	EventEventThreadDeleted          Event = "EventThreadDeleted"
	EventEventThreadReplyCreated     Event = "EventThreadReplyCreated"
	EventEventThreadReplyDeleted     Event = "EventThreadReplyDeleted"
	EventEventThreadReplyUpdated     Event = "EventThreadReplyUpdated"
	EventEventThreadReplyPublished   Event = "EventThreadReplyPublished"
	EventEventThreadReplyUnpublished Event = "EventThreadReplyUnpublished"
	EventEventPostLiked              Event = "EventPostLiked"
	EventEventPostUnliked            Event = "EventPostUnliked"
	EventEventPostReacted            Event = "EventPostReacted"
	EventEventPostUnreacted          Event = "EventPostUnreacted"
	EventEventCategoryUpdated        Event = "EventCategoryUpdated"
	EventEventCategoryDeleted        Event = "EventCategoryDeleted"
	EventEventMemberMentioned        Event = "EventMemberMentioned"
	EventEventNodeCreated            Event = "EventNodeCreated"
	EventEventNodeUpdated            Event = "EventNodeUpdated"
	EventEventNodeDeleted            Event = "EventNodeDeleted"
	EventEventNodePublished          Event = "EventNodePublished"
	EventEventNodeSubmittedForReview Event = "EventNodeSubmittedForReview"
	EventEventNodeUnpublished        Event = "EventNodeUnpublished"
	EventEventAccountCreated         Event = "EventAccountCreated"
	EventEventAccountUpdated         Event = "EventAccountUpdated"
	EventEventAccountSuspended       Event = "EventAccountSuspended"
	EventEventAccountUnsuspended     Event = "EventAccountUnsuspended"
	EventEventReportCreated          Event = "EventReportCreated"
	EventEventReportUpdated          Event = "EventReportUpdated"
	EventEventActivityCreated        Event = "EventActivityCreated"
	EventEventActivityUpdated        Event = "EventActivityUpdated"
	EventEventActivityDeleted        Event = "EventActivityDeleted"
	EventEventActivityPublished      Event = "EventActivityPublished"
	EventEventSettingsUpdated        Event = "EventSettingsUpdated"
)

type EventAccountCreated

type EventAccountCreated struct {
	Event string `json:"event"`
	// Account ID
	ID account.AccountID `json:"id"`
}

Emitted after a new account is created.

func (EventAccountCreated) EventPayloadType

func (EventAccountCreated) EventPayloadType() string

type EventAccountSuspended

type EventAccountSuspended struct {
	Event string `json:"event"`
	// Account ID
	ID account.AccountID `json:"id"`
}

Emitted when an account is suspended.

func (EventAccountSuspended) EventPayloadType

func (EventAccountSuspended) EventPayloadType() string

type EventAccountUnsuspended

type EventAccountUnsuspended struct {
	Event string `json:"event"`
	// Account ID
	ID account.AccountID `json:"id"`
}

Emitted when a suspended account is reinstated.

func (EventAccountUnsuspended) EventPayloadType

func (EventAccountUnsuspended) EventPayloadType() string

type EventAccountUpdated

type EventAccountUpdated struct {
	Event string `json:"event"`
	// Account ID
	ID account.AccountID `json:"id"`
}

Emitted after account profile, email, or role assignment changes.

func (EventAccountUpdated) EventPayloadType

func (EventAccountUpdated) EventPayloadType() string

type EventActivityCreated

type EventActivityCreated struct {
	Event string `json:"event"`
	// Activity/Event ID
	ID event_ref.EventID `json:"id"`
}

Emitted after an activity event is created.

func (EventActivityCreated) EventPayloadType

func (EventActivityCreated) EventPayloadType() string

type EventActivityDeleted

type EventActivityDeleted struct {
	Event string `json:"event"`
	// Activity/Event ID
	ID event_ref.EventID `json:"id"`
}

Emitted after an activity event is deleted.

func (EventActivityDeleted) EventPayloadType

func (EventActivityDeleted) EventPayloadType() string

type EventActivityPublished

type EventActivityPublished struct {
	Event string `json:"event"`
	// Activity/Event ID
	ID event_ref.EventID `json:"id"`
}

Emitted when an activity event becomes published, either on create or after a visibility change.

func (EventActivityPublished) EventPayloadType

func (EventActivityPublished) EventPayloadType() string

type EventActivityUpdated

type EventActivityUpdated struct {
	Event string `json:"event"`
	// Activity/Event ID
	ID event_ref.EventID `json:"id"`
}

Emitted after an activity event is updated.

func (EventActivityUpdated) EventPayloadType

func (EventActivityUpdated) EventPayloadType() string

type EventCategoryDeleted

type EventCategoryDeleted struct {
	Event string `json:"event"`
	// Category ID
	ID xid.ID `json:"id"`
	// Category slug
	Slug string `json:"slug"`
}

Emitted after a category is deleted.

func (EventCategoryDeleted) EventPayloadType

func (EventCategoryDeleted) EventPayloadType() string

type EventCategoryUpdated

type EventCategoryUpdated struct {
	Event string `json:"event"`
	// Category ID
	ID xid.ID `json:"id"`
	// Category slug
	Slug string `json:"slug"`
}

Emitted when a category is created, updated, or moved.

func (EventCategoryUpdated) EventPayloadType

func (EventCategoryUpdated) EventPayloadType() string

type EventMemberMentioned

type EventMemberMentioned struct {
	// Account ID of the member who mentioned
	By    account.AccountID `json:"by"`
	Event string            `json:"event"`
	// Reference to the mentioned item.
	Item DatagraphRef `json:"item"`
	// Reference to the content item where the mention was found.
	Source DatagraphRef `json:"source"`
}

Emitted once per mention target when a member mention is detected (self-mentions are skipped).

func (EventMemberMentioned) EventPayloadType

func (EventMemberMentioned) EventPayloadType() string

type EventNodeCreated

type EventNodeCreated struct {
	Event string `json:"event"`
	// Library node ID
	ID library.NodeID `json:"id"`
	// Node slug
	Slug string `json:"slug"`
}

Emitted after a library node is created.

func (EventNodeCreated) EventPayloadType

func (EventNodeCreated) EventPayloadType() string

type EventNodeDeleted

type EventNodeDeleted struct {
	Event string `json:"event"`
	// Library node ID
	ID library.NodeID `json:"id"`
	// Node slug
	Slug string `json:"slug"`
}

Emitted after a library node is deleted.

func (EventNodeDeleted) EventPayloadType

func (EventNodeDeleted) EventPayloadType() string

type EventNodePublished

type EventNodePublished struct {
	Event string `json:"event"`
	// Library node ID
	ID library.NodeID `json:"id"`
	// Node slug
	Slug string `json:"slug"`
}

Emitted when a library node becomes published, either on create or after a visibility change.

func (EventNodePublished) EventPayloadType

func (EventNodePublished) EventPayloadType() string

type EventNodeSubmittedForReview

type EventNodeSubmittedForReview struct {
	Event string `json:"event"`
	// Library node ID
	ID library.NodeID `json:"id"`
	// Node slug
	Slug string `json:"slug"`
}

Emitted when a library node transitions to review visibility.

func (EventNodeSubmittedForReview) EventPayloadType

func (EventNodeSubmittedForReview) EventPayloadType() string

type EventNodeUnpublished

type EventNodeUnpublished struct {
	Event string `json:"event"`
	// Library node ID
	ID library.NodeID `json:"id"`
	// Node slug
	Slug string `json:"slug"`
}

Emitted when a previously published library node transitions to draft, unlisted, or review.

func (EventNodeUnpublished) EventPayloadType

func (EventNodeUnpublished) EventPayloadType() string

type EventNodeUpdated

type EventNodeUpdated struct {
	Event string `json:"event"`
	// Library node ID
	ID library.NodeID `json:"id"`
	// Node slug
	Slug string `json:"slug"`
}

Emitted after a library node is updated, moved, re-ordered, or affected by property schema changes.

func (EventNodeUpdated) EventPayloadType

func (EventNodeUpdated) EventPayloadType() string

type EventPayload

type EventPayload struct {
	EventPayloadUnion
}

func (EventPayload) MarshalJSON

func (w EventPayload) MarshalJSON() ([]byte, error)

func (*EventPayload) UnmarshalJSON

func (w *EventPayload) UnmarshalJSON(data []byte) error

type EventPayloadUnion

type EventPayloadUnion interface {
	EventPayloadType() string
	// contains filtered or unexported methods
}

type EventPostLiked

type EventPostLiked struct {
	Event string `json:"event"`
	// Post ID that was liked
	PostID post.ID `json:"post_id"`
	// Root thread post ID
	RootPostID post.ID `json:"root_post_id"`
}

Emitted when a member adds a like to a post.

func (EventPostLiked) EventPayloadType

func (EventPostLiked) EventPayloadType() string

type EventPostReacted

type EventPostReacted struct {
	Event string `json:"event"`
	// Post ID that was reacted to
	PostID post.ID `json:"post_id"`
	// Root thread post ID
	RootPostID post.ID `json:"root_post_id"`
}

Emitted when a member adds an emoji reaction to a post.

func (EventPostReacted) EventPayloadType

func (EventPostReacted) EventPayloadType() string

type EventPostUnliked

type EventPostUnliked struct {
	Event string `json:"event"`
	// Post ID that was unliked
	PostID post.ID `json:"post_id"`
	// Root thread post ID
	RootPostID post.ID `json:"root_post_id"`
}

Emitted when a member removes a like from a post.

func (EventPostUnliked) EventPayloadType

func (EventPostUnliked) EventPayloadType() string

type EventPostUnreacted

type EventPostUnreacted struct {
	Event string `json:"event"`
	// Post ID that was unreacted
	PostID post.ID `json:"post_id"`
	// Root thread post ID
	RootPostID post.ID `json:"root_post_id"`
}

Emitted when a member removes an emoji reaction from a post.

func (EventPostUnreacted) EventPayloadType

func (EventPostUnreacted) EventPayloadType() string

type EventReportCreated

type EventReportCreated struct {
	Event string `json:"event"`
	// Report ID
	ID report.ID `json:"id"`
	// Optional account ID of reporter, not set if it was an automated system report.
	ReportedBy opt.Optional[account.AccountID] `json:"reported_by,omitempty"`
	// Reference to the item that was reported.
	Target opt.Optional[DatagraphRef] `json:"target,omitempty"`
}

Emitted when a new member or system report is created.

func (EventReportCreated) EventPayloadType

func (EventReportCreated) EventPayloadType() string

type EventReportUpdated

type EventReportUpdated struct {
	Event string `json:"event"`
	// Optional account ID of handler
	HandledBy opt.Optional[account.AccountID] `json:"handled_by,omitempty"`
	// Report ID
	ID report.ID `json:"id"`
	// Optional account ID of reporter
	ReportedBy opt.Optional[account.AccountID] `json:"reported_by,omitempty"`
	// Report status
	Status report.Status `json:"status"`
	// Reference to the item that the report is about.
	Target opt.Optional[DatagraphRef] `json:"target,omitempty"`
}

Emitted when a report is updated, including status and handler changes.

func (EventReportUpdated) EventPayloadType

func (EventReportUpdated) EventPayloadType() string

type EventSettingsUpdated

type EventSettingsUpdated struct {
	Event string `json:"event"`
	// Settings object
	Settings map[string]interface{} `json:"settings"`
}

Emitted when site settings are updated via the admin settings manager.

func (EventSettingsUpdated) EventPayloadType

func (EventSettingsUpdated) EventPayloadType() string

type EventThreadDeleted

type EventThreadDeleted struct {
	Event string `json:"event"`
	// Thread post ID
	ID post.ID `json:"id"`
}

Emitted after a thread is deleted.

func (EventThreadDeleted) EventPayloadType

func (EventThreadDeleted) EventPayloadType() string

type EventThreadPublished

type EventThreadPublished struct {
	Event string `json:"event"`
	// Thread post ID
	ID post.ID `json:"id"`
}

Emitted when a thread is visible as published, either on create or after a visibility change.

func (EventThreadPublished) EventPayloadType

func (EventThreadPublished) EventPayloadType() string

type EventThreadReplyCreated

type EventThreadReplyCreated struct {
	Event string `json:"event"`
	// Reply author account ID
	ReplyAuthorID account.AccountID `json:"reply_author_id"`
	// Reply post ID
	ReplyID post.ID `json:"reply_id"`
	// Optional ID of the author being replied to
	ReplyToAuthorID opt.Optional[account.AccountID] `json:"reply_to_author_id,omitempty"`
	// Optional ID of the post being replied to
	ReplyToTargetID opt.Optional[post.ID] `json:"reply_to_target_id,omitempty"`
	// Thread author account ID
	ThreadAuthorID account.AccountID `json:"thread_author_id"`
	// Thread post ID
	ThreadID post.ID `json:"thread_id"`
}

Emitted when a new reply is created and remains published (not moved to review by moderation).

func (EventThreadReplyCreated) EventPayloadType

func (EventThreadReplyCreated) EventPayloadType() string

type EventThreadReplyDeleted

type EventThreadReplyDeleted struct {
	Event string `json:"event"`
	// Reply post ID
	ReplyID post.ID `json:"reply_id"`
	// Thread post ID
	ThreadID post.ID `json:"thread_id"`
}

Emitted after a reply is deleted from a thread.

func (EventThreadReplyDeleted) EventPayloadType

func (EventThreadReplyDeleted) EventPayloadType() string

type EventThreadReplyPublished

type EventThreadReplyPublished struct {
	Event string `json:"event"`
	// Reply post ID
	ReplyID post.ID `json:"reply_id"`
	// Thread post ID
	ThreadID post.ID `json:"thread_id"`
}

Emitted when a reply visibility transitions to published.

func (EventThreadReplyPublished) EventPayloadType

func (EventThreadReplyPublished) EventPayloadType() string

type EventThreadReplyUnpublished

type EventThreadReplyUnpublished struct {
	Event string `json:"event"`
	// Reply post ID
	ReplyID post.ID `json:"reply_id"`
	// Thread post ID
	ThreadID post.ID `json:"thread_id"`
}

Emitted when a previously published reply transitions to a non-published visibility.

func (EventThreadReplyUnpublished) EventPayloadType

func (EventThreadReplyUnpublished) EventPayloadType() string

type EventThreadReplyUpdated

type EventThreadReplyUpdated struct {
	Event string `json:"event"`
	// Reply post ID
	ReplyID post.ID `json:"reply_id"`
	// Thread post ID
	ThreadID post.ID `json:"thread_id"`
}

Emitted after a reply update succeeds.

func (EventThreadReplyUpdated) EventPayloadType

func (EventThreadReplyUpdated) EventPayloadType() string

type EventThreadUnpublished

type EventThreadUnpublished struct {
	Event string `json:"event"`
	// Thread post ID
	ID post.ID `json:"id"`
}

Emitted when a previously published thread transitions to a non-published visibility.

func (EventThreadUnpublished) EventPayloadType

func (EventThreadUnpublished) EventPayloadType() string

type EventThreadUpdated

type EventThreadUpdated struct {
	Event string `json:"event"`
	// Thread post ID
	ID post.ID `json:"id"`
}

Emitted after a thread update succeeds, regardless of which fields changed.

func (EventThreadUpdated) EventPayloadType

func (EventThreadUpdated) EventPayloadType() string

type HostToPluginRequest

type HostToPluginRequest struct {
	HostToPluginRequestUnion
}

func (HostToPluginRequest) MarshalJSON

func (w HostToPluginRequest) MarshalJSON() ([]byte, error)

func (*HostToPluginRequest) UnmarshalJSON

func (w *HostToPluginRequest) UnmarshalJSON(data []byte) error

type HostToPluginRequestUnion

type HostToPluginRequestUnion interface {
	HostToPluginRequestType() string
	// contains filtered or unexported methods
}

type HostToPluginResponse

type HostToPluginResponse struct {
	Error   opt.Optional[HostToPluginResponseError] `json:"error,omitempty"`
	ID      xid.ID                                  `json:"id"`
	Jsonrpc string                                  `json:"jsonrpc"`
	Result  HostToPluginResponseUnion               `json:"result"`
}

type HostToPluginResponseError

type HostToPluginResponseError struct {
	Code    opt.Optional[int]    `json:"code,omitempty"`
	Message opt.Optional[string] `json:"message,omitempty"`
}

type HostToPluginResponseUnion

type HostToPluginResponseUnion struct {
	HostToPluginResponseUnionUnion
}

func (HostToPluginResponseUnion) MarshalJSON

func (w HostToPluginResponseUnion) MarshalJSON() ([]byte, error)

func (*HostToPluginResponseUnion) UnmarshalJSON

func (w *HostToPluginResponseUnion) UnmarshalJSON(data []byte) error

type HostToPluginResponseUnionUnion

type HostToPluginResponseUnionUnion interface {
	HostToPluginResponseUnionType() string
	// contains filtered or unexported methods
}

type JsonRpcRequest

type JsonRpcRequest struct {
	ID      xid.ID `json:"id"`
	Jsonrpc string `json:"jsonrpc"`
}

type JsonRpcResponse

type JsonRpcResponse struct {
	Error   opt.Optional[JsonRpcResponseError] `json:"error,omitempty"`
	ID      xid.ID                             `json:"id"`
	Jsonrpc string                             `json:"jsonrpc"`
}

type JsonRpcResponseError

type JsonRpcResponseError struct {
	Code    opt.Optional[int]    `json:"code,omitempty"`
	Message opt.Optional[string] `json:"message,omitempty"`
}

type Manifest

type Manifest struct {
	// Optional API access configuration for this plugin. When provided, the host can provision a bot account and access key for API calls via RPC.
	//
	Access opt.Optional[ManifestAccess] `json:"access,omitempty"`
	// Arguments passed to the "command" invocation.
	// This field is used only for Supervised plugins. External plugins can omit it or provide placeholder values.
	//
	Args []string `json:"args,omitempty"`
	// The author of the plugin. Must match the pattern `^[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`.
	// (NOTE: May change in future.)
	//
	Author string `json:"author"`
	// The executable or script used to launch your plugin. If your plugin is a binary (Go, Rust, C, etc) then this should be a path to that binary, it's best to put it in the root of your plugin archive like `./myplugin.exe` or `./myplugin`. If your plugin is a script (Python, Node, etc) then this should be the interpreter's `$PATH` executable (e.g. `python` or `node`)  and you should include the script in the `args` field.
	// This field is used only for Supervised plugins. External plugins can provide a placeholder value and it will be ignored by the runtime.
	// Note that Storyden cannot guarantee that the runtime environment defined by the person hosting Storyden will have any language's interpreter on the `$PATH`. If you are running your own instance and building a custom plugin, you should `FROM` the Storyden base image for your deployment so that you know what runtimes are available.
	// If you are distributing a plugin for others to use, we highly recommend that you use a statically compiled language such as Go, Rust or Zig for your plugin so that it's guaranteed to be compatible with any runtime.
	//
	Command             string                                    `json:"command"`
	ConfigurationSchema opt.Optional[ManifestConfigurationSchema] `json:"configuration_schema,omitempty"`
	// The description of the plugin. Displayed in Plugin Registries as well as in UI of Storyden installations when installed.
	//
	Description string `json:"description"`
	// The list of events the plugin subscribes to and will receive from the host via RPC. Events allow your plugins to react to things that humans or robots do on Storyden.
	//
	EventsConsumed []Event `json:"events_consumed,omitempty"`
	// The unique identifier of the plugin. Must match the pattern `^[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`.
	// (NOTE: May change in future.)
	//
	ID string `json:"id"`
	// The name of the plugin. This is not a unique identifier and is only used for display purposes within the Plugin Registry and Storyden installation.
	//
	Name string `json:"name"`
	// The version of the plugin. This is not used for any versioning or compatibility purposes by the runtime and is only used for display purposes currently.
	//
	Version string `json:"version"`
}

func ManifestFromMap

func ManifestFromMap(m map[string]any) (*Manifest, error)

func ParseManifest

func ParseManifest(data []byte) (*Manifest, error)

func (*Manifest) ToMap

func (m *Manifest) ToMap() map[string]any

func (*Manifest) UnmarshalJSON

func (final *Manifest) UnmarshalJSON(data []byte) error

func (*Manifest) Validate

func (m *Manifest) Validate() error

type ManifestAccess

type ManifestAccess struct {
	// Optional profile bio for the provisioned account.
	Bio opt.Optional[string] `json:"bio,omitempty"`
	// The account handle to provision for this plugin's API identity.
	//
	Handle string `json:"handle"`
	// Optional profile links for the provisioned account.
	Links []ManifestAccessExternalLink `json:"links,omitempty"`
	// Optional profile metadata for the provisioned account.
	Metadata map[string]interface{} `json:"metadata,omitempty"`
	// The account display name to provision for this plugin's API identity.
	//
	Name string `json:"name"`
	// The list of permission names requested for API access. See https://storyden.org/docs/introduction/members/permissions for available values and descriptions.
	//
	Permissions []string `json:"permissions"`
}
type ManifestAccessExternalLink struct {
	Text string  `json:"text"`
	URL  url.URL `json:"url"`
}

type ManifestConfigurationSchema

type ManifestConfigurationSchema struct {
	Fields []PluginConfigurationFieldSchema `json:"fields,omitempty"`
}

type PluginConfigurationField

type PluginConfigurationField struct {
	PluginConfigurationFieldUnion
}

func (PluginConfigurationField) MarshalJSON

func (w PluginConfigurationField) MarshalJSON() ([]byte, error)

func (*PluginConfigurationField) UnmarshalJSON

func (w *PluginConfigurationField) UnmarshalJSON(data []byte) error

type PluginConfigurationFieldBoolean

type PluginConfigurationFieldBoolean struct {
	Default opt.Optional[bool] `json:"default,omitempty"`
	// A description of the configuration field.
	Description string `json:"description"`
	// A unique identifier for this configuration field, used for
	// referencing the field in the plugin configuration object.
	//
	ID string `json:"id"`
	// A human-readable label for the configuration field.
	Label string `json:"label"`
	Type  string `json:"type"`
}

func (PluginConfigurationFieldBoolean) PluginConfigurationFieldType

func (PluginConfigurationFieldBoolean) PluginConfigurationFieldType() string

type PluginConfigurationFieldNumber

type PluginConfigurationFieldNumber struct {
	Default opt.Optional[float64] `json:"default,omitempty"`
	// A description of the configuration field.
	Description string `json:"description"`
	// A unique identifier for this configuration field, used for
	// referencing the field in the plugin configuration object.
	//
	ID string `json:"id"`
	// A human-readable label for the configuration field.
	Label string `json:"label"`
	Type  string `json:"type"`
}

func (PluginConfigurationFieldNumber) PluginConfigurationFieldType

func (PluginConfigurationFieldNumber) PluginConfigurationFieldType() string

type PluginConfigurationFieldSchema

type PluginConfigurationFieldSchema = PluginConfigurationField

type PluginConfigurationFieldString

type PluginConfigurationFieldString struct {
	Default opt.Optional[string] `json:"default,omitempty"`
	// A description of the configuration field.
	Description string `json:"description"`
	// A unique identifier for this configuration field, used for
	// referencing the field in the plugin configuration object.
	//
	ID string `json:"id"`
	// A human-readable label for the configuration field.
	Label string `json:"label"`
	Type  string `json:"type"`
}

func (PluginConfigurationFieldString) PluginConfigurationFieldType

func (PluginConfigurationFieldString) PluginConfigurationFieldType() string

type PluginConfigurationFieldUnion

type PluginConfigurationFieldUnion interface {
	PluginConfigurationFieldType() string
	// contains filtered or unexported methods
}

type PluginToHostRequest

type PluginToHostRequest struct {
	PluginToHostRequestUnion
}

func (PluginToHostRequest) MarshalJSON

func (w PluginToHostRequest) MarshalJSON() ([]byte, error)

func (*PluginToHostRequest) UnmarshalJSON

func (w *PluginToHostRequest) UnmarshalJSON(data []byte) error

type PluginToHostRequestUnion

type PluginToHostRequestUnion interface {
	PluginToHostRequestType() string
	// contains filtered or unexported methods
}

type PluginToHostResponse

type PluginToHostResponse struct {
	Error   opt.Optional[PluginToHostResponseError] `json:"error,omitempty"`
	ID      xid.ID                                  `json:"id"`
	Jsonrpc string                                  `json:"jsonrpc"`
	Result  PluginToHostResponseUnion               `json:"result"`
}

type PluginToHostResponseError

type PluginToHostResponseError struct {
	Code    opt.Optional[int]    `json:"code,omitempty"`
	Message opt.Optional[string] `json:"message,omitempty"`
}

type PluginToHostResponseUnion

type PluginToHostResponseUnion struct {
	PluginToHostResponseUnionUnion
}

func (PluginToHostResponseUnion) MarshalJSON

func (w PluginToHostResponseUnion) MarshalJSON() ([]byte, error)

func (*PluginToHostResponseUnion) UnmarshalJSON

func (w *PluginToHostResponseUnion) UnmarshalJSON(data []byte) error

type PluginToHostResponseUnionUnion

type PluginToHostResponseUnionUnion interface {
	PluginToHostResponseUnionType() string
	// contains filtered or unexported methods
}

type RPCRequestAccessGet

type RPCRequestAccessGet struct {
	ID      xid.ID `json:"id"`
	Jsonrpc string `json:"jsonrpc"`
	Method  string `json:"method"`
}

Request API access credentials provisioned for this plugin.

func (RPCRequestAccessGet) PluginToHostRequestType

func (RPCRequestAccessGet) PluginToHostRequestType() string

type RPCRequestConfigure

type RPCRequestConfigure struct {
	ID      xid.ID                 `json:"id"`
	Jsonrpc string                 `json:"jsonrpc"`
	Method  string                 `json:"method"`
	Params  map[string]interface{} `json:"params"`
}

Request sent by the host to the plugin to provide configuration settings. The params object can contain any key-value pairs defined by the plugin in its manifest `configuration_schema` field and the plugin should validate and apply these settings to its internal state. If configuration changes require a plugin to restart, the plugin should cleanly shut down with a zero exit code so that the host can restart it if it is a supervised plugin. If it is an external plugin, the plugin itself is responsible for this behavior based on the plugin's lifecycle design.

func (RPCRequestConfigure) HostToPluginRequestType

func (RPCRequestConfigure) HostToPluginRequestType() string

type RPCRequestEvent

type RPCRequestEvent struct {
	ID      xid.ID       `json:"id"`
	Jsonrpc string       `json:"jsonrpc"`
	Method  string       `json:"method"`
	Params  EventPayload `json:"params"`
}

Delivers a subscribed Storyden event payload to the plugin.

func (RPCRequestEvent) HostToPluginRequestType

func (RPCRequestEvent) HostToPluginRequestType() string

type RPCRequestGetConfig

type RPCRequestGetConfig struct {
	ID      xid.ID                                  `json:"id"`
	Jsonrpc string                                  `json:"jsonrpc"`
	Method  string                                  `json:"method"`
	Params  opt.Optional[RPCRequestGetConfigParams] `json:"params,omitempty"`
}

Request the plugin's current stored configuration from the host.

func (RPCRequestGetConfig) PluginToHostRequestType

func (RPCRequestGetConfig) PluginToHostRequestType() string

type RPCRequestGetConfigParams

type RPCRequestGetConfigParams struct {
	// Specific config keys to retrieve. If empty, returns all config.
	Keys []string `json:"keys,omitempty"`
}

type RPCRequestPing

type RPCRequestPing struct {
	ID      xid.ID                             `json:"id"`
	Jsonrpc string                             `json:"jsonrpc"`
	Method  string                             `json:"method"`
	Params  opt.Optional[RPCRequestPingParams] `json:"params,omitempty"`
}

Health-check request sent by the host to verify plugin responsiveness.

func (RPCRequestPing) HostToPluginRequestType

func (RPCRequestPing) HostToPluginRequestType() string

type RPCRequestPingParams

type RPCRequestPingParams struct {
}

type RPCResponseAccessGet

type RPCResponseAccessGet struct {
	Error   opt.Optional[RPCResponseAccessGetError] `json:"error,omitempty"`
	ID      xid.ID                                  `json:"id"`
	Jsonrpc string                                  `json:"jsonrpc"`
	Method  opt.Optional[string]                    `json:"method,omitempty"`
	Result  RPCResponseAccessGetResult              `json:"result"`
}

Returns API base URL and bearer access key for authenticated API calls.

func (RPCResponseAccessGet) PluginToHostResponseUnionType

func (RPCResponseAccessGet) PluginToHostResponseUnionType() string

type RPCResponseAccessGetError

type RPCResponseAccessGetError struct {
	Code    opt.Optional[int]    `json:"code,omitempty"`
	Message opt.Optional[string] `json:"message,omitempty"`
}

type RPCResponseAccessGetResult

type RPCResponseAccessGetResult struct {
	// Bearer access key for API authentication.
	AccessKey string `json:"access_key"`
	// Base URL for API requests.
	APIBaseURL url.URL `json:"api_base_url"`
}

type RPCResponseConfigure

type RPCResponseConfigure struct {
	Method opt.Optional[string] `json:"method,omitempty"`
	Ok     bool                 `json:"ok"`
}

Confirms that the configuration was received and applied correctly.

func (RPCResponseConfigure) HostToPluginResponseUnionType

func (RPCResponseConfigure) HostToPluginResponseUnionType() string

type RPCResponseEvent

type RPCResponseEvent struct {
	Method opt.Optional[string] `json:"method,omitempty"`
	Ok     bool                 `json:"ok"`
}

Acknowledges that the plugin received the event payload.

func (RPCResponseEvent) HostToPluginResponseUnionType

func (RPCResponseEvent) HostToPluginResponseUnionType() string

type RPCResponseGetConfig

type RPCResponseGetConfig struct {
	// Configuration key-value pairs
	Config map[string]interface{} `json:"config"`
	Method string                 `json:"method"`
}

Returns current configuration values for this plugin.

func (RPCResponseGetConfig) PluginToHostResponseUnionType

func (RPCResponseGetConfig) PluginToHostResponseUnionType() string

type RPCResponsePing

type RPCResponsePing struct {
	Method opt.Optional[string] `json:"method,omitempty"`
	Pong   bool                 `json:"pong"`
	// Optional status message
	Status opt.Optional[string] `json:"status,omitempty"`
	// How long the plugin has been running
	UptimeSeconds opt.Optional[float64] `json:"uptime_seconds,omitempty"`
}

Health-check response from the plugin.

func (RPCResponsePing) HostToPluginResponseUnionType

func (RPCResponsePing) HostToPluginResponseUnionType() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL