Skip to content

ThirdPartyPluginAdapter<TApi>

How to get from one third-party plugin’s instance to its typed API.

An adapter is plain data plus one function, so it can be a module-level constant shared by every consumer, and adding a plugin means adding one adapter.

Import:

import type { ThirdPartyPluginAdapter } from '@mnaoumov/obsidian-lib/plugin/third-party-plugin';

Signature:

export interface ThirdPartyPluginAdapter<TApi extends object>

Properties

PropertyTypeDescription
getApi(plugin: Plugin) => null | TApiReads the typed API off a running instance of the plugin, VERIFYING its shape.

Return null when the instance does not carry the members the adapter types, which is what a release that renamed or reshaped them looks like. Never cast: a cast asserts a shape nothing checked.
minPluginVersion?stringThe oldest release of the plugin the adapter was verified against, compared with its manifest.version. A release below it reads as PluginAvailability.Outdated.
pluginIdstringThe manifest.id of the plugin.
pluginNamestringThe display name of the plugin, shown to the user.

Links to this page: