Add version-aware documentation resolution
This commit is contained in:
+19
-1
@@ -126,6 +126,13 @@ export type DocsDocumentationTopic = {
|
||||
i18n_key: string;
|
||||
locale: string;
|
||||
translation_locale: string;
|
||||
version: {
|
||||
resolved: string;
|
||||
minimum?: string | null;
|
||||
maximum_exclusive?: string | null;
|
||||
range: string;
|
||||
fallback: "unversioned" | "matching_range" | string;
|
||||
};
|
||||
conditions: DocsDocumentationCondition[];
|
||||
links: DocsDocumentationLink[];
|
||||
related_modules: string[];
|
||||
@@ -141,6 +148,16 @@ export type DocsDocumentationTopic = {
|
||||
};
|
||||
|
||||
export type DocsContext = {
|
||||
versions: {
|
||||
mode: "installed" | "selected";
|
||||
selected_version?: string | null;
|
||||
status: "installed" | "stable" | "older_supported" | "unsupported" | string;
|
||||
latest_version?: string | null;
|
||||
stable_version?: string | null;
|
||||
supported_versions: string[];
|
||||
installed_versions: Record<string, string>;
|
||||
fallback_policy: string;
|
||||
};
|
||||
actor: {
|
||||
tenant_id?: string;
|
||||
user_id?: string;
|
||||
@@ -193,10 +210,11 @@ export type DocsContext = {
|
||||
};
|
||||
};
|
||||
|
||||
export function fetchDocsContext(settings: ApiSettings, options: { documentationType?: "admin" | "user"; locale?: string } = {}): Promise<DocsContext> {
|
||||
export function fetchDocsContext(settings: ApiSettings, options: { documentationType?: "admin" | "user"; locale?: string; version?: string | null } = {}): Promise<DocsContext> {
|
||||
const params = new URLSearchParams();
|
||||
if (options.documentationType) params.set("type", options.documentationType);
|
||||
if (options.locale) params.set("locale", options.locale);
|
||||
if (options.version) params.set("version", options.version);
|
||||
const query = params.toString();
|
||||
return apiFetch(settings, `/api/v1/docs/context${query ? `?${query}` : ""}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user