UNPKG

@goteborgco/open-api-js-client

Version:

Official JavaScript client for the Göteborg & Co GraphQL API

32 lines (31 loc) 1.25 kB
import { Client } from '../client/Client'; import type { LangFilter } from '../interfaces/common'; import { TaxonomyTerm } from '../entities/TaxonomyTerm'; /** * Taxonomy API for querying specific taxonomies * * This class provides type-safe methods for listing all terms within a specific taxonomy, * either as a flat list or as a hierarchical tree structure. */ export declare class Taxonomy { private client; constructor(client: Client); /** * List terms within a specific taxonomy * * @param taxonomyName The name of the taxonomy to query * @param filter Optional filtering options: * - lang: 'en' | 'sv' - Language filter (enum) * @param fields Optional GraphQL fields to return * @param hierarchical Whether to return terms in a tree structure * @returns Array of taxonomy terms, optionally in a hierarchical structure */ list(taxonomyName: string, filter?: LangFilter, fields?: string, hierarchical?: boolean): Promise<TaxonomyTerm[]>; /** * Build a hierarchical structure from flat taxonomy terms * * @param terms Array of taxonomy terms * @returns Array of root taxonomy terms with populated children */ private buildHierarchy; }